Tips&Tricks Raspberry Pi (en)
RPi Zero W with Raspbian Lite
flash raspian
- Download image from https://www.raspberrypi.org/downloads/raspbian/
- unzip the image archive
- insert the sdcard into a reader and check which devices are for the reader
- unmount the partitions in question
- copy the data with: sudo dd bs=4M status=progress if=./2018-11-13-raspbian-stretch-lite.img of=/dev/sdb
- call sudo sync
- remove the sdcard
configure it to be able to connect via wifi + ssh without connecting a monitor or keyboard
- insert sdcard into card reader
- use “df -h” to see where the sdcard was mounted
- go to the boot partitions (like: cd /media/thomas/boot)
- create a new file wpa_supplicatnt.conf (e.g. via “nano wpa_supplicant.conf)
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YourNetworkSSID"
psk="Your Network's Passphrase"
key_mgmt=WPA-PSK
}
- creat an empty file ssh to enable ssh with: touch ssh
- use the sdcard to let it boot
login to your new pi
- check on your wifi router which IP this new RPi has to be able to connect to it via ssh
- login via ssh with user pi and password raspberry
- change the default password
RPi Pinout
control GPIOs
small python script:
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) # GPIO Numbers instead of board numbers
RELAIS_1_GPIO = 17 GPIO.setup(RELAIS_1_GPIO, GPIO.OUT) # GPIO Assign mode GPIO.output(RELAIS_1_GPIO, GPIO.LOW) # out GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) # on