You are on page 1of 18

Wireless Temperature Sensor and Data Logger

Presented by:
Akash gautam Abhinav saksena

Introduction: This project deals with a portable wireless data acquisition system for temperature in real time process dynamics. Process variables (like temperature, pressure, flow, level) vary with time in certain applications and this variation should be recorded so that a control action can take place at a defined set point. This project uses an 8- bit embedded platform for a sensor and RF communication for data transmission. This wireless data logger senses and monitors the variations in the local temperature there by transmits the data within the range to an assigned embedded processor based server. Received temperature is displayed on a local liquid crystal display (LCD) on assigned server and simultaneously on computer.

Block Diagram
Transmitting unit
Temperature Sensor ADC Microcontroller

Receiving unit
LCD Microcontroller
PC Receiver

Buzzer

Temperature Sensor( LM-35): The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 is rated to operate over a 55 to +150C temperature range & it draws only 60 A from its supply, it has very low selfheating, less than 0.1C in still air. The output voltage varies by 10mV in response to every oC rise/fall in ambient temperature, i.e., its scale factor is 0.01V/ oC. The general equation used to convert output voltage to temperature is: Temperature ( oC) = Vout * (100 oC/V)

So if Vout is 1V , then, Temperature = 100 oC The output voltage varies linearly with temperature.
Pin No 1 2 3 Function Supply voltage; 5V (+35V to -2V) Output voltage (+6V to -1V) Ground (0V) Name Vcc Output Ground

Analog to digital converter: An analog-to-digital converter is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity's amplitude. We know that AVR has a inbuilt ADC. The ADC is multiplexed with PORTC that means the ADC channels are shared with PORTC. The ADC can be operated in single conversion and free running more. In single conversion mode the ADC does the conversion and then stop. While in free it is continuously converting. It does a conversion and then start next conversion immediately after that. The ADC has only four registers. ADC Multiplexer Selection Register ADMUX : For selecting the reference voltage and the input channel. ADC Control and Status Register A ADCSRA : As the name says it has the status of ADC and is also use for controlling it. The ADC Data Register ADCL and ADCH : The final result of conversion is here.

Using the ADC:ADMUX Register. Reading an analog value.


REFS1 REFS0 selects the reference voltage.
uint16_t ReadADC(uint8_t ch) { //Select ADC Channel ch must be 0-7 ch=ch&0b00000111; ADMUX|=ch; //Start Single conversion ADCSRA|=(1<<ADSC); //Wait for conversion to complete while(!(ADCSRA & (1<<ADIF)));

The ADCSRA Register.

//Clear ADIF by writing one to it ADCSRA|=(1<<ADIF); } return(ADC);

Microcontroller (Atmega 8): The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel in 1996.

Atmega has 3 GPIO. IT has 23 I/O pins. Any I/O pin can be used as an input pin or an output pin. Input Pin: A I/O pin configured to work as I/P. Output Pin: An I/O pin configured to work as O/P. The configuration of an I/O pin depends on 3 registers, DDRX: Data Direction Register PORTX: Data Register PINx: Port Input pin register.

Controlling Pin behavior


Register DDRX Description Data Direction Register
Port Data Register Data Read Register

Function Sets a pin as Input or Output.


Assigns a default value to an I/O pin. Used to read the instantaneous value of an Input pin.

To set the first pin of PortB as an input pin, we would simply write: DDRB.0=0; // Set PB0 as input pin. To set it as an output pin, we would simply replace 0 by 1, DDRB.0=1; //Set PB0 as an output pin.

PORTX

PINX

Real time clock:Atmega 8 has built in RTC registers void main(void) {unsigned char h,m,s; unsigned char date,month,year;

unsigned char h2[3],m2[3],s2[3]; unsigned char date2[3],month2[3],year2[3],temp[2 ];


// Real Time Clock initialization rtc_init(0,0,0); rtc_get_time(&h,&m,&s); rtc_get_date(&date,&month,&y ear);

WHAT IS RS-232?

The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels for the data transmission and the control signal lines. Valid signals are either in the range of +3 to +15 volts or the range -3 to -15 volts with respect to the ground/common pin; consequently, the range between -3 to +3 volts is not a valid RS-232 level.

For data transmission lines (TxD, RxD and their secondary channel equivalents) logic one is defined as a negative voltage, the signal condition is called "mark." Logic zero is positive and the signal condition is termed "space."

RS-232 COMMUNICATION PORT

RS-232 is basically to control signals connecting between DTE (data terminal equipment) and DCE (data circuit-terminating equipment).

Data Lines

RxD (Data receive)


TxD (Data Transmit)

Control Lines

RTS (Request to send)


CTS (Clear to send) DTR (Data terminal ready) DSR (Data Set ready)

USART

Universal Synchronous Asynchronous Receiver Transmitter (USART) is a highly flexible serial communication device.

It can communicate in synchronous as well as in asynchronous modes.


Communication may be

simplex (in one direction only, with no provision for the receiving device to send information back to the transmitting device), full duplex (both devices send and receive at the same time) half duplex (devices take turns transmitting and receiving).

UARTs are commonly used in conjunction with communication standards such as RS-232, RS-422 or RS-485. The AVR has a full duplex USART with a high resolution baud rate generation

USART DATA FRAME

The idle, no data state is high-voltage, or powered. Each character is sent as a logic low start bit + a configurable number of data bits (usually 8, but legacy systems can use 5, 6, 7 or 9) + an optional parity bit + one or more logic high stop bits. The start bit signals the receiver that a new character is coming. The next five to eight bits, depending on the code set* employed, represent the character void USART_Init( unsigned int ubrr) { /* Set baud rate */ UBRRH = (unsigned char)(ubrr>>8); UBRRL = (unsigned char)ubrr; /* Enable receiver and transmitter */ UCSRB = (1<<RXEN)|(1<<TXEN); /* Set frame format: 8data, 2stop bit */

Interfacing AVR with PC via UART

AVR TTL over Tx & Rx connection

MAX-232 LEVEL SHIFTER

RS-232 Cable

Data send/receive from terminal software

Serial Peripheral Interface


Is a synchronous serial data link standard established by Motorola. Devices communicate using a master-slave relationship in which master initiates the data frame. Communication is possible in full duplex mode. SPI signals:

SCLK : Clock

MOSI: Master data output Slave data input


MISO: Master data input, Slave data output CSS: Slave select

The below figure shows a single slave configuration.

Typical hardware Setup

The bus master first configures the clock, using a frequency less than or equal to the maximum frequency the slave device supports. Such frequencies are commonly in the range of 1 100 MHz.
The master then transmits the appropriate chip select bit for the desired chip to a logic 0. During each SPI clock cycle, a full duplex data transmission occurs:

the master sends a bit on the MOSI line; the slave reads it from that same line the slave sends a bit on the MISO line; the master reads it from that same line

Initialization

// I2C Bus

i2c_init();

APPLICATIONS OF WIRELESS TEMPERATURE & DATA LOGGER

In this smart world there are many smart devices which may measure different variables of environment.

Some of the important applications are1.Cold Storage compound. 2.Used in places of Extremes

3. Data acquisition systems


4.Home Automation etc.

Thank you

You might also like