Enable headless operation
- Download raspbian and write to micro-SD card
- Mount on PC and, on the boot partition:
- Create an (empty) file called ssh (this enable SSH on startup)
- Create a wpa_supplicant.conf file with the following content
network={
ssid="YOUR_WIFI_SSID"
psk="YOUR_WIFI_PASSWORD"
key_mgmt=WPA-PSK
}
On Off button
Poweroff
To poweroff, follow these instructions:
Essentially:
Connect button between GPIO18 and GND
Write this python script
- #!/bin/python
- # Simple script for shutting down the raspberry Pi at the press of a button.
- # by Inderpreet Singh
- import RPi.GPIO as GPIO
- import time
- import os
- # Use the Broadcom SOC Pin numbers
- # Setup the Pin with Internal pullups enabled and PIN in reading mode.
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_UP)
- # Our function on what to do when the button is pressed
- def Shutdown(channel):
- os.system("sudo shutdown -h now")
- # Add our function to execute when the button pressed event happens
- GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
- # Now wait!
- while 1:
- time.sleep(1)
- sudo nano /etc/rc.local
- sudo python /home/pi/Scripts/shutdown_pi.py &
Poweron
To poweron, place a button across the RUN header of the RPI zero. This is actually a reset button but when halted can bring the Pi on again.
Power Consumption
During boot, I have seen peaks of 240 mA.
After shutdown, power consumption is 30 mA.
No hay comentarios:
Publicar un comentario