I didn't know where to put this for sure, but I guess this would be an app option.
I would like to be able to set a countdown timer to control a relay for a select amount of time. For example, I may want to fill a container with RODI water.
Currently I have a solenoid plugged into a relay. I can toggle the relay on and off to fill the container, but it would be much more convenient to be able to set the relay to be on for 30 minutes, or 60 minutes or whatever I like, then automatically shut off.
Has anyone done this? Is it possible? Is is something anyone else is even interested in?
Countdown timer for relay
28 posts
• Page 1 of 3 • 1, 2, 3
|
|
yes this is possible. this is exactly what the feeding mode and water change modes do (well...water change mode is not a timed feature, but functions the same none the less). it will require custom code being added. you will need to set the timer duration, ports to toggle and how you want to activate it. i would suggest looking at the feeding mode function inside the libraries to see how we handle it. what we do is retain the state of the existing relays that get toggled and then when the mode is entered, we turn off all the ports that are specified to be turned off and then leave the others alone. once the mode is exited, we return the ports back to their previous state. i'm assuming that you want to force a specific port (or set of ports) on during the function and then return them to their previous state (or force them off) when the function/countdown finishes. so, let's get you started (i'll help get the questions going and get you started and others will probably chime in as well). First off, we need to know these questions:
Now, once we get this information, we can proceed forward with more of the details. |
|
I have something more specific. I use it for my swabbie. If I turn on the swabbie, it will run for 2 minutes.
Here's the code I use.
Here it is a bit more generic that you can put directly into your loop() function:
Just change Box1_Port2 to whatever port you want to control and then use the repeat and runtime to set how long you want the port to run and how often to repeat. If you don't want it to repeat then just take out the else statement at the end. |
|
Aeesome, i will reply properly when I get back to my computer, don't like typing on the phone!
|
|
I have only one port I want to toggle. I would like to be able to change the countdown. I'd like to control it from the app, not sure what options there are with the app other than toggling the relay. |
|
ok. using lnevo's sample we can make the app start the countdown by turning the port on.
then we can have it read the countdown value from the internal memory. Sent from my Moto X |
|
Any way to get this out to everyone in an update?
Sent from my XT1254 using Tapatalk |
|
well, that would require adding it to the libraries and making it versatile. I know it can be done but I don't know how fast it would get merged. I will see what I can do. Sent from my Moto X |
|
There's already the TimedPort class that can help with this.
|
|
Although I think I discovered a bug with the Repeat part which may inadvertently cause your port to go on when it shouldn't, but not sure. ![]() I had hoped to extend it at some point by having a dosing pump class that would be aware of it's rate and how long it ran for. Curt I'd love if you'd take a look at the class and let me know what you think ![]() |
|
28 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 2 guests