Monday 31 March 2014

Digital Thermometer Interfaced with Android

The main aim of the project is to build a digital thermometer which can calculate temperature and send it to an android phone via a bluetooth module



Major Components


8051 Microcontroller board, LM35, ADC 0804, 16x2 LCD, Bluetooth Module, Serial board to board connector, Android phone

Block Diagram




Block Diagram showing Digital Thermometer Interface with Android


Circuit


Circuit showing Digital Thermometer Interface with android

Working


1. Temperature Sensor

LM35 is used as temperature sensor. It has a output Voltage proportional to Celsius temperature. The sensitivity is 10mV/C which means a temperature of 30 ℃ will produce a output voltage of 0.3V

2. Analog to Digital Converter

ADC0804 IC is used as ADC. It is a single channel ADC i.e can take only one analog signal as input. It has 8 bits which means it can produce a digital output between 0 to 255. It uses successive approximation technique to convert the analog input to digital output.

The step size can be adjusted by Vref/2 pin. If there is no voltage set at Vref/2 pin, the ADC considers Vcc as the reference voltage. So, for a 5V input the step size is 5/256 = 19.53mV. In case we provide 1.28V at Vref/2 pin, the reference voltage will be 2.56V so that step size is 2.56/256 = 10mV. This means for every 10mV increase in the analog input the digital output is incremented by 1 bit.

3. Micro controller

The digital output of ADC is interfaced to a 8051 microcontroller. The 8051 sets the start of conversion (SOC) on ADC and reads the digital values at the end of conversion (EOC). The digital values are in HEX, it is converted to BCD and displayed on LCD as char. Here is the code to interface 8051 with LCD
  • CS (pin 1 in the circuit) is always grounded which means ADC is always enabled
  • For SOC, provide a edge trigger from 0 to 1 to the WR pin (pin 3 in the circuit)
  • The ADC will take finite amount of time for conversion, after which INTR pin is indicates low (pin 5 in the circuit). This indicates EOC
  • After EOC, we can read the digital output by providing an edge trigger from 0 to 1 at RD pin (pin 2 in the circuit)
The micro controller is also interfaced to a serial profile Bluetooth module at a baud rate of 9600. Once the Bluetooth handshake is finished, a message packet constructed with temperature is also sent continuously to the Bluetooth via serial port

4. Android app

A custom built android app discovers the nearby Bluetooth devices and connects to the one with serial port profile. The message packet sent from 8051 is decoded and the temperature is displayed on the mobile screen

3 comments: