Hi
I have been trying to find a flip-flop toggle circuit to a relay for a while now, and trying to learn some digital stuff as well. I have come across for an example CD4013 which seems to be good to make a toggle circuit with.
What I need is a relay that keeps its state even if I reset the arduino board. I also want only one pin per relay from the arduino, so a toggle circuit seems to be a good solution. I probably could use a latching 1-coil relay, but then I need a "toggle-change-polarity"-circuit I guess? I couldnt find a circuit like that, and I dont know how to create one (yet)
Since this relay is for a HID light, photoresistors will sense if light is on and I will know the state of the toggle circuit if there is light falling on the photoresistors. But it would be good to have a circuit that combines the knowledge of if mains power is on and if light exists.
Instead of using CD4013 I found this curcuit
It was found here
under "bistable flip flop"
I dont really understand that circuit, but if its working the way I want, I´m happy
there is probably a lot more solutions out there, but what do you think, is this a feasible solution?
It is not quite clear what you want to do or why.
Yes the bi-stable flip flop will change the state of the relay with each button push.
However what has this got to do with an arduino?
The same functionality can be achieved with an arduino sketch using one input for the push button and one output for the relay. With no need for the bi-stable.
ok, what i would like to achieve with this circuit and the arduino board is:
a timer. i am going to program the timer via serial.
2a. protective functionality. If a HID bulb breaks, arduino will sense that via the photoresistor, and turn the relay off that drives the light.
2b. If a power out occurs, the light will go out, but it cannot be turned on again until 20 minutes has passed and the bulb has cooled off. Arduino will turn off the relay and will not power the light on again until 20 minutes has passed after power is on again.
as i said in my former post, i dont want to have a "conventional" relay circuit, because if you reset the arduino board, it will switch the relay off for a short while, and I dont want that, because then i have to wait 20 minutes before i can turn it on again.
So i want the arduino to set the pin to HIGH for a short while, and the toggle circuit is on, and then i set the pin to HIGH again, and the circuit is off.
Is the arduino running on some sort of power supply that is immune to power outage?
yepp, its going to run from a lead-acid battery, which will be charged all the time (well, not when theres a power out )
Is the relay running from a power source independent of the arduino's power?
the relay is a 12V relay, running from the same 12V as mentioned above.
That bi-stable is not going to give you a 20 minute delay.
I´m not sure what you mean.. the arduino is going to count that 20 minutes, and when they passed, it will try to light it again, if the mains power is on of course.
the arduino is going to count that 20 minutes, and when they passed, it will try to light it again,
So you don't need anything else to latch the relay.
Wire it up so that it turns on with a high and pull up the output high. That way you won't get the relay dropping out when the arduino is reset.
hmm, sorry about my ignorance, but what do you mean by "pull up the output high"?
But if it is what I think it is, you mean that the relay is on by default by a pull up resistor, and then I use Arduino to actively turn it off?