Maker Pro
Maker Pro

Want circuit to return to previous state when turned back on

steveo2110

Apr 9, 2013
4
Joined
Apr 9, 2013
Messages
4
Hey. I wonder if you good guys can help. It's been 10+ years since I did electronics in school so I'm a bit rusty, but I do know the basics of circuits. So I hope you can share your knowledge in solving my problem :)
No need to go into the full workings of my circuit, but just the bit I'm stuck on.

I have an LED which is controlled by push button switch. Using logic gates, the state if the LED remains once the button is released. So, press button and LED turns on. Press button, LED turns off. Press again and comes on etc

Now lets say the LED is on when the power is cut to the circuit. Is there a basic way that the circuit can remember this, so when power to the circuit is restored, the LED comes straight back on and not back to its default setting of off?

Could this be done with a capacitor somehow through an OR gate? So when power is restored, the capacitor flows through the OR gate and then loops back round into the OR gate to keep the LED on? Or is there a simple IC which can store this simple piece of information?

I know the simple option is a toggle switch but that isn't an option here

Hope what I've said makes sense.
Cheers
 

brevor

Apr 9, 2013
87
Joined
Apr 9, 2013
Messages
87
It may be possible by using a battery backup, we would have to see a schematic of your circuit to be sure.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
It may seem like overkill, but a microcontroller could do this and replace all your logic gates as well.

Bob
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
To decide between a capacitor and a battery as the backup power source it would be necessary to know the maximum duration of the power interruption to design for.
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
The simplest way to do this is to use a latching relay as the memory component.
 

steveo2110

Apr 9, 2013
4
Joined
Apr 9, 2013
Messages
4
Thank you for all your replies. I only have a circuit diagram on paper ATM, but will try get in online.

It may seem like overkill, but a microcontroller could do this and replace all your logic gates as well.

Bob

This could solve it and like you say include the logic gates in the circuit. The circuit has two logic gate ICs as it is.

I'll look further into microcontrollers. Anything you recommend reading or to look out for? Especially as I need to be able to save this single piece of information (whether the LED is on/off) when power is cut

Thanks again guys
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
I'll look further into microcontrollers. Anything you recommend reading or to look out for? Especially as I need to be able to save this single piece of information (whether the LED is on/off) when power is cut

Just make sure to choose a micro that has an internal EEPROM (almost all of them now) as the circuit transitions from one to the other simply write the value in the EEPROM... Upon power up simply read the EEPROM and start at that value...
 

steveo2110

Apr 9, 2013
4
Joined
Apr 9, 2013
Messages
4
thank you once again

I've had a look and i think i'm gonna head down this route of microcontroller. Been having a play with PicBasic and i'm able to use it as have a web programming background. Think i've managed to get my head round the read/write EEPROM too.

As this is all a bit new to me, which PIC would suit my needs? I need to have 4 inputs and 7 outputs plus store if one of the inputs was high or low prior to power off.

Will PIC 16F84A-04P be suitable? Use PORTA as inputs and PORTB as outputs

Thanks :)
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Will PIC 16F84A-04P be suitable? Use PORTA as inputs and PORTB as outputs

The PIC16F84a is an antique PIC16F628a (or even newer chip) would be a much better option, if for no other reason then it has a build in oscillator...
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The PIC16F1826, 1827 or 1847 are cheaper and more capable than either the 16F84A or 16F228A. Each new generation adds capabilities and decreases the cost. The 18xx are the latest chips.

Bob
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
As gorgon suggested, a latching relay is the simplest option, if size is not a concern.

These are available from around USD 3~6, in coil voltages of 3V, 5V and higher. Some types have a single coil, which is driven with a positive voltage to latch the relay ON, and a negative voltage to latch it OFF. Other types have two coils; this is simpler to drive. Most of the ones I found at Digikey were two-pole changeover, which may be more than you need.

Here's one with 3V dual coils: http://www.digikey.com/product-detail/en/TX2-L2-3V/TX2-L2-3V-ND/649628 USD 4.58 in 1-up quantities.
 
Top