I wanted to do something with my Relay Trainer which could run for an extended period of time, but not burn out the life of the relays. To this end, I created a clock which updates once per minute based on a simple circuit (clock_timer.jpg) which uses some CMOS parts (running at 12v) to create a 1/120Hz square wave driving the In0 input.
The code displays the hours:minutes in the right four digits of the bigger display and also outputs the time on the serial console. Once running, the minutes can be advanced by closing the In1 input and the hours can be advanced by closing the In2 input. I find it is easiest to set the time if the clock is started near the start of an hour as each advancement takes about 10 seconds.
The first version of the code (clock.asm) used the example code divide function to convert hexidecimal time into BCD displayed numbers. Because this took a significate amount of cycles, I created a second version of the code (clock2.asm) which uses a lookup table for conversion to BCD.
The attached files include the circuit diagram and both versions of the code.
You can of course experiment with the code without the timer circuit by momentarily connecting the In0, In1 or In2 input to ground.
While cool, I dont understand the assertion about relay life being improved as the stare would change every minute.
I get that their is additial ware every time you actuate the realy. However this computer stores some state information in the relays too. So arent you also continuously powering some of the coils at all time also causing ware (albeit less)?
lastly wouldnt the computer have to perfom cycles to detect thr pulse from the minute clock?
just trying to see what i am missing...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The computer primarily waits on the inwait instruction for a minute to pass and then does enough calculations to update the time. The inwait hold is managed in the PIC micro controller and so no relay sequencing is performed during the wait. Generally relay wear is based on contact cycles, not on time, but I guess time would tell.
Load the program (clock2.asm) and try it out...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i have been meaning to learn how to use software such as Eagle to design a PCB. This provides a good test case, ill try it and post the gurbers (assuming i dont screw it ip :-) )
Last edit: Jim Bailey 2020-02-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Awesome. I would recommend making it so that a set of wires leading from the PCB line up with the In0, In1, In2 (adding push buttons for the setting of time) as well as GND and +12v :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wanted to do something with my Relay Trainer which could run for an extended period of time, but not burn out the life of the relays. To this end, I created a clock which updates once per minute based on a simple circuit (clock_timer.jpg) which uses some CMOS parts (running at 12v) to create a 1/120Hz square wave driving the In0 input.
The code displays the hours:minutes in the right four digits of the bigger display and also outputs the time on the serial console. Once running, the minutes can be advanced by closing the In1 input and the hours can be advanced by closing the In2 input. I find it is easiest to set the time if the clock is started near the start of an hour as each advancement takes about 10 seconds.
The first version of the code (clock.asm) used the example code divide function to convert hexidecimal time into BCD displayed numbers. Because this took a significate amount of cycles, I created a second version of the code (clock2.asm) which uses a lookup table for conversion to BCD.
The attached files include the circuit diagram and both versions of the code.
You can of course experiment with the code without the timer circuit by momentarily connecting the In0, In1 or In2 input to ground.
Last edit: Tom Uban 2020-02-07
While cool, I dont understand the assertion about relay life being improved as the stare would change every minute.
I get that their is additial ware every time you actuate the realy. However this computer stores some state information in the relays too. So arent you also continuously powering some of the coils at all time also causing ware (albeit less)?
lastly wouldnt the computer have to perfom cycles to detect thr pulse from the minute clock?
just trying to see what i am missing...
The computer primarily waits on the inwait instruction for a minute to pass and then does enough calculations to update the time. The inwait hold is managed in the PIC micro controller and so no relay sequencing is performed during the wait. Generally relay wear is based on contact cycles, not on time, but I guess time would tell.
Load the program (clock2.asm) and try it out...
i have been meaning to learn how to use software such as Eagle to design a PCB. This provides a good test case, ill try it and post the gurbers (assuming i dont screw it ip :-) )
Last edit: Jim Bailey 2020-02-12
Awesome. I would recommend making it so that a set of wires leading from the PCB line up with the In0, In1, In2 (adding push buttons for the setting of time) as well as GND and +12v :)