RC5 Remote Controlled Clock

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1366
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 380 times
Been thanked: 712 times
Contact:

RC5 Remote Controlled Clock

Postby JohnCrow » Sun Feb 25, 2018 3:12 pm

Its been a while since I've had time to do anything with flowcode or contribute to the forums.
This is my latest project. Hopefully will now be able to get back to being a regular again.

Introduction:

This project is a real time clock, which the setup and operation is controlled from a standard RC5 TV type remote control.
It allows the time & date to be setup, along with the alarm settings and other minor functions to be controlled with the RC5 remote control.
The flowchart is well documented, but to assist its understanding I have included the following document.
The clock has the following features
• Battery Backed DS3231 Chip
• Main Display Shows Time & Date in 24 Hr Clock
• Alarm 1 (Hours & Minutes)
• Alarm 2 (Hours & Minutes)
• Alarm Settings Saved To EEPROM (Auto reload after power failure)
• Local Temperature Display
• Help Screen
• Error Checking On Time, Date & Alarm Setup


Equipment Needed:

EB-006 Matrix Programmer (Fitted With 16F1939PIC).
Matrix PSU.
EB-060 Matrix RC5 Board.
Custom LCD Display (4 x 20).
Custom DS3231 Real Time Clock Board.
Standard RC5 Remote Control.


Custom DS3231 Real Time Clock Board. (I2C Bus)

This board uses a DS3231 SMD device, soldered to a DIL Break-Out-Board.

The board also has a Lithium button cell for backup, and a small buzzer powered by a small NPN transistor

Connections:

Port A RC5 Board.
Port B LCD Display.
Port C RTC Clock Board.
C0 Alarm Sense
C3 SCL
C4 SDA

Note : The alarm is not I2C Bus, it is just turned on or off by a high or low on Port C0.

Initial Setup:

Apart from the numeric digits (0 to 9) the other buttons on a remote may not always be the same between models and manufactures.
For this project I am using the following type of remote.

Hauppauge A415-HPG-WE-A

Originally supplied with a analogue TV Tuner Card for a PC.
I’ve have supplied a basic test program to read the output of the remote.
This is shown as follows

Line 1 = Data.
Line 2 = Address.
Line 3 = Toggle Bit.

It may be necessary to change the values in the flowchart to match your own remote control.
I have noticed a lot of modern TVs do not use the RC5 protocol any more and won’t work with the EB060 board.

Clock Start-up Procedure:

When power is first applied the following procedure takes place.
Initialise Hardware
Check the clock is set (unset = 00:00)
Check the date is set (unset = 01-01-00)

If these are not set correctly the Set Time & Set Date Macros are called and the correct time & date can be entered.

Load alarm settings from EEprom
If these are not set a warning is shown, otherwise the time they are set to is shown.
Default Settings
Alarm 1 = 00:01
Alarm2 = 02:03

Then the clock displays the time & date.

Remote Control Operation:

Reading The RC5 Output:

Flowcode reads the output of the remote using the EB060 E-Block in the following way.

The following buttons on the remote are used for this project.

Main Controls:

Red Code = 11 Setup Time.
Green Code = 46 Setup Date.
Yellow Code = 56 Setup Alarm 1.
Blue Code = 41 Setup Alarm 2.
* Code = 10 Show Alarm 1 Settings.
# Code = 14 Show Alarm 2 Settings.
Up Arrow Code = 20 Show Temperature.
Menu Code = 13 Help Screen.

