Real time clock correction with Propeller.
garyg
Posts: 420
Hi
I'm starting to shut down my hydroponic garden for the year.
Before the next season, I'll be needing to set up a new timer system.
I'm planning to use a real time clock program from OBEX, but am concerned about
a system reset upon power failure.
I'm looking at the real time clock from Sparkfun, but don't know how I can integrate this into my system.
My thought is this:
Use one of the real time clock programs from OBEX.
Use Sparkfun real time clock to initialize the Propeller OBEX real time clock program.
On startup, the Propeller will get an accurate time, to approx. 1 minute from the true real time clock.
The system floods aprox 16 times per day.
I think I should be able to use the Prop to do this, but am concerned that if a power outage happens, that
I will lose my timing and thus my hydroponic plants.
The hydroponic plants need to be water cycled every hour or so no matter what, during the time of day when the
sun is in the sky.
I already have a redundant pumping system that uses even/odd hours to cycle in case of failure.
I'm currently using programmable timers available at home depot, but would like to up my game.
Any suggestions on how to set up a real time clock system that does not fail would be appreciated.
Thanks
Garyg
I'm starting to shut down my hydroponic garden for the year.
Before the next season, I'll be needing to set up a new timer system.
I'm planning to use a real time clock program from OBEX, but am concerned about
a system reset upon power failure.
I'm looking at the real time clock from Sparkfun, but don't know how I can integrate this into my system.
My thought is this:
Use one of the real time clock programs from OBEX.
Use Sparkfun real time clock to initialize the Propeller OBEX real time clock program.
On startup, the Propeller will get an accurate time, to approx. 1 minute from the true real time clock.
The system floods aprox 16 times per day.
I think I should be able to use the Prop to do this, but am concerned that if a power outage happens, that
I will lose my timing and thus my hydroponic plants.
The hydroponic plants need to be water cycled every hour or so no matter what, during the time of day when the
sun is in the sky.
I already have a redundant pumping system that uses even/odd hours to cycle in case of failure.
I'm currently using programmable timers available at home depot, but would like to up my game.
Any suggestions on how to set up a real time clock system that does not fail would be appreciated.
Thanks
Garyg
Comments
That's a big ask. Generally, if you want more reliability, remove complexity.
A HEF4541 or HEF4521 + Photocell would do most of what you need, and could even include 'Sun Strength' compensation of the repeat times. Saves water on cooler or cloudy days.
If the water cycling is that critical shouldn't the whole system have battery backup?
If that is not good enough for you, you might consider a connection to the internet that updates the RTC from the internet.
On the other hand, if the Propeller has a battery powered backup, you can have the RTC in software.... as long as the Propeller doesn't reset for some reason. If it resets, it needs some reference to get the correct time.
Does anything bad happen if you water the plants too often? I.e. just initiate a watering cycle after power comes back up and shift the whole, once per hour, schedule. This doesn't help with power outages longer than an hour though, you'd need battery backup for those.
Marty
If the Propeller itself has a backup power supply, it could sense a mains failure and actually keep track of when power was down, for how long, and when power was restored.
If the water pumping is mains dependent, the software could compensate with this data.
+++++
I have a Propeller here running on a very simple power backup setup.
If you take a 12 volt gel cell as your backup battery, a 13.5Volt, 1 amp wall wart is adequate to trickle charge the gel cell. You just have to include a 1 amp or higher diode as a block diode so that a Mains power failure does have the wall wart discharge the battery.
Then just connect the + and - of the gel cell to the Propeller or if you want the Propeller to run cooler, insert a 9 volt linear regulator between the Propeller and the 12 volt battery.
The gel cell will at first be topped off, and after that it will trickle charge from the Mains indefinitely. If Mains power goes off, the Propeller will not notice.
If you want the Propeller to be aware that power is down, you have to set up an I/O pin to monitor the Mains power. That can be done with an opto-isolator which has the LED side driven by the Mains (through a current limiting resistor).
I suppose this would also offer some transient protection from lightning strikes as well. But I suspect that lightning might just blow out the wallwart and not affect anything wired past that.
I think that for starters, I'll be attempting to set up JonnyMac's suggestions.
While I've never used a DS1337, It looks like a pretty straight forward solution to
what i need to do.
I also think that I'll be attempting Loopy's battery backup strategy.
I'll keep you all informed of my progress.
Alarms can be handled cleaner and faster by eliminating all the synchonous serial exchanges.
I have the gel cell and the Propeller board in a 4 quart refrigerator food storage box with that has a good sealed lid. This was intended to be used outdoors and remotely. So far, I have had it running for a month or so by my bed to make sure it runs cool and the interfaces work.
Maybe soon, it will morph into a weather station on my roof with RS422 serial to my room. The battery is running cool and the unit has stayed in operation 24/7.
For my own personal RTC, I am working with Forth and Unix Epoch Time. Unix Epoch Time runs on a one second tick and is very easy to set up and to manage multiple alarms. I am not finished with my Forth code for it, but have been considering an Application Note when it is working.
It is really a great mix. The Forth allows an intereactive monitoring and over-ride, and a RTC with multiple alarms has all sorts of interesting possiblities. Add in the RS-422 and you have it all being handled from a remote terminal.
The route JonnyMac suggested is a good way to go for this, and using a Propeller gives you a lot of flexibility to add to or modify the control system.
You may want to take a look at latching solenoids for controlling water flow to the hydroponics. They draw no power in the on or off state, only to switch between the two states. A pair of “C cell” sized lithium batteries can switch a sink faucet on/off for several months in a public washroom, so a 6V 7AH battery should be able to power the propeller board and several solenoids for weeks or possibly months.
If the water is supplied from a water main the solenoids can be connected between the main and the hydroponics. If the water is pumped from a reservoir you could place a storage tank high enough to provide a gravity feed to the hydroponics and fill the storage tank when AC power is available.
At first I thought the one input wire units were best suited for the Propeller as you use less pins. But the simple truth is that you don't know which state you are driving the relay to unless you construct a feedback setup that requires a second pin.
So the two pin relays may be the simplest. You always know which state your are driving the coil to by your choice of pin.
If one pin units are all you have, opto-isolators can confirm on and off conditions for you.
If you are worried that all these i/o pins are going to be more than what the Propeller provides, you can use a latched shift register to create more. After all, the timing for this is not down to micro-seconds.
Latching relays are a bit more expensive, but they conserve power and have several other handy features (they stay on even when there is a power failure, so there state doesn't have to be reintialized). Of course, you might want a few conventional relays in key positions as they do shut down in a power outage. You wouldn't likly want a water valve to remain open in a power outage of unknown duration, would you.
Lots of pros and cons.
Thanks for your comments, suggestions concerning latching relays.
I will be looking at both the One pin types and the Two pin types.
Years ago, I had experience with the Two Pin types.
They seem simpler to use even if they take and extra pin to control them.
With this project, my current thought is that in addition to the real time clock, I may want to use a backup
system of some type of photo cell to detect when it's getting light outside in the morning.
A day/night detector would maybe be useful if I can figure out how to implement it.
The two input pin solenoids are simpler to use. With the common connected to V+ one input turns it on and the other one turns it off. A serial to parallel driver chip like the TPIC6595 could be used to control 4 solenoids.
A day/night detector could be as simple as a phototransistor and resistor connected to a propeller pin.