Accurate digital wall clock with GPS and remote control
Kello version 4
This is fourth version and maybe final version of my seven segment digital wall clock. I wanted to to retain all good features of version 3 and add some new. I also targeted to lower the cost of parts, as the Maxim DS3231 is very expensive and the SAA display drivers were not too cheap either. So the LED drivers are replaced with TLC5925, and RTC is changed to PCF2129. On circuit design the swap of these parts was quick, but on FW side a little slower, as I had to write the drivers.
You can see a presentation of the features on video below. The video also compares the previous clock versions briefly. If you want to skip the presentation of previous versions, click here.
Features
- 58 mm (2.3") 7-segment displays
- Adjustable brightness
- Both 'clock-dots' and decimal points for different display modes
- Shows time, date, day of week, inside and outside temperature, atmospheric pressure, relative humidity and dew point
- Two toggle modes which alternate between display modes listed above
- Battery backed real time clock with very accurate timekeeping
- IR remote control compatible with Nec, SIRC (Sony), Kaseikyo, Matsushita, Samsung, JVC and RC5 protocols.
- Buzzer for generating sound, used for hour beep and alarm
- Two connectors for thermistors to measure inside and outside temperatures
- Option connector for e.g. I2C barometer
- Accurate time from GPS with U-Blox CAM-M8 GPS module
- Automatic daylight savings time
- Time and date formatting and temperature unit can be changed to suit all regions
- Master / slave functionality via IR signaling
Hardware
The version 4 uses same 58 mm (2.3") displays as version 3. There are compatible displays available from several manufacturers. The displays must be common anode type. Suitable displays are e.g. Sharlight CM1-2302 series, Kingbright SA23-11 series, Wenrun LSD230B series and also most of the 2.3" displays from eBay.
The best matching flat top LED for the cheap eBay displays that I've found is Kingbright WP483SRSGW (or older code Kingbright L-483SRSGW). This is actually bi-color LED but when mounted as in assembly drawing, it lights red. When mounted the other way round, it will light green. The green is a good match for Wenrun LSD230BAG-101-01 green display which is available from TME at a very affordable price. The picture on top of this page shows the green Wenrun display. I've also used shrink tube around the LEDs to prevent light leakage from side.
Previous clock used the internal temperature sensor of the DS3231 RTC to show temperature. This wasn't however giving accurate readings since the power dissipated by displays and drivers was heating the RTC. Version 4 has connectors to fit two external NTC thermistors to measure inside and outside temperatures. Suitable thermistors are available from eBay. They have 10 kohm resistance beta value of 3950. The thermistors have an XH connector at one end, which is a Chinese copy of JST XH series connector. You can use either the genuine JST or the Chinese replica on the PCB. According to my measurements these thermistors follow very closely to this chart on Adafruit website. I measured one thermistor in ice water 31.87 kohm and in boiling water 652 ohm. The firmware has an array based on the Adafruit table and in practice the displayed temperature value seems to follow very closely to a commercial digital thermometer.
The remote control support is improved. The firmware supports Nec, Nec42, Samsung, SIRC, Kaseikyo, Matsushita, JVC and RC-5 protocols. It also has a learn function which can be used to teach it to work with any remote which uses one of the supported protocols. You can use e.g. an old TV or DVD remote control to control the clock. The IR receiver should be chosen based on the carrier frequency used by the protocol. SIRC uses 40 kHz, RC-5 uses 36 kHz and the rest use 38 kHz. However, the 38 kHz works quite well also for SIRC and RC-5. An example of suitable 38 kHz receiver is Vishay TSOP53438. It is cheap, sensitive and has good noise rejection.
Time base of the clock is derived from PCF2129AT. It also provides battery back-up. The power consumption of the RTC is 2.15 μA when in backup mode. A CR2032 battery has a typical capacity of 190 mA so it should last for over 10 years. Of course when clock is getting power, the battery is not drained. The PCF2129AT is temperature stabilized and the accuracy is very similar to DS3231 for only fraction of price.
A piezoelectric buzzer can be used to give audible alerts. Currently there is possibility to configure it to hourly beep and/or wake-up alarm. There is also an IR emitter LED which is used in master / slave setup to transmit time and date from master clock to slaves. It could also be used for alarm, so the clock would e.g. turn on TV when the alarm activates, but this is not currently supported.
There is also a footprint for U-blox CAM-M8 GPS / Glonass / Galileo / BeiDou module. The firmware has automatic recognition for GPS module and PCF2129 RTC. It works with eiher one, or both. The firmware only uses the time and date from GPS, derived from GPRMC message.
Schematics
The schematics are pretty straight forward. The PIC16F1788 firmware makes most job.
Input voltage is fed to connector X1. It should be high enough to be able to drive the chain of 4 LEDs in each segment. For red displays this is typically around 7.5 V. Then the output stage of TLC5925 needs an additional 1.0 V to maintain regulation. A 12 V power supply is OK for most display types. To save some power, 9 V supply is usually also OK. Voltages up to 17 V can be used (or up to 16 V if using MCP1703-3302E/DB as regulator IC6), but this causes just more power wasted and heat generated in the display drivers. Diode D1 protects from incorrect supply polarity, but for over voltage there is no protection.
The displays are driven by three TLC5925 constant current LED drivers. They are controlled via SPI bus from PIC. The LED current is set with a resistor in R-EXT pin on the TLC5925. Current at each output is 18 times the R-EXT pin current. Now a little trick is used to allow global brightness control of all segments. The integrated DAC and integrated op-amp of PIC is used to control the low sides of R-EXT resistors. This allows easy brightness control without using PWM and without all the disadvantages associated with PWM.
The PCF2129AT RTC has possibility to use either SPI or I2C. Here the I2C is used. The PCF2129AT is configured to output 1 Hz output clock to PIC. This generates interrupts to update the time. The I2C bus is also available at option connector X4.
On the schematics the IR receiver is marked as TSOP53438. Also many other types should work, some are proposed in circuit diagram. IR decoding is done in firmware. The IR emitter LEDs are connected in series. Two drive transistors Q1 and Q2 are paralleled to share the heat load. Constant drive current for transistors Q1 and Q2 are set by Vbe of Q3 divided by resistors R1 and R2, respectively, yielding a total of 130 mA. The drive current is too high for continuous operation, so the LEDs must be pulsed with a duty cycle of 1/3 to 1/4.
Joystick switch readout uses internal pull-up of PIC so it can be connected directly. Thermistors are connected to connectors X2 and X3. They form voltage divider with resistors R6 and R7, and the divided voltage is measured with PIC ADC. The buzzer is driven from input supply of the clock via Q4 to generate loud enough sound.
GPS module CAM-M8 is configured to use it's internal antenna, so the only external component it needs is a bypass capacitor. It is connected to the PIC via UART. Main purpose of the module on this clock is to provide automatic and accurate time setting.
kello_v41.sch.pdf 11.9.2018 Circuit diagram v4.1
Board
The PCB for the clock is designed using Cadsoft Eagle version 5.12. The design is double sided, and design rules are quite relaxed. Most of the components are SMD and on bottom side of board. Only the parts which need to be visible or are too high for bottom side are on top. This minimizes board area since the displays fill up the top side of board almost completely. Segment order for display drivers is same as in previous version. It allows simple routing of all segment signals in one layer. This causes some more work in display driver source code, since the segment order is different for the two displays controlled by one chip.
A Digi-Key shared cart which has all the parts except joystick switch, click here. The Alps SKQUCAA010 5-way directional switch is available from RS (P/N 516-316) and Farnell (P/N 1435775). Digi-Key also lists the joystick switch but it has high MOQ. A directly compatible substitute is available from eBay.
Note when ordering parts; you can save costs by leaving out functions you don't need. Many of the parts can just be left out without affecting other features of the clock. The GPS module is the most expensive component and it doesn't bring that much advantage because the PCF2129 is very accurate. On the other hand, if you use GPS, you can leave PCF2129 and battery holder out. If you use the master / slave functionality, the slave clocks don't require either PCF2129 nor GPS since they will run from internal PIC oscillator and get synced from master clock every minute. You can also leave out IR LEDs and their drive components if you don't need master / slave functionality, or leave out buzzer and drive components if you don't need alarm / hour beep etc.
The Eagle design files, Gerbers and assembly drawing can be downloaded below:
kello_hw_v41.zip 9.9.2018 Schematic and board file, designed with Eagle 5.12.
kello_v41_assy_dwg.pdf 11.9.2018 Assembly drawing including bill of materials
Firmware
The firmware for the clock is written with CCS PIC-C Compiler. The source files package including compiled .HEX file are available for download below.
The IR receiver code was originally based on San Bergmans's NEC reveiver code and RC-5 receiver code. I have thus simplified them a bit and converted to C. Also the RC-5 code is improved such that it syncs the receiver on each received bit. This makes it much more tolerable to different remotes which may have slightly different timings. The JVC, Samsung, SIRC, Kaseikyo and Matsushita receiver codes are written by me but basically they work with same operating principle (timer interrupt driven state machine). I have also added auto recognition, so the IR decoder state machine identifies the code it receives and processes accordingly.
The GPS receiver code is based on code from CCS customer forums code library posted by PICoHolic.
The code for Bosch BME280 temperature, atmospheric pressure and relative humidity module comes with the CCS compiler. For PIC16 series of chips, the compiled code can be too big to fit in memory segments if all code is inline. This can be solved by adding a #separate directive before int32 _bme280_compensate_H_int32 function. This forces the compiler to realize this function as separate, not inline, and allows the code to fit in the memory segments. I also noticed that there was one incorrect register address in the CCS provided driver, which was causing oversampling settings not properly set. I have reported this to CCS so it will probably get fixed in future. The fw v0.91 package below includes a .diff file which can be used to patch the bme280.c file to fix this bug and add the #separate directives.
All the rest of the code, including drivers for TLC5925 and PCF2129 chips is developed by me. You can freely use and modify them for your own use, but use of them for commercial purposes is prohibited without written permission from me. You can find contact info at beginning of the source files or at bottom of this web page.
kello_v4x_fw_v100.zip 11.7.2019 Source files for HW v4.x, FW v1.00. Finally v1.00 release! Contains .hex compiled with CCS version 5.081. Add support for 6th remote button (power). Diagnostics for backup battery and GPS. Fixed displaying negative dew point values.
How to build it
Assembling the PCB is quite straightforward. It is best to begin from bottom side (back side), which has the surface mount components. The component packages are chosen with DIY in mind, having comfortably big pin spacing. If you have previous experience from soldering SMD components, you should be just fine. As usual, begin from the passive components and then ICs and transistors.
On top side it is best to solder first other components than displays and clock colon LEDs. Solder them in order of height, from lowest to tallest. For the 7-segments displays and LEDs there are a few tricks to make them look nicer. If you have 7-segment displays which have black face but white sides, the white sides are visible even behind a tinted acrylic window. You can use e.g. black permanent marker or black electrical tape to mask the sides of the displays. If using permanent marker, it is best done before soldering the displays. Also, the clock colon LEDs look nicer if you put shrink tubing around them, so that light only comes out from top of the LED. It is best to solder the LEDs in place last, so you can adjust the height to match the 7-segment modules. Below is an example of LED and display masking.
After you have finished soldering, carefully check that you have all components correctly oriented and that you haven't made any shorts. Then you can apply power to barrel jack connector, something between 9 V and 12 V DC. Check voltage from the test point TP2, it should be 3.3 V. Then you can proceed to program the PIC microcontroller. You need to have the board powered from mains supply while programming, as the current draw can be too high for the programmer to power it. If you don't have experience on PIC programming, check here.
After successful programming, you should finally see something on the displays.
Enclosure
Maybe the biggest effort in my clock projects has been the enclosure. I have used several approaches. I have used the ready-made Velleman B8009 enclosure with clock versions one and two. I have built wooden enclosures and aluminum enclosures with smoke tinted lexan windows. I have used a photoframe to enclosure the big v4 clock with 5" seven segment displays. I have designed a sheet metal enclosure with a sliding acrylic window with mechanical CAD software. It would be cheap to manufacture in big volumes, but NRE cost is too high for hobby projects. All these designs serve their purpose well and even look nice, but they are either labor intensive or expensive.
Laser cutting has gained popularity, and there are many companies which offer laser cut services online. In Finland, you can even use laser cutting machines in some public libraries for free. PMMA is cheap and cuts nicely with laser. PMMA is also known as acrylic, or by it's common trade names Plexiglass or Perspex. The easiest way is to order from some online service, you just supply the cut files and choose material. I have used Razorlab make the parts shown in photo below. The material is 3 mm thick opaque black acrylic for the back panel, and transparent grey tint acrylic for the front panel. You could also make the back panel from same transparent material as front panel, it is probably a bit cheaper to use only one material. You can download the design file in SVG format below:
kello_v4_enclosure_razorlab.svg Acrylic enclosure design file in .svg format. Designed with Inkscape.
In addition to the acrylic panels, you also need some screws and spacers. See parts list below.
- M3x6 button head screw 16 pcs
- M3x8mm spacers with internal thread 8 pcs
- M3x12mm spacer screws with internal and external threads 4 pcs
- M3 plain washer 4 pcs
You would probably figure out yourself how to assemble the laser cut acrylic enclosure, but below is a detail picture. Attach the 8 mm spacers to rear panel with button head screws. Fix the PCB with 12 mm spacer screws from corners. Use the plain washers between 12 mm spacer screw and PCB. The washer is needed to have proper clearance between the seven segment displays and top panel. Secure the PCB from the remaining 4 holes with button head screws. Attach the top panel with 4 pcs button head screws.
The displays in picture below are Sharlight CM1-2302SR0b. They have black face and all sides are black too, which makes them very nice for the clock project. This same clock is shown at back of above picture. The tinted front window increases display contrast nicely.
How to use it
The firmware implements a menu system which allows to select a desired display mode and also to setup the various configurable functions. You can move in the menu system using the 5-way directional switch on the PCB or with an IR remote control. Below is diagram of the menu structure as it is in firmware v1.00.
Learn remote control
When you have succesfully programmed the clock, it's time to setup it. First you probably want to teach the clock your remote control. If not, you can skip to next chapter. Use the 5-way directional switch to navigate to setup menu, and from there to remote menu. You can use the diagram above as guidance. It's best first to test your remote whether is uses a coding which the clock supports. Go to 'identify' display which shows the IR remote control protocol, if it is identified. Press your remote control buttons. The following codings are currently supported:
- SIRC protocol. Used by Sony. Depending on protocol version, display shows either 'Sirc12', 'Sirc15' or 'Sirc20'. If your remote control uses SIRC protocol, ensure that all the buttons you are going to use transmit the same version of SIRC protocol. For example, some DVD or Bluray remotes can also have buttons for controlling TV, and the TV protocol is usually 12-bit while DVD is 15-bit or 20-bit.
- NEC protocol. A widely used protocol which is presumably developed by NEC. Display shows 'nEc'.
- Samsung protocol. Technically quite similar to NEC protocol. Display shows 'SAMSUn'.
- Matsushita protocol. Display shows 'MAtSUS'
- Kaseikyo protocol. Sometime referred as Japanese protocol. Display shows 'JAPAn'
- RC-5 protocol. Developed by Philips. Was quite popular among hobbyists some 20 years ago. Today remotes using RC-5 coding are rare. Display shows 'rc-5'
- JVC protocol. Developed by JVC. Quite many, but not all, JVC devices use this protocol. Display shows 'Jvc'
- NEC42 protocol. Extended 42-bit version of NEC protocol. Display shows 'nEc42'
If you are unlucky, the display shows 'Error', which means that the remote control coding is not recognized. Try to find another remote. If display stays at 'nonE', it might be that your remote is not an IR remote at all, or more likely, has dead batteries. Try if using fresh batteries help. Nearly empty batteries can also sometimes be reason to get 'Error', if the remote signal is too weak to be properly recognized.
When you have identified a remote which is recognized by the clock, you can teach it. Navigate to 'LEArn' in remote menu. The clock will display the six button names one after another. 'UP', 'doWn', 'LEFt', 'riGht', 'bUtton' and 'PoWEr'. Press a desired key in your remote to teach it. If your remote doesn't work here for some reason and you can't proceed, you can exit learn mode by pressing 5-way directional button. The sixth button 'PoWEr' is not mandatory. You can press here either the same remote button as you used for 'bUtton' or the 5-way directional switch, if you don't want to program the power button.
Now you should have a working remote control. If there is a problem, try to learn it again. If it doesn't help, you can go to 'Shocod' which will display the remote control address and command for each remote control button. The first four digits show address in hexadecimal. The last two digits show the command. Ensure that all the buttons you are going to use transmit the same address, as this is what the clock expects.
That's it, have fun! If you have something to ask, see my contact info from the project web pages at http://kair.us/projects/clock/v4/index.html
Accurate digital wall clock with GPS and remote control
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(1)
- Likes(20)
- Engineer Apr 14,2024
- Steven Piper Feb 26,2024
- dvdspelert Feb 07,2024
- Engineer Jan 02,2024
- Veselin Zhelyazkov Sep 13,2023
- Engineer Jul 07,2023
- Engineer Mar 02,2023
- Repkon Makina Feb 27,2023
- Shogun112 Nov 11,2022
- TYAPKIN MIKHAIL VALEREVICH Oct 31,2022
- Engineer Sep 15,2022
- kapacita ?ubo? Feb 23,2022
- Andrii Moroz Mar 05,2021
- Artur Grabara Jan 16,2021
- Tsibulko Mihail Mihailovich Sep 25,2020
- James Hauser May 16,2020
- Duncan Hames Apr 06,2020
- Jim Bailey Feb 10,2020
- Engineer Jan 14,2020
- Serkan GURSOY Dec 22,2019
- 10 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
-
10design
-
10usability
-
10creativity
-
10content
-
9design
-
10usability
-
10creativity
-
9content
-
10design
-
10usability
-
10creativity
-
10content
-
7design
-
8usability
-
6creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
-
8design
-
8usability
-
8creativity
-
8content
-
8design
-
8usability
-
8creativity
-
9content
-
9design
-
9usability
-
9creativity
-
10content
-
9design
-
9usability
-
8creativity
-
9content
-
9design
-
8usability
-
8creativity
-
10content
More by jaka
- PICkit2- programmer The PICkit2- programmer, PK2M for short, is yet another clone of the Microchip PICkit2 PIC programme...
- Car battery maintenance charger Maintenance chargerOn this page you find all the information needed to build a maintenance charger f...
- 12V timer relay with delay on release Delay relayA simple, solid state delayed off 'relay' for 12V and 24V systems. You could use it to co...
- Toyota Hilux Vigo interior light LED upgrade Toyota Hilux Vigo ceiling light LED modification I replaced my Hilux interior light incandescent bul...
- LED board for IL arcade buttons (outside version) IL arcade buttons LED modificationI am a fan of the IL (Industrias Lorenzo, S.A.) arcade buttons and...
- LED board for IL arcade buttons (inside version) IL arcade buttons LED modification I am a fan of the IL (Industrias Lorenzo, S.A.) arcade buttons an...
- Hardsid ISA clone Hardsid ISA cloneThis is a reincarnation of the Hardsid clone which I made almost 20 years ago. The ...
- Microchip ICD to PICkit adapter Microchip ICD to PICkit adapterThis simple adapter allows to use Microchip ICD programmers with targ...
- BJT water detector DIY water detector / leak alarmHere is simple water detector you can build yourself. It can be used ...
- J-ACE Arcade Controls Encoder Jaka Arcade Controls Encoder The J-ACE is a DIY USB keyboard encoder. It allows you to make e.g. an ...
- DIY Weller WMRT compatible handle DIY Weller WMRT compatible handleHere are desoldering tweezers that you can build yourself. They use...
- Accurate digital wall clock with GPS and remote control Kello version 4This is fourth version and maybe final version of my seven segment digital wall clock...
- Weller WMRP and WMRT compatible soldering station This driver can be used with Weller tips which have integrated heater element and temperature sensor...
- Temperature difference thermostat v2.1 Temperature difference thermostat which can be used to control heating. When the inside temperature ...
- Speed test A DIY replica of electronic speed test game, manufactured by Coinline in Finland. A similar game is ...
- JAKADAPTER - Dual Atari joystick USB adapter This adapter allows to connect two Atari style joysticks, paddles, or Sega Megadrive / Genesis gamep...
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
153 1 1 -
-