barthawk
Posts: 8
Joined: Sat Aug 10, 2013 1:12 am

Turn off Raspberry Pi Zero USB/Wifi

Thu Jan 28, 2016 6:31 pm

I'm using a Raspberry PI Zero in an underwater container with a BerryIMU to log acceleration data. The system will come up topside every couple of hours and I want to upload the data wirelessly to avoid having to open up the container. However, if I leave the wireless on all the time, the battery I need becomes to heavy. What I would like to do is to power down the USB and then turn it on every 5-10 minutes, see if can connect to the topside access point and if not power down.

If I just use "ifdown wlan0" that doesn't seem to affect the current draw. If I unplug the USB WiFi dongle, the current draw drops significantly. Is there a way to turn the power off to the USB port on the Zero? I have seen some posts on doing it for the Pi 2 and others, but from what I read the Zero doesn't have a USB hub so I'm not sure those approaches will work.

Alternatively, if there is a way to completely turn off the wifi dongle so it doesn't draw power and then turn it back on?

Thanks in advance for any tips.

Bart

User avatar
rpdom
Posts: 15022
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Turn off Raspberry Pi Zero USB/Wifi

Thu Jan 28, 2016 7:05 pm

No, you can't turn the power off on the Zero's USB port, it's directly linked to the input 5V supply.

Can you turn the interface tx power off using iwconfig? That should save a fair bit.

barthawk
Posts: 8
Joined: Sat Aug 10, 2013 1:12 am

Re: Turn off Raspberry Pi Zero USB/Wifi

Thu Jan 28, 2016 7:28 pm

rpdom wrote:Can you turn the interface tx power off using iwconfig? That should save a fair bit.
Thanks! That worked pretty well. Dropped the current from 0.19 A to .10 A at idle. That should be plenty.

Bart

mattmiller
Posts: 2102
Joined: Thu Feb 05, 2015 11:25 pm

Re: Turn off Raspberry Pi Zero USB/Wifi

Thu Jan 28, 2016 9:41 pm

Thanks! That worked pretty well. Dropped the current from 0.19 A to .10 A at idle.
what did you do with iwconfig to achieve it?
Matthew

barthawk
Posts: 8
Joined: Sat Aug 10, 2013 1:12 am

Re: Turn off Raspberry Pi Zero USB/Wifi

Thu Jan 28, 2016 11:57 pm

Code: Select all

iwconfig wlan0 txpower off
You can turn it back on with

Code: Select all

iwconfig wlan0 txpower auto

mikerr
Posts: 2774
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 12:07 am

The following will completely turn off usb for 10 seconds,
then turn it back on again:

Code: Select all

echo 0 | sudo tee /sys/devices/platform/soc/20980000.usb/buspower >/dev/null
sleep 10
echo 1 | sudo tee /sys/devices/platform/soc/20980000.usb/buspower >/dev/null
(Run it in a script as you'll lock yourself out of WiFi until reboot if you just run the first command)

With that I can get usage down to 69ma
Android app - Raspi Card Imager - download and image SD cards - No PC required !

barthawk
Posts: 8
Joined: Sat Aug 10, 2013 1:12 am

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 1:02 am

mikerr wrote:The following will completely turn off usb for 10 seconds,
then turn it back on again:

Code: Select all

echo 0 | sudo tee /sys/devices/platform/soc/20980000.usb/buspower >/dev/null
sleep 10
echo 1 | sudo tee /sys/devices/platform/soc/20980000.usb/buspower >/dev/null
(Run it in a script as you'll lock yourself out of WiFi until reboot if you just run the first command)

With that I can get usage down to 69ma
Thanks - That works for me as well. My current meter only offers 10 ma resolution, so it shows 0.07 A.

I'm also turning off the HDMI by doing this:

Code: Select all

/usr/bin/tvservice -o
Are you doing anything else to conserve power?

Mithrandir
Posts: 16
Joined: Sat Jan 09, 2016 4:44 pm
Location: Poole, Dorset

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 1:49 pm

just a thought, how about cutting the 5v power line to the usb devices and feeding it from a solid state relay, driven by a gpio line. gpio pin high, power fed from 5v line to usb devices, gpio line low, device stops conducting, no power to usb devices. will give you a slight increase in current in the on state, but a massive saving in the off state.

barthawk
Posts: 8
Joined: Sat Aug 10, 2013 1:12 am

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 6:18 pm

I think the suggestion from mikerr is good enough for my needs. It appears that is has the same effect on the current draw as unplugging the wifi module from USB. From what I gather it puts the USB to sleep in a very low power state. Do you think there would be additional power savings by cutting the power lines to the USB?

mikerr
Posts: 2774
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 6:38 pm

You can also turn off the power/act led, but it doesn't save much at all - maybe 2ma
- and might cause you to think the Zero is off when it is still powered up.

Code: Select all

echo none | sudo tee /sys/class/leds/led0/trigger
echo 1 | sudo tee /sys/class/leds/led0/brightness
powering the pi from 3.3v also saves power, and most wifi dongles are still happy running at 3.3v
Android app - Raspi Card Imager - download and image SD cards - No PC required !

barthawk
Posts: 8
Joined: Sat Aug 10, 2013 1:12 am

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 6:58 pm

Thanks Mikerr. My experience, which sounds similar to yours, is that when trying to troubleshoot problems is that an LED indicator can save a lot of time. So, I think I will pay the 2 ma penalty ;)

mattmiller
Posts: 2102
Joined: Thu Feb 05, 2015 11:25 pm

Re: Turn off Raspberry Pi Zero USB/Wifi

Fri Jan 29, 2016 9:50 pm

powering the pi from 3.3v also saves power, and most wifi dongles are still happy running at 3.3v
How do you do that?

Return to “Advanced users”