PIC Projects

Digital thermometers

Thermometer with an LED display

This projects is based on a prototype that uses the MCP9803 sensor. Hence, most of the schematic is borrowed from there. I just replaced the LED current limiting resistors with an array of 8 isolated resistors, packed in a SOIC-16 case. Also, to save some space on the PCB, I used an array of four 2N3904-like transistors. The last modification is using the degree symbol of the LED, for which one more discrete transistor in the SOT-23 package is used. The base of this transistor is connected to pin RA4 of the PIC. Since this output is open collector one (more exactly, open drain), a pull-up resistor is needed to drive the transistor at this output.

Schematic PCB prototype Etched PCB

The pin assignment of the PIC was also slightly modified from the prototype to meed the layout requirements. My intention was to use only one level of PCB. This was successful as there is only one connection implemented by a jumper. The board size is 50x68mm and it was designed by using the Eagle layout editor. I have designed the board from scratch without drawing the circuit. The PCB was manufactured by using the method described by Steve Daniels. Instead of the PnP paper I used regular photo paper. After ironing the raw PCB wrapped into photo paper with the layout drawing on it for about 10 minutes, all toner from it moved to the PCB. The middle image above shows the PCB right after that step. Some problematic spots after removing the paper were fixed with a Sharpie permanent marker. I also put some tape at the most damaged place (the right edge of the board). The right image shows the board after etching.

Most of the code is also borrowed from the above mentioned prototype. I just modified a few places there due to a different PIN assignment contingent on the layout. In addition to that I have also added some code for displaying the degree symbol. As the result, each LCD digit (including the degree symbol) is displayed for 3 msec. Since the sensor I2C interface provides very fast communication, reducing the main time slot from 4 msec down to 3 msec did not affect the unit's functionality. The temperature is still read from the sensor every 4 sec, which is accomplished by a slightly different setup of the TMR0 timer.

Assembled PCB Thermometer displaying °C

Most of the used electronic components are intended for on-surface mounting. Excluded from this are the LED display, the resistors, one wire jumper, and the button. Instead of the PIC16F648A one can use 16F628A, I just did not have on hand. All holes for the through-hole mounting components were drilled with a #71 bit (approx. 0.6mm). The button leads are thicker, so a 1mm bit was used instead. The top surface of the PCB is not used for the layout. I left it alone to save some chemicals, as I had no one-sided boards handy. This surface is, however, connected to the ground in order to make at least some use of it. All small holes on this side of the board were drilled a little with a larger drill bit so that the components don't short cut to ground. The first chip mounted on the board was the PIC. This way it can be easily programmed by using the ICSP programmer, as the other components won't influence the programming process.

Fixing a design flaw and final assembly

The problem I faced with that design was that after about 5 minutes of operation the displayed temperature exceeded the real one on about 8°F. It turns out that the sensor was heated up by other components. I powered the unit from a small power supply, providing 7.5V DC under the full load of 80mA drawn by the circuit. The power stabilizer chip on board dissipates about 250mW of power in this case, and is the main source of heat. I could not feel it at all, however, even by touching it with my leaps. The temperature sensor, in fact, measures the temperature of the pins, which is in this design the temperature of the PCB. I tried to move the sensor to another place within the case and connected it with the PCB via 4 wires of about 2" length. This helped just a bit, but did not solve the problem.

