User avatar
manawyrm
Posts: 34
Joined: Mon Apr 15, 2013 6:18 am
Location: Alfeld (Leine), Germany
Contact: Website Twitter YouTube

[Zero W] Minimal current draw/boot times

Mon May 27, 2019 9:10 am

Hi,

I'm building a Raspberry Pi Zero W based off-grid WiFi camera setup.
This camera will take a picture every 5 minutes with a RPi camera and send it over WiFi.

Power is controlled by an external ATtiny85 and the Raspberry Pi only needs to signal when it's done with it's work.
I've worked quite a lot at optimizing the OS (ArchLinux ARM in this case) to get the optimal performance.

Speed is key here: Every second where the Pi is running costs energy from the battery or capacitor bank.
I'm currently at 13 seconds, from USB Powerup to USB Powerdown, which is already really good, but maybe it can be optimized even further. At the current speed, every photo uses ~11Ws of energy.

My current setup looks like this:

cmdline.txt:

Code: Select all

quiet
root=/dev/mmcblk0p2
ro
rootwait
console=tty1
console=ttyAMA0,115200
selinux=0
plymouth.enable=0
dwc_otg.lpm_enable=0
elevator=noop
audit=0
init=/init.sh
raid=noautodetect
fastboot
config.txt:

Code: Select all

gpu_mem=128
start_file=start_x.elf
fixup_file=fixup_x.dat
disable_camera_led=1

dtoverlay=pi3-disable-bt
dtparam=audio=off
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on

disable_splash=1
boot_delay=0

#force_turbo=1
#dtoverlay=sdtweak,overclock_50=100
My init-script replaces the systemd-init, directly disables HDMI, mounts some partitions and runs wpa_supplicant to the WiFi up and running. raspistill and curl are run in parallel to this process and don't take much more time (about 5 seconds).

Currently, about 3-4 seconds are spent before the kernel is run. I'm not sure how much of this is down to the kernel itself, and how long the Raspberry Pi GPU init/bootloader stuff takes.

I'm still running the stock ArchLinux ARM kernel here, I should probably compile my own (much more lightweight) kernel. Any recommendations on which features take especially long?
The zImage is currently compressed as gzip, which should be pretty fast, right?

Any ideas on (either) getting the time down, or reducing the current draw of the RPi are welcome.
USB, bluetooth, HDMI aren't needed. Only WiFi and the CSI camera.

Thanks,
Tobias

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: [Zero W] Minimal current draw/boot times

Mon May 27, 2019 10:27 am

You can get some information on boot times from systemd.

systemd-analyze
- gives basic boot times

systemd-analyze critical-chain
- gives times for the targets

systemd-analyze blame
- gives a reverse sorted list of the service startup times

If your Pi is headless, you can save a few milli-amps by turning off the HDMI
Place this in /etc/rc.local

/usr/bin/tvservice -o

User avatar
manawyrm
Posts: 34
Joined: Mon Apr 15, 2013 6:18 am
Location: Alfeld (Leine), Germany
Contact: Website Twitter YouTube

Re: [Zero W] Minimal current draw/boot times

Mon May 27, 2019 11:02 am

I'm not running systemd anymore, there are no unnecessary services running :)
HDMI is already disabled first thing in the init-script...

Talking about a minimalistic system:
Image
;)

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: [Zero W] Minimal current draw/boot times

Mon May 27, 2019 12:26 pm

The Zero is factory over-clocked with a large over-voltage setting (+6).

You could perhaps try reducing the voltage with

over_voltage=-N

in /boot/config.txt
Obviously "over_voltage=-6" brings it back to the original 1.2v

Clearly you would have to stability/stress test it after each reduction, I am sure there is a margin.
You may find its fast enough with a reduced clock speed as well, I don't know.
But clock-speed reduction probably wont reduce the power draw by much.

Mine is 100% long term stable at 800MHz/1.2v
which is fast enough for me (if I want speed, I use a 3b+).

Return to “Advanced users”