Latching circuit using arduino

HI
i want to make a latching circuit that turn on or off using 1 gpio pin of arduino only .
i dont want to use a push button,
the load would be an led . there is no issue of power.

Basic idea is i want to turn on the LED and shut the MCU down without turning off the led.

how can i approach this without using a external push button and using only 1 gpio of arduino

I'm trying my best to get my head round that, but not winning.

You want to have an led controlled by an Arduino, but the led stays on when the Arduino is off?

sayHovis:
You want to have an led controlled by an Arduino, but the led stays on when the Arduino is off?

yes.

and i want to turn off that led using the same arduino gpio .

it is like a d flip flop .

How about Arduino could switch an scr with sw1 and sw2 as n/o and n/c relays respectively, controlled by the Arduino?

Light goes on when Arduino closes sw1. Light stays on regardless of sw1, until Arduino (which could have been turned off meantime) opens sw2.

(image source)

Has to be an easier way :wink:

sayHovis:
Light goes on when Arduino closes sw1. Light stays on regardless of sw1, until Arduino (which could have been turned off meantime) opens sw2.

Has to be an easier way :wink:

What will you use as sw1 or sw2 keep in mind that i only want to use 1 GPIO .

and remeber no hard push button .

manveen_singh:
keep in mind that i only want to use 1 GPIO .

I had forgotten that...

Why the restrictions?- class assignment?

sayHovis:
I had forgotten that...

Why the restrictions?- class assignment?

A challenge.

You could toggle a flip-flop (divide by 2
counter): 1st pulse = Q goes HIGH, LED on,
2nd pulse = Q goes LOW, LED off.
Herb

Why not get an RTC and use this code but change the led code (change ON to OFF and vice versa),
Change line 31 to ON and change line 35 to OFF.

Controlling LED with Arduino sleep using RTC

I think D FF as f/2 is a good option than rtc as it uses less number of pins and cheaper. the only con i can think of right now is that it uses more current than the rtc.

i want to make a latching circuit that turn on or off using 1 gpio pin of arduino only .
i dont want to use a push button,
the load would be an led . there is no issue of power.

Basic idea is i want to turn on the LED and shut the MCU down without turning off the led.

I don't know why you are even posting about this.
Just turn the led on and go to sleep.
You post doesn't say anything about waking up.
What's the problem ?
A. I don't know how to turn on a led.
B. I don't know how to go to sleep.

manveen_singh:
I think D FF as f/2 is a good option than RTC as it uses less number of pins and cheaper. the only con i can think of right now is that it uses more current than the RTC.

Really? 80µA maximum?

Versus 300 µA for the DS3231.

manveen_singh:
Basic idea is i want to turn on the LED and shut the MCU down without turning off the led.

What does a latch have to do with this?

dougp:
What does a latch have to do with this?

Depends rather on what "shut the MCU down" means! :astonished:

dougp:
What does a latch have to do with this?

basic idea is that i want to

turn on the LED using the mcu .
then power down the mCU / make the mcu go to sleep / shut down each peripheral of the mcu .
Without turning OFF the LED . (led should remain on even if the mcu is sleeping /off / without any power ).

the challenge is the whole system should only use 1 gpio to turn on the led .
just assume all other gpio /i2c/spi pins are broken .

Paul__B:
Really? 80µA maximum?

Versus 300 µA for the DS3231.

ok ya forgot about that .

so as of now FF is the best option .

Paul__B:
Depends rather on what "shut the MCU down" means! :astonished:

what would be your definition of "shut MCU down "?

disclaimer: Not an EE.

Opto shut off, Q1 biased on, LED lit.

arduino power off indicator.PNG

arduino power off indicator.PNG

dougp:
disclaimer: Not an EE.

Opto shut off, Q1 biased on, LED lit.

arduino power off indicator.PNG

wouldn't this ckt make that LED always on ?

my point :
Step 1 : Before the MCU is turned on 1 : as base of q1 is pulled high it is always on ,

Step 2 : the only way to turn off the led is to give a HIGH pulse from the MCU pin .
this way the optocoupler turns on and base is shorted to GND , turning off the LED .

Step 3 : but when MCU goes to sleep the Gpio is not HIGH any more , it is LOW , thus Optocoupler is off.and the base gets VCC thru the R and and LED gets turned on .

As per my original Question .
I have to turn ON led led with MCU . THis means that LED is in OFF state before . LED is in OFF state originally .

THis ckt is like a NC contact of the relay.

Is this a class assignment ?