PIC Digital Thermometer and Clock

This project is a reasonably simple large, four digit LED clock. It has the added bonus of being able to monitor up to two temperature sensors if required; one inside and the other outside possible. I’ve tested this with one of the sensors connected via a 5m piece of cable with no problems.

Please read the entire article before attempting construction as after the initial project an upgrade to the design was made to support a more accurate RTC (Real-Time-Clock) module, and this upgrade means make a few changes to the original design.

Here you will find complete construction details including circuit diagrams, PCB layouts and PIC firmware (and the source code).

This project has undergone many revisions since it was first created in 2012. Firmware updates, new clock module and higher LED drive current.

If you want to make use of the temperature sensing feature you MUST use DS18B20 variant ICs; notice the “B”. The none B variant won’t work.

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 the temperature start to drop, the begin to raise back to room temperature.
The large black cable in the foreground is the PIC programming cable. The display consists of 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 12-15v due to their size. The movie on the right is the finished project running. It cycles between two temperature sensors and then shows the current time.

Later an update was made to replace the existing DS1302 RTC (Real-Time-Clock) with a more accurate one. The upgrade was designed as a plug in with only a few changes required to the original PCB.

UPGRADE

The Digital Thermometer clock used a DS1302 RTC chip which isn’t really very accurate and mine tends to lose a few minutes every month, so I started looking around to see if I could find a better alternative.

The DS3231 is billed as an “Extremely Accurate I2C-integrated RTC”. These are supplied in 16 pin surface mount DIL packages and from the limited research I did, seemed a little bit expensive. It would also mean that if I wanted to create a simple upgrade to my clock, I’d have to either make an new PCB, or a small piggy-back PCB board to hold just the chip.
Ebay to the rescue.

I found these:

A search for “DS3231 for Pi” revealed many sellers selling these tiny modules that have a backup battery, the IC, associated discrete components and an interface connector all for very little money but it took a bit of fiddling to figure out the pin connections as the documentation on the Ebay sellers site was just plain wrong, however with the aid of a multi-meter I managed to “tap out” the pins.

Unfortunately they are supplying a lithium backup battery rather than a super-capacitor. This means that the battery will probably need to be replaced at some point.

The conversion of the existing clock is really quite simple.

First, you need to de-solder and remove the following components:

  • Battery BT1
  • J2 Jumper
  • IC5 (RTC Chip) and its socket if you used one
  • X2 32KHz Crystal

The topside of your PCB should now look something like this:

In place of the J2 jumper you’ve just removed, you will need to solder in a wire link as the existing jumper is too tall and will get in the way of the replacement RTC module.

Next there are three modifications to the underside of the PCB board required.

A small wire link needs to be soldered as shown in the yellow circle on the right of the image. This allows +5v to flow to one side of the soldered J2 jumper and eventually into the new RTC module.

Next carefully solder in two 4.7K resistors as shown. These act as +5v pull-ups for the I2C bus connections to the new RTC module. I’ve outlined where the original RTC IC chip was.

The last activity is to modify a 5-pin Molex connector to accommodate the new RTC module. You could just use a strip of 5-header pins instead.

Solder a small length if wire to the right-hand pin. This will be used for the modules GND connection.

The modified connector needs to be soldered into the top row of 4 holes left by the original RTC IC. You may need to carefully drill these holes a bit larger of your connector pins won’t fit.

The wire from the connector is soldered into the bottom right pin hole left after the removal of the original RTC chip – pin 4.

The module can now be inserted into the connector as shown in the lower picture.

The last activity is to load the new firmware .HEX file into the PIC and then switch on.

I do have a re-vamp of this project planned that will include the DS3231 module as standard, but this quick conversion does the job nicely.

The below .ZIP file contains the new .HEX file firmware, and the project source code for those of you who want to make your own modifications.

That’s it…. enjoy.

The V8 firmware supports the date as well as time and temperature. 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 set 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.

The download contains complete assembly instructions, PCB foil, firmware (compiled and source code).


Leave a Reply

Your email address will not be published. Required fields are marked *