Numeric Buttons all return their own values (i.e. (0 to 9)
Different remotes may return different values.


Programming The Clock:

When entering a value less then 10, leading zeros MUST be entered from the remote.

When displaying a value less than 10, the leading zero is automatically added to the display.

The flowchart uses separate macros to program the time, date, and alarm.
They are all basically the same principle, as explained below.
The flowchart is fully documented and should be read in conjunction with these notes.

The flowchart waits for the “CheckRX Macro To Return a “1”.This means a signal has been detected from the remote control.

This then reads the Collect Data Macro (selection 0)
This will read the data value of the button pressed. In the case of setting up the time, this is the RED button which returns 11.

The flowchart then drops into a loop where it reads the time.
This is done as follows

Read Hours_High
Hours = Hours_High*10

Read Hours_Low
Hours = Hours + Hours_Low


Read Minutes_High
Minutes = Minutes_High*10

Read Minutes_Low
Minutes = Minutes + Minutes_Low

For example to enter 16:25

Enter Hours
Press 1
1x10 = 10
Press 6
10+6 = 16

Enter Minutes
Press 2
2x10 =20
Press 5
20+5 = 25


At each digit the loop waits for an entry before moving to the next digit
Then the flowchart waits for OK to be pressed to program the RTC.
Seconds are automatically set to 00 at time of programming.

The date and alarm settings are entered in the same way.
Date is programmed by selecting the GREEN Button, and Alarm by the BLUE & YELLOW Buttons.


The only difference is the alarm setting are stored in EEPROM.
That way, if the power fails, the alarm setting are automatically reloaded from the EEPROM when the system restarts.
When the flowchart is first programmed to the PIC the alarm setting are undefined.

Data entry is checked for errors before being accepted. If an error is detected, the entry is rejected and the macro restarted.


Temperature:
A basic temperature value can be displayed by the device, this is selected by pressing the UP key.

Error Checking:

Each data entry macro is error checked.
They all are tested in a similar way, the Time entry using the following algorithm

((Hours < 0) || (Hours > 23) || (Minutes < 0) || (Minutes > 59))

If ((Hours < 0) OR (Hours > 23) OR (Minutes < 0) OR (Minutes > 59))

If any of these conditions are met the flowchart branches and uses a Jump Condition back to the start of the macro.

Appendix 1 - Soldering SMD Devices:

Soldering SMD devices can be quite scary for novice makers, however this device is not too small, and my tip for using them is to use a Break-Out-Board.

Fix the BOB to the bench using a couple of pieces of BlueTak.
Tin the top right solder pad.
Position the device using tweezers if necessary, and a magnifying glass, and reflow the solder on that pin.
Check with a magnifying glass the other pins are lined up correctly, and solder the bottom left pin.
Again check all pins are aligned before finally soldering the remaining pins.



The wiring is all on the pack of the protoboard.

RC5-DS3231-Dual Alarm-Clock-V1.fcfx
(101.58 KiB) Downloaded 68 times


RC5-Handset Test Program V1.fcfx
(15.86 KiB) Downloaded 63 times


Clock-Board-Small.JPG
Clock-Board-Small.JPG (113.02 KiB) Viewed 1706 times


Display-Board-Small.JPG
Display-Board-Small.JPG (81.83 KiB) Viewed 1706 times


HandSet-Small.JPG
HandSet-Small.JPG (54.63 KiB) Viewed 1706 times



System-Small.JPG
System-Small.JPG (103.48 KiB) Viewed 1706 times
These users thanked the author JohnCrow for the post (total 10):
medelec35 (Sun Feb 25, 2018 3:57 pm) • kersing (Sun Feb 25, 2018 4:38 pm) • jgu1 (Sun Feb 25, 2018 6:13 pm) • mnf (Sun Feb 25, 2018 9:02 pm) • LeighM (Mon Feb 26, 2018 9:32 am) • Steve001 (Mon Feb 26, 2018 1:40 pm) • Benj (Mon Feb 26, 2018 6:24 pm) • Steve (Tue Feb 27, 2018 9:41 am) • Jan Lichtenbelt (Thu Mar 15, 2018 8:04 pm) • Zane (Thu Apr 19, 2018 11:54 am)
Rating: 58.82%
 
1 in 10 people understand binary, the other one doesn't !

User avatar
Benj
Matrix Staff
Posts: 13070
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 3782 times
Been thanked: 3626 times
Contact:

Re: RC5 Remote Controlled Clock

Postby Benj » Mon Feb 26, 2018 6:26 pm

Thanks for the post John, looks like a great project to follow along.

I also like you small veroboard / breadboard looks a lot nicer than the boards I've been working with.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1366
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 380 times
Been thanked: 712 times
Contact:

Re: RC5 Remote Controlled Clock

Postby JohnCrow » Mon Feb 26, 2018 8:19 pm

Thanks Ben

Those boards are very useful, I use the 1/4 size a lot as well, although they are a bit expensive compared to veroboard they are very high quality.

http://skpang.co.uk/catalog/adafruit-pe ... -1133.html
These users thanked the author JohnCrow for the post:
Benj (Wed Feb 28, 2018 12:01 pm)
Rating: 5.88%
 
1 in 10 people understand binary, the other one doesn't !

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 994
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 417 times
Been thanked: 471 times
Contact:

Re: RC5 Remote Controlled Clock

Postby Steve001 » Tue Feb 27, 2018 1:39 pm

rapid do them also

https://www.rapidonline.com/adafruit-58 ... -3-73-5324

although not as cheep
These users thanked the author Steve001 for the post (total 2):
JohnCrow (Tue Feb 27, 2018 8:11 pm) • Benj (Wed Feb 28, 2018 12:01 pm)
Rating: 11.76%
 
Success always occurs in private and failure in full view.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1366
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 380 times
Been thanked: 712 times
Contact:

Re: RC5 Remote Controlled Clock

Postby JohnCrow » Tue Feb 27, 2018 8:14 pm

Steve001 wrote:rapid do them also

https://www.rapidonline.com/adafruit-58 ... -3-73-5324

although not as cheep


Ouch :)

I can recommend them though, good quality, and do stand up to a bit of (careful) DE soldering too.
1 in 10 people understand binary, the other one doesn't !

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 994
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 417 times
Been thanked: 471 times
Contact:

Re: RC5 Remote Controlled Clock

Postby Steve001 » Fri Jun 15, 2018 4:34 pm

Hi
found today that Artekit Labs do something similar nice and cheep to they do make some nice breakout boards

https://www.artekit.eu/products/prototyping/artekit-400-point-solderable-breadboard/


Steve
These users thanked the author Steve001 for the post (total 2):
Benj (Fri Jun 15, 2018 4:36 pm) • JohnCrow (Sun Jun 17, 2018 1:02 pm)
Rating: 11.76%
 
Success always occurs in private and failure in full view.