Raspberry Pi Zero W w/ Python 3

  • 1GHz, single-core CPU
  • 512MB RAM
  • 802.11 b/g/n wireless LAN
  • Bluetooth 4.1
  • Bluetooth Low Energy (BLE)


The Raspberry Pi Zero W V1.1 by far not the most powerful, but my favorite Raspberry Pi board, because it’s so very most and still capable enough. After putting the tiny board, weighing only 9.3g / 0.3oz into a nice case like this one maybe, it is time to bring it to life.

Linux OS

  1. Download this minimal image, based on Debian Stretch.
  2. Uncompressing the ZIP will create the image file, e.g. 2018-11-13-raspbian-stretch-lite.img
  3. Download balenaEtcher, a tool for conveniently flashing an SD cards
  4. Insert a MicroSD Card (8Gb or larger) into your computer or card reader and use Etcher to copy the downloaded image onto the SD Card.

Before removing the SDCard, let’s add a few files to allow for a headless setup later:

For instance, if a wpa_supplicant.conf file is available in the /boot partition, it will be moved automatically into the right place (/etc/wpa_supplicant/) during the boot process:

Creating an empty ssh file will enable Secure Shell (SSH) when the Raspberry Pi boots up.

SSH over USB

The previous step should put the Raspberry Pi on the configured Wifi network, but in case that fails, let’s also enable the option to ssh into the Raspberry Pi Zero over a USB connection:

Append dtoverlay=dwc2 to this file: /Volumes/boot/config.txt like so:

Using your preferred editor, append ‘ modules-load=dwc2,g_ether‘ to /Volumes/boot/cmdline.txt (mind to spaces) after rootwait

1st Boot

At this point, the SDCard is ready to be inserted into the Raspberry Pi Zero. Connecting the device with another computer, using the center-most micro-USB socket, not only powers the Zero, but also allows to ssh into it. By default, the host name of the Zero is raspberrypi, the username is pi and by default the password is raspberry. Therefore

ssh pi@raspberrypi.local

Using ifconfig should now result in something like this:

Setting a hostname, adjusting the local and timezone, and since the devices runs mostly headless, the GPU memory can be reduced to 16MB, which is the minimum.

  • Network Options / N1 Hostname …
  • Localization Options / Change Locale: us.UTF and Change Timezone: US/Pacific
  • Advanced Options / Memory Split

Adding a user

sudo su
adduser wolf
usermod -aG sudo wolf

mkdir /home/wolf/.ssh
cat >> /home/wolf/.ssh/authorized_keys …

cp /root/.ssh/authorized_keys /home/wolf/.ssh/
chown -R wolf:wolf /home/wolf

//using visudo .. add this at the bottom:L

Updating the OS

which also brings Python to 3.5.3 but pip3 is still missing. Therefore:
followed by:
pip3 install websockets webcolors magicblue

Deploying the app

mkdir /etc/moola

copy source files into /etc/moola

copy config file (lamp.json) into /boot

Launching the app on boot

Append something like this to /etc/rc.local


Share this post:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.