I'm a completely newb, so please execute my ignorance.
I'm busy with a project that must run off batteries, so it needs to be ultra-low power. I've read tons of tutorials on how to get battery usage down (sleep mode, watchdog timers, etc), but no point in sleeping the Arduino if anything connected to 5V pin is still running - those peripherals will suck the battery dry very quickly.
I'm using a Sharp IR distance sesnsor (2Y0A02) and connecting it to 5V + GRD works fine. Connecting to PIN13 does not - its readings are bogus. I assume this is due to the digital pins not providing enough power to sensor to operate.
Thus:
Any way to disable 5V pins during sleep mode?
Is there something available (some component/chip/dynamic gate) that I can turn on with a digitalWrite(HIGH), which in turn will complete the 5v circuit and start up the IR sensor. Once going into sleep the digital pin is set to LOW, the gate closes and the 5V circuit is broken - ie no power consumed??
If all else fails - any IR distance sensor out there (must have range at least 50-80cm) that CAN run of digital pins (eg 13) and not 5v.
Will eventually (hopefully) be a Teensy 2.0 or even just an ATMega328 - when I strip everything off.
Apologies for not knowing about the mosfet - I knew there must be something but had no idea what to search for in the forums - didn't even know where to start. tried "power", "switch" etc but got back TONS of other stuff.
So that's the way to go; a p-channel mosfet? Thanks - I'll research some more. Appreciate it!
Is there something available (some component/chip/dynamic gate) that I can turn on with a digitalWrite(HIGH), which in turn will complete the 5v circuit and start up the IR sensor. Once going into sleep the digital pin is set to LOW, the gate closes and the 5V circuit is broken - ie no power consumed??
If the sensor requires < 20mA of current, I might power it directly from a microcontroller pin, but pin 13 on an Uno is a poor choice because it has the LED connected. Try another pin. When sleeping, don't drive it low, change it to an input. This will present a high impedance which won't source or sink current. But an Uno is a poor choice for a low-power application as you have no doubt read elsewhere on the forum.