Hi there,
I'm building a robot and I'd like it to have good control and management of its battery and power in general. What I want is for an ATMega328 just like you find on an Arduino Uno to be able to stay on all the time and have it control the power to the rest of the robot.
I imagine having a switch, which when flipped / pushed will wake the 328 from a low-power 'sleep'. The switch connects to a 328 input pin and does not power on things manually. The 328 will then control powering the Pi onboard the robot. When I flip the switch to turn the robot off, the 328 will send a signal to the Pi and then cut all power to the Pi once the Pi has shut down safely. The 328 wil then re-enter the low-power 'sleep'.
I'm not sure how to go about this though. Should I use a relay? I would prefer a transistor type situation but I don't know if that would be possible...
Thank you.
Powering theRPi.
It is entirely black magic. This should be easy for anyone who can read Welsch.
Assuming you are wanting a more humanish approach try looking up what is commonly known as a “high side switch”… You will need to know the voltage available from the battery, the voltage needed by the RPi, and the current required. Or you can add a relay.
Have you looked into making the RPi be the master and entering a low power mode?
Use a high side switch?
So it sounds like I ought to get a high side switch? The Pi draws ~250mAh maximum, 5V.
I have another question now though as well. Can I power a 328 chip from a varying power source? Between ~3.5V to 5V? So at any point the volatage may change (The 328 would know when this is going to happen) but not mess up the program. Will this work? I think the only problem will be the clock frequency…
High side switch
Take a look at the LTC1154 high side switch data sheet. You will find that there are typically 2 major components, the power transistor and the switching transistor. The complexity is that the power transistor sits between the power source and the load. No ground involved. It is not undoable, just requires a little extra circuitry. You may be able to accomplish the same with an h-bridge but I expect the power losses to be much higher.
You probably should find someone more skilled in this arena than me!!!