PIC Digital Thermometer and Clock

Here you will find complete construction details including circuit diagrams, PCB layouts and PIC firmware (and the source code). The code was written in Proton PIC BASIC but the good news is that there is now a free version of this compiler available for download; AMICUS18.
** UPDATED 30th June 2016 **
There is an update to this project available that replaces the inferior DS1302 RTC with a much more accurate DS3231 module.
Details of the update are available here.
** ERRATA 24th April 2016 **
An eagle eyed constructor pointed out that the parts list states X1 is 20MHz.
It should be 16MHz. It's correct in the schematic.
** UPDATED 31st Jan 2016 **
New v8 firmware supports displaying date (month and day) as well as time.
Also removes the need for the PIC crystal so frees up two additional I/O pins.
Display interrupt routine is tiny and much faster than before resulting a brighter display with much less flicker.
** UPDATED 17th Aug 2013 **
There was a bug in the firmware that prevented the backup battery from being recharged correctly.
** UPDATED 18th April 2013 **
The PIC firmware has been updated to reduce display flicker whilst giving brighter digits, and the code is now a lot simpler to change including changing the length of time the time and temperatures are shown if required. I've also updated some of the program comments to help people who want to make changes.
** UPDATE 6th Jan 2012**
I’ve been asked how far from the main unit the temperature sensors can be located.
The unit I built had one sensor fixed within the unit (5cm of cable), and the other sensor located outside, but the cable run was actually probably only around 50cm.
When I tried a longer 5M cable, I couldn’t get the sensor to work, but everything I read indicated that several hundred meters should be possible without any hardware changes.
In desperation, I tried another sensor IC and hey-presto, it worked with the 5M cable I was using.
I purchased ten of the DS18B20 ICs off Ebay for less than £2 each and they all worked perfectly with the 5M cable; the original sensor would still only work over a short distance. I can only assume that I was unlucky to have obtained a semi-faulty sensor IC.
So, you should be able to use a sensor on at least a 5M cable run and if you have problems, I’d initially start with another sensor IC. In theory, you should be able to run over a much longer cable, but I’ve not tried that.
An eagle-eyed reader has also pointed out a couple of slight typos that I've fixed and I've change the PCB and circuit diagrams to accept 12way Molex connectors instead of the now hard-to-find 11way ones.
** UPDATE 29th August 2014 **
If you want to use the temperature sensor options, you MUST use DS18B20 variant ICs. Do NOT use the plain DS1820 variant as the current firmware does not support them.
** UPDATED 30th June 2016 **
There is an update to this project available that replaces the inferior DS1302 RTC with a much more accurate DS3231 module.
Details of the update are available here.
** ERRATA 24th April 2016 **
An eagle eyed constructor pointed out that the parts list states X1 is 20MHz.
It should be 16MHz. It's correct in the schematic.
** UPDATED 31st Jan 2016 **
New v8 firmware supports displaying date (month and day) as well as time.
Also removes the need for the PIC crystal so frees up two additional I/O pins.
Display interrupt routine is tiny and much faster than before resulting a brighter display with much less flicker.
** UPDATED 17th Aug 2013 **
There was a bug in the firmware that prevented the backup battery from being recharged correctly.
** UPDATED 18th April 2013 **
The PIC firmware has been updated to reduce display flicker whilst giving brighter digits, and the code is now a lot simpler to change including changing the length of time the time and temperatures are shown if required. I've also updated some of the program comments to help people who want to make changes.
** UPDATE 6th Jan 2012**
I’ve been asked how far from the main unit the temperature sensors can be located.
The unit I built had one sensor fixed within the unit (5cm of cable), and the other sensor located outside, but the cable run was actually probably only around 50cm.
When I tried a longer 5M cable, I couldn’t get the sensor to work, but everything I read indicated that several hundred meters should be possible without any hardware changes.
In desperation, I tried another sensor IC and hey-presto, it worked with the 5M cable I was using.
I purchased ten of the DS18B20 ICs off Ebay for less than £2 each and they all worked perfectly with the 5M cable; the original sensor would still only work over a short distance. I can only assume that I was unlucky to have obtained a semi-faulty sensor IC.
So, you should be able to use a sensor on at least a 5M cable run and if you have problems, I’d initially start with another sensor IC. In theory, you should be able to run over a much longer cable, but I’ve not tried that.
An eagle-eyed reader has also pointed out a couple of slight typos that I've fixed and I've change the PCB and circuit diagrams to accept 12way Molex connectors instead of the now hard-to-find 11way ones.
** UPDATE 29th August 2014 **
If you want to use the temperature sensor options, you MUST use DS18B20 variant ICs. Do NOT use the plain DS1820 variant as the current firmware does not support them.
The above movie clips shows the prototype running on a bread-board. You can see me squirt freezer spray over the temperature sensor in the bottom left of the picture (looks like a transistor), and then you can see the temperature start to drop, then start to raise back to room temperature.
The large black cable in the foreground you can see, is the PIC programming cable, and the display is made from four, 2" displays. (These were common cathode in the prototype but changed to common anode in the final version).
The electronics run at 5v, but the LED displays need to use 12-15v because of their size. The movie on the right is the finished project running. It cycles between two temperature sensors and then shows the current time.
The large black cable in the foreground you can see, is the PIC programming cable, and the display is made from four, 2" displays. (These were common cathode in the prototype but changed to common anode in the final version).
The electronics run at 5v, but the LED displays need to use 12-15v because of their size. The movie on the right is the finished project running. It cycles between two temperature sensors and then shows the current time.
Notice the temperature in the second picture of 25.1 matches the display on my laser thermometer. Not bad for a £4 sensor from Dallas/Maxim semiconductors.
V8 Firmware supports date as well as time
The V8 firmware is available from below if required. When used, the clock will show the time, temp1 and temp2 if the temperature sensors are present, and then show the month followed by the day.
To set the date you need to wait till the clock displays the day and then press the button.
The year will be displayed as 4 digits. Pressing the button will increment the year to 2099 at which point it will reset back to 2016.
Once the year is correct leave the clock for around 5 seconds, and then the month will be displayed. Again, pressing the button will increment the month. Once correct, leave for 5 seconds and then the day will be displayed. Pressing the button will increment the day which will reset to 1 when it reaches 31.
To set the date you need to wait till the clock displays the day and then press the button.
The year will be displayed as 4 digits. Pressing the button will increment the year to 2099 at which point it will reset back to 2016.
Once the year is correct leave the clock for around 5 seconds, and then the month will be displayed. Again, pressing the button will increment the month. Once correct, leave for 5 seconds and then the day will be displayed. Pressing the button will increment the day which will reset to 1 when it reaches 31.
File Download
The below file (around 1.6MB) contains the following files:
DigitalTempV6.bas
DigitalTempV6.hex Version4.dch Version1.dip ThermometerV7.pdf |
This is the source code for the PIC and was compiled using the AMICUS18 compiler from Crownhill
This is the PIC .HEX file that can be programmed directly into the PIC DipTrace format circuit diagram. DipTrace is available for free DipTrace format PCB foils. Construction details for this project. This was revised on the 18th Jan 2015 to include some minor corrections. |
![]()
|
![]()
|