Simple Temperature sensor with measure displayed into a LCD Display

Simple demonstration of a temperature sensor. I have used an Atmel MCU to measure the temperature coming from the LM35 sensor. It outputs a voltage with a slope of 10 mV/°C.
The MCU provides an internal SAR ADC with 10-bit resolution. The Analog Reference was set by software to 2.56 V. This voltage is auto-generated by MCU so it won’t need any external reference. By this settings the ADC result will correspond to 0×004 (10-bit) for each celsius grade. The MCU allows to Left Adjust the ADC result, so you can get the 8 MSB of the 10 bit conversion. Notice that with 10-bit resolution and 2.56 V as Analog Reference you can use the 8 MSB of the result without making strange calculations, in fact each ADC unit (of the 8 MSB) corresponds to 1°C. Very good! (just make some calculations to demonstrate it).
However by taking the 8 MSB you have a resolution of 1°C. So, if you need more resolution, just consider also the 2 LSB. 2 bits correspond to 4 cases, so by considering the 2 LSB you can have a resolution of 1/4 °C. Not bad!
Finally, after a conversion of the ADC result to ASCII character, the temperature is displayed into the LCD with a refreshing rate of 1 Hz.

In future I’ll implement a clock by getting the time from the DS1307 RTC. It needs of TWI (or I2C) communication to be read/written.

-The MCU used is ATmega8535 (datasheet link:

- The LCD Display controller is KS0070B (the logic is compatibile with Hitachi HD44780 controller)

-The Temperature Sensor used is LM35DZ (datasheet link:

=== UPDATE #1 12-08-2013: ===
Get the source code!
- Source code:

Post time: Oct-14-2017
  • * CAPTCHA: Please select the House

WhatsApp Online Chat !