Digital Thermometer with PIC16F818 and LM35

This post will be approached to build an electronic device to measure the temperature, which is reported to the User via an LED display's type 7-segment.

This project consists of two parts: hardware (less complex) and software (more complex). At first describe the concept, function and assembly of the device. In the second do the same for the firmware (program) that will run inside the device.

The main advantage of the approach adopted in this project is the reduced number of components used in construction. Although there are chips dedicated to this task, they may not be easily found and can not be modified or adapted for use in particular. Moreover, the construction of PIC is very didactic.

All the files needed to complete the construction and programming, including the wiring diagram and assembler source code can be found in this archive.

Hardware

The component chosen to be the heart of this project was the PIC16F818, which in its 18-pin presents a sufficient quantity of inputs and outputs (16), has A / D converter integrated 8MHz internal oscillator, can store up to 1K words of program 128 bytes of RAM and EEPROM 128, and more than is necessary for this application. This component has also other resources and convenient, as a module for serial communication and one for synchronous PWM. In another project, I used the serial communication module to implement an I2C bus to a component master slave control other components.

The PIC16F818 is compatible pin-to-pin with his direct ancestor, the popular PIC16F84, but is much more versatile than this.

Among all types of temperature sensors, because of the low price, stability, accuracy and ease of use, the LM35 was chosen. This component is an integrated circuit provided with a temperature sensor and circuitry compensasão heat and power, with the temperature and voltage measurement with resolution of 10mV per degree Celsius.

Prototype mounted on proto-board:

Prototype self-luminous:

Vesão final and his box:

Wiring:

Version PDF.

Source file for gEDA: Termometro.sch

Stock symbols describing the component PIC16F818: PIC16F818-1.sym

Software

The firmware for the thermometer was written in assembly language for PIC in PC / Linux using the open source tools and piklab gputils. Repositories of some distros already come with these packages, but usually they are not installed by default. Nevertheless it was very easy to install them in Fedora using yum:

$ Yum-y install piklab gputils

The screenshot below shows the integrated development environment of piklab, with an excerpt from the source code visible thermometer in the window of publishing. With piklab can organize the files containing the source code in the same directory, and include them in a project file, which also contains information and settings about the hardware on which the program will run. After compiling the source code, you can download the executable for the flash memory chip with just one mouse click.

The software is responsible for making periodic digital readouts of the analog signal provided by the LM35, convert that information into a temperature to the Celsius scale, convert the binary number to decimal, display the temperature on the display, store in EEPROM the minimum and maximum temperatures observed and respond to the pressure of a button. The software also lets you display the temperature in Fahrenheit, if desired. For some of these conversions, it was necessary to implement routines for efficient multiplication and division, since these operations are not present in hardware.

Source code: termometro.asm, distributed under the GPL
Project file for piklab: Termometro.piklab
Compiled. HEX to program the chip: Termometro.hex
All the above files in format. ZIP

Source: Waldeck's Homepage

Related Posts:

  1. The lamp goes digital
  2. Simulation of Robotic Manipulators - Kukim

Who writes