Digital & Binary clock with thermometer & hygrometer
Here we have a clock. It's not "another clock". It has digital and binary output. It also has a thermometer and a hygrometer. It's not "another thermo-hygrometer". It display's absolutely humidity (gr/m3) also.
Download source code in .asm
I use a RealTimeClock Maxim DS1305. The RTC backup power is a supercapacitor (0,22F). I test it for 4 weeks, works fine. For this reason it don't have the capability to change the time, but you can do small-corrections. Once you push the button, the seconds change to 30, with no effect to minutes, hours etc. The routine is in lines 1878-1887 "sec30".
You set the time when you program the PIC. You have to program two times. The first time without line 91 (goto rdtime). The routines setDS and settime is execute.
SetDS is setting RTC's control and trickle charger registers. In the settime routine, you set the time. After this, you add line 91 (goto rdtime) and you reprogram it. Now the routines do not execute. RTC can keep the setting and time at least for 28 days. The routines DST3 and DST10 are for DaySavingTime. The check register is flag, 1. The checking routine is in lines 434-460. In the last Sunday of March, the 02:00 o'clock became 03:00 o'clock. In the last Sunday of October, the 02:00 o'clock became 01:00 o'clock. I set the RTC for 12H mode, LEDs for 12H and display for 24H.
Temperature – Humidity
I use a digital humidity and temperature sensor Sensirion SHT11. I bought it in a PCB, with the pull-up resistor and decoupled capacitor ready in place.
Measurements make every 10 seconds.
At 00, 20 and 40 seconds it measures the temperature and calculate the temperature and Absolutely Humidity ("gr/m3" grams at cubic meter of air).
At 10, 30 and 50 second it measures the humidity and calculate the Relative Humidity (%).
The check register is flag, 0. The checking routine is in lines 464-475.
The measure temperature routine is in lines 477-514 "measTEMP" and lines 625-714 "measure".
The calculate temperature routine is in lines 1793-1820 "calcTEMP".
The measure Relative humidity routine is in lines 560-590 "measRH" and lines 625-714 "measure".
The measure Absolute humidity routine is in lines 515-555 "measAH".
The calculate Relative humidity routine is in lines 717-1470 "calcRH".
The calculate Absolute humidity routine is in lines 1473-1728 "calcAH".
I use bright leds. 7 green with 8,2K resistors for seconds, 7 white with 5,6K resistors for minutes and 5 blue with 560R resistors for hours. The maximum current for leds is about 17mA, so I don't have to drive them with transistors.
The PCB build in DipTrace software. Download DipTrace files here.
News on theme: