i am using emontxshield to monitor usage of electricity but i want to add a relay shield on top of it has any one done the similar job before, i dont know how to edit the code
relay
Submitted by Guest on Mon, 21/10/2013 - 10:59»
Archived Forum |
|
relaySubmitted by Guest on Mon, 21/10/2013 - 10:59i am using emontxshield to monitor usage of electricity but i want to add a relay shield on top of it has any one done the similar job before, i dont know how to edit the code » |
Re: relay
What do you want to use the relay for?
Re: relay
for providng the safety for the circuit, for example , if there is current exceeds 5A then the relay cuts the circuit and resume in 5 seconds something like that
Re: relay
OK, that sounds fairly straightforward. When you activate the relay, you'll need to record the time, e.g.
if (<the operate criteria for your relay>) {
<activate the relay>
static unsigned long relayActivatedAt = millis(); }
You'll also need to include a release block in loop(), e.g.
if (millis() > (relayActivatedAt + 5000)) {
<release the relay> }
Disclaimer: Please note that the above code fragments are simply to show how you can implement what you have asked for. I am not saying that this is a good way to deal with circuits that draw too much current!
Re: relay
... And please note that unless you use a shield with opto isolated circuitry then you really don't want to have 5A of ac running near your arduino circuitry ... And if the load you're measuring is not resistive in nature (incandescent bulbs) then you really really don't want to drive that circuit with a relay on the shield ....