So I decided to move the sensor completely outside of the box. It is now connected to the circuit via a Molex 4-pin connector on the back of the case. The cable is made from a computer audio cable connecting a CDROM with a motherboard. This completely eliminated the heating effect, and I got a possibility to measure the temperature remotely (up to about 1' cable length distance). This could be used, for example, for checking the temperature in different places inside a computer case.

Thermometer case and sensor Back view on the case

The case is made from 0.1" plexiglass. Four side panels are glued to the front panel and to each other. By unscrewing 4 bolts on the back panel one gains access to the PCB. The button shaft is made from small plastic parts of a ball pen mechanism. It also uses a short part of the pen spring to prevent it from moving back and forth. The slight pressure provided by the spring does not press the button, one still has to apply a noticeable force for that. To prevent short circuits on the sensor board I protected it by pulling a peace of a plastic heat-shrink tube over it (not shown on the picture).

Downloads:

Thermometer with an LCD display

This thermometer shows the air temperature in Fahrenheit as an integer value, and is intended for indoor usage. The displayed temperature range is 32°F - 147°F and matches the working temp range of the LCD. Lower and higher actual temp values are displayed as 32 and 147, respectively, and therefore are displayed incorrectly. The unit is based on the prototype described here. I just assembled it on a PCB and used the same PIC as in the prototype, but intended for surface mounting. Another minor difference is usage of the NCP1400A DC-DC converter, so that 5V can be attained from a single AA battery (complete device name is NCP1400ASN50T1G; data-sheet manufactured by ON Semiconductor), because I wanted to try something new. This converter also requires a 22μH inductor (I used one from the JW Miller PM54 series) and a Schottky rectifier diode (I used 30V 100mA Panasonic MA27D3000L with reverse recovery time 1ns).

Back of the PCB Layout of the components

The PCB is one-sided one, and is designed to fit into the RadioShack 3x2x1" project enclosure. There are two wire jumpers on the PCB, shown in white color on the right image above. The PCB, this time, was manufactured by using the blue PnP-paper. The 5 square pads on the left side of the PCB are intended for PIC programming. I temporarily soldered a 5-wire ICSP cable to them after populating the PCB. One can program the device without breaking the PIC connectors, just the battery has to be unplugged. This way the unit can be easily reprogrammed after any firmware modifications, for example if one prefers to display the temperature in degrees Celsius instead. The battery is connected to the PCB by using two square pads in the top right corner of the PCB. The battery holder is glued to the bottom part of the enclosure box. The PCB is covered with a transparent Base+Top coat for nails, to protect the copper connectors from oxidation. I used practically the same software as in the prototype, just the LCD module configuration part is shortened a bit.

Front view Thermometer case inside

Since the unit consumes very little energy, there are no warm parts on the PCB that affect the sensor's reading. So, I mounted the sensor on the PCB. The difference between the readings of various digital thermometers that I have at home and this device does not exceed 2°F. This is within the accuracy range of the used temperature sensors.

Downloads:

Test results: the battery ran out of juice after exactly 3 months. When I pulled it out, it (and the space around) was covered with some sort of chemicals coming out of the battery, see the photo below. The open circuit voltage was 0.85V. I cleaned the terminals and put it back. However, after several minutes of operation the voltage dropped down to 0.65V which is below the threshold of the used DC/DC converter. I used a very generic battery and have no data comparing it with the ones manufactured by the companies specializing on batteries. Anyway, I have started another test on Dec 22, 2007, with a standard AA alkaline battery manufactured by Energizer and post an update when it dies.

... 3 months later

Added 3 months later: No the problem is deeper... The Energizer battery also ran out of juice after 3 months. I replaced the 5V converter with a NCP1400 version that delivers 3.3 volts instead. It helped, as the device works already for 4 months from the same battery. The next model turns out to be much more economic. Check here for a real low-power thermometer.

Added several month later (Sep 2009): I think I got it out. NCP1400 turned out not to be suitable for low-power applications, because it itself draws about 400 μA of quiescent current even with no load connected. I replaced it with TPS60312 assembled on a separate small PCB and removed the pull-up resistor at the SCK line. This required to slightly modify the code (see the update below). The quiescent current of TSP60312 does not exceed 1.5 μA. This way the measured average current consumption dropped down to about 15 μA. So, a single AA cell should be able to power the device for a couple of years. This is still not a limit. Now the bottleneck of the current consumption is the microcontroller. In this application it is clocked at 31 KHz from the internal oscillator. If its clocking frequency would be boosted up to, say, 1 MHz, all computations in the active mode would be much faster that would further decrease the power consumption. I need more experiments for this, though. The sensor is also not the best one with respect to the power consumption at provided accuracy. Texas Instruments TMP112, for example, looks much more attractive.

Using TPS60312

The next thermometer uses MAX1724 whose quiescent current is also pretty low. The battery lasts for a whole year. However, it is efficient at higher power consumption. In this sense TPS60312 (in the snooze mode) suits much better for running low-power devices.

Downloads:

Another thermometer with an LCD display

The reason for assembling this device was two-fold. First, I wanted to test Maxim MAX1724 DC-DC converter. An interesting feature of this IC is that no rectifier diode is needed. Furthermore, it is an extremely low current consuming device (only 1.5μA). I have to say that it works just great. The manufacturer offers several types of MAX1724 for output voltages from 2.7 to 5V. I used the one that delivers 5V (full part name is MAX1724EZK50-T). The thermometer is powered from a single AA cell, its holder is glued to the back wall of the project case.

Another reason to build it was that I wanted to check my new hot-air rework station by soldering a PIC in a 6x6mm QFN package that has the pin pitch 0.65mm. This package has no leads and the pins are located at the bottom, which makes soldering it with conventional tools (I mean a soldering iron) extremely difficult. The width of the wires on the PCB is 0.254mm (0.01"). The rework station and the solder surface tension did their work for perfectly positioning the IC on the PCB.

PCB wiring under the LCD Completely assembled PCB

The circuit is practically identical to the second thermometer on this page. The minor difference is that I used another DC-DC converter and the values of the I2C interface resistors is 4K7, just because I had those handy. The software is slightly modified also. The temperature is shown in degrees Celsius with no decimal digits. This allowed me to use just one byte to represent the temperature, although a 12-bit temperature value is requested from the sensor. This makes its conversion more accurate. The conversion from binary to BCD is done by using a table stored in the EEPROM. The thermometer displays negative temperatures in the range -9..-1°C. The temperatures below -10°C and above 100°C require more than two digits and are displayed by two minus signs, although I doubt that the device can work under those temperatures simply because they are out of working range of the use LCD (VI-201 manufactures by Varitronix). The temperature sensor is MCP9803 and the PIC is 16F916. The PCB is mounted on internal posts within the project box. The metallic front panel supplied with the box is replaced with one made from plexiglass. Unfortunately, to replace the battery on has to unscrew all 6 bolts. Hopefully, one does not need to do it very often.

Thermometer displaying °C Layout of the components

Test results: the battery worked for slightly over 1 year. A better life-time is expected if one uses a 3.3V version of MAX1724 instead. Check here for a real low-power thermometer.

Downloads:


Last modified:Mon, Jan 23, 2023.

16590