Go Down

Topic: Is there a switch/switched config to turn of VIN and allow user to reset manual (Read 376 times) previous topic - next topic

krisk

I am an old C coder learning and enjoying everything in this open space community.   I have minimal circuit knowledge just enough to release the "Blue Smoke" periodically in my bread board tests.   

So here is my electronic circuit question:
I know I can put my Arduino (micro) to sleep.  (working on the code now).   However, I would like to send a HIGH signal down a pin to a switch and totally shut off power to my entire project.     I want to ultimately save power by shutting down everything from the originating source after 5 minutes of no use.   This would kill power to a 9v to 5v regulator from Pololu and the Arduino.   Basically, have the Arduino commit suicide only to be restarted by the operator cycling the 9v on/off switch.?

I did some tests and even in sleep mode the regulator was chewing up power.  When I used the sleep mode pin on the regulator I found that the Arduino would "Flutter" trying to boot up with very low voltage (not good)

Any suggestions would be helpful.

Thanks
Kris

CrossRoads

Pololu carries a switch that does that.
Press a button to wake things up, the micro has to keep it alive, and when its done (5 minutes) it allows the switch to shut things down.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

fungus

Quote

I would like to send a HIGH signal down a pin to a switch and totally shut off power to my entire project.


It might have to be a LOW signal... :(

Use a MOSFET with a pull down resistor on the gate. The Arduino can put out a HIGH signal to keep itself alive then turn it LOW when it's finished.

To power it on you'll need to apply a HIGH signal to the gate until the Arduino can take over. You could add a button to the device which pulls the gate HIGH while you hold it down. This saves you from having to toggle the power switch.

The only problem is the default bootloader which will take a few seconds to start up (or maybe this would be a safety feature, I don't know...).

You can fix this by:
a) Using optiboot (the bootloader only waits three seconds after a reset, not after a power-on)
b) Remove the bootloader altogether (use an ISP programmer to program the board).

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

CrossRoads

Other way around - use P-channel MOSFET as high side switch with pullup on the gate to  hold it off.
Press a button to pull the gate low & turn on the power, Arduino comes alive & holds it low to keep power available. When done, release the gate & MOSFET gets turned off, power goes away.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

krisk

Thanks for the suggestions.   I had missed the Pololu switch. I went back and reread their switches and found the one you described CrossRoads

I will spend some more time researching the MOSFET and Gate idea as well (thanks fungus).   I need to learn more on the electronics side of the arduino as I am very much a rooooookkkeeeeeee.   

I somewhat have the code working as described by CrossRoads.  The Arduino comes alive and sends a power on a pin to turn on a digital counter in the setup as well as power to a reset switch.   Also my next iteration was to spend time looking at boot loading process.

Again thanks for the help.   I am sure I will ask again for more help
Kris.


krisk

New question for this post.   Since I already have an ON/OFF switch on my 9Volt battery.     I don't see a down side in simply having the Arduino
                        sleep_enable();
                        set_sleep_mode(SLEEP_MODE_PWR_DOWN);
                        sleep_cpu();

I want to reduce as much power consumption as I can.   I tested this and it did exactly what I expected.   It put the chip asleep and it wouldn't do anything else until reset by cycling the power switch.    This seams tooooo simple but it will work for this hand controller I am building.  The button will be handy because it comes with the 9v battery holder.

Surely cycling power doesn't hurt the Arduino.   Long term I plan on moving to an Astar Micro.  It has less pins but I don't need them anyway.

What am I doing wrong with this thought.   (PS... I woke up at 3:00 am thinking about this solution...  this is way tooo much fun)

Kris

wes000000

The problem with your solution is some current will still flow.

Quote
Other way around - use P-channel MOSFET as high side switch with pullup on the gate to  hold it off.
Press a button to pull the gate low & turn on the power, Arduino comes alive & holds it low to keep power available. When done, release the gate & MOSFET gets turned off, power goes away.


I recommend this as it will completely kill power and disconnect battery. It is not too complicated and would be a good place to start learning about the electronics more.
"I have not failed. I've just found 10,000 ways that won't work." - Thomas A. Edison

CrossRoads

You can put the Arduino into sleep mode, that can cut the uC power draw down.
Doesn't do anything for:
the 5V regulator
the 3.3V regulator
the USB/Serial chip
the LM358 comparator
the power on LED
any IO that might be sourcing current off board

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Palatis

I dunno, simply put the uC to SLEEP_MODE_PWR_DOWN will make it sourcing only 0.1uA (@1.8v), if you give it 5v it will be like 0.2 ~ 0.3uA...
looking at atmega328 datasheet, Figure 31-105, "Power-down Supply Current".

I don't see a point to make a external circuit just to save the 0.2uA at the expense of maybe 0.05 ~ 0.1uA...

you can use a MOSFET to cut the power of other parts of the system (like motor or led) off before you sleep.

something like this, set D0 and D9 to LOW before you enter sleep.
you can even set them to INPUT LOW.

and the button, connect to D2 or D3 and trigger a LOW interrupt.
pinMode(2, INPUT_PULLUP);
attachInterrupt(buttonInterrupt, LOW);
sleep_enable();
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_mode();
sleep_disable(); // this should be placed inside the ISR, but I found no difference anyway......

Go Up