Software-switchable 5V DC power outlet

Started by bertpeeters, October 10, 2013, 10:20:24 PM

Previous topic - Next topic

bertpeeters

Hi guys,

I'm using my A20 board in a project together with another device that requires 5V DC power (appr. 310 mA). I am writing an Android app that controls this device. Now I want to be able to switch the power to the external device on and off from within the software.
I was hoping I could use one of the USB Host ports to feed power to the device. The max current from the USB Host is 523 mA, so that should be OK. Is it possible to switch the 5V power from the USB Host port on and off? Any code suggestions?
Or could you think of another way to power the device from the A20 and make it switchable?

blejku

The simplest and probably the best solution that will control power via GPIO port and amplifier. (Just at the beginning of one transistor)

Lurch

Take a look at how they did the 5 volt power switching for SATA on the A20 board.
Or, if you're not using SATA, use that connector.

bertpeeters

Thanks for the suggestions.
I could use the SATA power connector, it seems to be on/off-switchable.
The Wiki page for the A20 says that SATA is not supported in the Android image, however. Could I still switch the SATA power?

Lurch

#4
To use that power source, you would only have to control GPIO PB8.  I haven't tried it in Android, but I'm guessing that the Android App ( http://olimex.wordpress.com/2013/10/02/a20-olinuxino-tools-for-android-released/ ) for working with GPIO would do that.  Download the App and try flipping the PB8 pin.

<edit: link corrected>

bertpeeters

Thanks for your excellent suggestion. I hadn't noticed that the SATA 5V pin was shared with the GPIO PB8. I tried flipping the PB8 using the Android tools app and indeed it switches the SATA power on and off. Unfortunately, the A20 shuts down immediately after I switch on the power to the external device. I guess the power consumption (or the startup peak) of the external device is too high for the SATA output.

I tried powering the device from the USB host port and it works okay. I'm going to put a relay in between so I can switch it from one of the GPIO pins. If that doesn't work, I could always use an external 5V power source and a relay.

Thanks again for the help!

Lurch

#6
Thanks for reporting back. At least we know it works with the App.
If you are using 12V @1-2A power, then I would think that SATA power would be at least 500mA (i.e. for a 2.5" drive).  Do you know the current draw of your device connected to SATA jack?  Would be good to know what load it can support.
Again, thanks for sharing.

<edit: are you using 4.2.2 Android image?  I get "Unfortunately, A20-TOOLS has stopped" when I start the App from Olimex. Doesn't seem to work for me>

bertpeeters

Just wanted to let you know that this works now. I can feed the external device from one of the USB host ports. I have used a relay to switch the power on/off. I toggle the relay by switching the SATA power on or off (using the GPIO PB8 pin, GPIO-3:16).

I vaguely recall seeing the "A20-TOOLS has stopped" error. I believe the solution was to install or update SuperSU.