Setting up Raspberry Pi Zero and Zero W for stepZero R1

First, download a Raspbain image

If you are using a regular Raspberry Pi Zero (not Zero W), then you can download and install OctoPi. This will save you having to install OctoPrint afterwards (you still need to configure OctoPrint to connect to stepZero). Follow the instructions on https://octopi.octoprint.org/ to get the latest stable image and write it to a micro SD card using Etcher. Follow the instructions to setup the WiFi by editing the “octopi-network.txt” file on the boot partition on the micro SD card (you will obviously need a WiFi dongle and a USB-to-microUSB adapter, we recommend Edimax EW-7811Un). SSH should be enabled by default; however, you can create a file with the name “SSH” (without any extensions) to the micro SD card boot partition to enable SSH on the Raspberry Pi. This will allow you to connect to the Raspberry Pi remotely to configure and upload Marlin (or any other firmware or Arduino code you wish to use) to your stepZero without using a screen and keyboard.

If you are using Raspberry Pi Zero W, which we recommend, then the OctoPi image may not detect the embedded WiFi nor the new GPIO UART port /dev/ttyS0 (see below for further details). In this case you will need to follow the instructions on the foundation’s website to download and install Raspbian. We recommend downloading the image and writing it to a micro SD card using Etcher; however, you can also use NOOBS if you prefer. Assuming that you used Etcher to write the Raspbian, create a file with the name “SSH” (without any extensions) to the micro SD card boot partition to enable SSH. Also create a file with the name “wpa_supplicant.conf” in the same location to setup WiFi and containing the following:

network={
++++ssid=”YOUR_WIFI_NETWORK_NAME”
++++psk=”YOUR_WIFI_PASSWORD”
++++key_mgmt=WPA_PSK
}

Repeat the five lines for each network you want to use.

Now place the micro SD card in your Raspberry Pi and power it up. Wait for a minute or two (may be longer on first boot) then login to your Pi via SSH. Remember to change the default password, which is “raspberry”, by using the command “passwd” and following the instructions.

Log into Raspberry Pi via SSH

Use your favorite SSH client (such as OpenSSH, or PuTTY if you’re using Windows) to log into your Raspberry Pi. If you are using OctoPi, you may be able to to reach the Raspberry Pi at “octopi.local” if your computer supports Zeroconf (aka Bonjour). Otherwise you will need to find out the IP address assigned to it by the WiFi router. You can do that using the router’s admin page or you can use a network scanner such as the Fing mobile app to see the IPs of all the devices on the network and look for your Pi. Hint, there will be a “Pi” somewhere in the device name or details 🙂

Configure the GPIO UART

stepZero uses the GPIO UART on the Pi pins 8 and 10 (GPIO14 and GPIO15) for communication between the Pi and the Sanguino core. However, this port is disabled by default on the Pi, and when enabled, it is used to provided an SSH console over the serial port as well as publishing boot info over the port during boot. In order to make this port available for communication with stepZero, you need to enable the port and disable the console and boot info.

There is some confusion with regard to the using the UART port as its name changed from /dev/ttyAMA0 on Pi Zero to /dev/ttyS0 on Pi Zero W (/dev/ttyAMA0 still exists but is used for bluetooth). Additionally, on Raspbian Jessie a new port name, /dev/serial0, now points to /dev/ttyAMA0 on an older Pi and /dev/ttyS0 on a new one.

Enable GPIO serial port

Type the following command on your SSH session, this will open a text editor in the terminal window.

sudo nano /boot/config.txt

Use the arrow keys to reach to bottom of the file and add the following line at the bottom of the file.

enable_uart=1

Press Ctrl-O and enter to save the file, then Cntrl-X to exit the text editor.

Disable the console

There are two sets of commands to disable the console depending on which Pi Zero you’re using. Don’t use “sudo raspi-config” to disable the “Serial boot interface” as it will also disable the UART port.

On Raspberry Pi Zero (and pre-Pi3 in general)

sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.service

On Raspberry Pi Zero W (and Pi3)

sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service

Disable boot info console

Type the following command on your SSH session which will open a text editor

sudo nano /boot/cmdline.txt

You will see something like this

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes root wait

Remove this part

console=serial0,115200

The result should be something like this

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes root wait

Press Ctrl-O and enter to save the file, then Cntrl-X to exit the text editor. Reboot your Pi.

sudo reboot now