I’d seen many project on the web for “Home Security” but none really had that thing.
Thi guide is more of a reminder for me, however please ask any questions.
Parts
Raspberry Pi Zero W Camera Pack – Includes Pi Zero W
Part 1 – Download The OS
Select the OS. I use RASPBIAN STRETCH
Download
You will end up with a ZIP it should take a minute.
Run
cd ~/Downloads/
> ~/Downloads$ unzip 2018-11-13-raspbian-stretch.img*
- The file you downloaded
Part 2 – The OS on SD Card
You now have two files 2018-11-13-raspbian-stretch.img and 2018-11-13-raspbian-stretch.img.zip You can ignore the ZIP file we don’t need it.
Now you have to put the Raspbian OS on to the SD Card.
We are going to use DD
cd ~/Downloads/
> ~/Downloads$ dd bs=4M if=2018-11-13-raspbian-stretch.img of=/dev/mmcblk0 conv=fsync
- /dev/mmcblk0 is the name of your SD Card Device.
See INSTALLING OPERATING SYSTEM IMAGES ON LINUX
Once you has the OS on the SD Card you’ve still got a little bit more to do.
- Connect to WiFi
- Start SSH Server
- Setup authorized_keys (OPTIONAL)
- RSYNC Backup (OPTIONAL)
Part 3 – Auto starting SSH Server [SSHD]
This is very simple. It should only take a few seconds.
Using a client PC/Laptop. Mount the SD Card. On The SD Card will be a boot partition.
cd /media/<USERNAME>/boot
> sudo touch ssh
All the above has done is create a file SSH on the boot partition on the SD Card. We you now start the Pi Zero SSH Server will auto start.
Part 4 – Connect to WiFi
This is a little more complex. Again we have alter a few file on the SD Card.
We are going to manually edit wpa_supplicant.conf so when it starts it has all the info it needs to connect to WiFi.
Using a client PC/Laptop. Mount the SD Card. On The SD Card will be a partition partition.
cd /media/<USERNAME>/partition
> wpa_passphrase <SSID> <PSK>
> wpa_passphrase BTHub6-3CGF xxxxxxxxxxxx >> etc/wpa_supplicant/wpa_supplicant.conf
The resulting file should be…
country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="BTHub6-3CGF" #psk="xxxxxxxxxxxx" psk=XXX-PSK-XXX }
Now put the SD Card in the Pi Zero at attach power.
Part 5 – Python3, PIP3, AWS IoT (MQTT)
Part 5a – Default Python
Their are a few ways to set Python3 as default. The best