Setting up a Raspberry Pi rig

Download Raspbian and write it to your microSD card

Following the install instructions, download Raspbian Lite (you do not want Raspbian Desktop) and write it to an microSD card using Etcher.

Place your wifi and ssh configs on the new microSD card

Once Etcher has finished writing the image to the microSD card, remove the microSD card from your computer and plug it right back in, so the boot partition shows up in Finder / Explorer.

Create a file named wpa_supplicant.conf on the boot drive, with your wifi network(s) configured. The file must be in a Unix format. If creating the file in Windows, use an editor that allows you to save the file in Unix format instead of DOS format. There are many editors with this ability. Notepad++ is one that works well. The file should look something like:

country=xx
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
  ssid="MyWirelessNetwork"
  psk="MyWirelessPassword"
}

You will need to replace xx after country with the correct ISO3166-1 Alpha-2 country code for your country (such as US, UK, DE, etc) - otherwise wifi will remain disabled on the Pi.

To enable SSH login to the Pi, you will need to create an empty file named ssh (with no file extention). On Windows, you can make this file appear on your Desktop by opening the command prompt and typing:

cd %HOMEPATH%\Desktop
type NUL > ssh

On a Mac, the equivalent command is:

cd ~/Desktop/
touch ssh

When you are done, copy it from your Desktop to the boot drive of your SD card. Now you will need to boot up your Pi and connect to it.


Boot up your Pi and connect to it

After the writing is done, you can eject the microSD card from your computer and insert it into your Pi (card slot location shown below), then plug in power to the Pi and turn on the power switch (off/on positions are labeled on the HAT board for ease).

"install piBakery"

Give the rig a couple minutes to boot up. Once the green LED stops blinking as much, you can try to log in.

On Mac, open Terminal and use ssh pi@raspberrypi.local

On Windows, use PuTTY and establish an SSH connection, with username pi, to hostname raspberrypi.local. If you receive a warning that the rig’s host key is not yet cached, respond YES to add it.

Troubleshooting: If you have problems connecting, try rebooting your router.

The default password for logging in as pi is raspberry. The pi username and default password is only used for this initial connection: subsequently you’ll log in as root with a password and rig hostname of your choosing.

Run openaps-install.sh

Once you’re logged in, run the following commands to start the OpenAPS install process:

sudo bash
curl -s https://raw.githubusercontent.com/openaps/oref0/master/bin/openaps-install.sh > /tmp/openaps-install.sh && bash /tmp/openaps-install.sh dev
  • Change your hostname (a.k.a, your rig’s name). Make sure to write down your hostname; this is how you will log in in the future as ssh root@whatyounamedit.local
  • You’ll be prompted to set two passwords; one for root user and one for pi user. You’ll want to change the password to something personal so your device is secure. Make sure to write down/remember your password; this is what you’ll use to log in to your rig moving forward. You’ll type it twice for each user. There is no recovery of this password if you forget it. You will have to start over from the top of this page if you forget your password.
  • Pick your time zone (e.g., In the US, you’d select US and then scroll and find your time zone, such as Pacific New if you’re in California).

The script will then continue to run awhile longer (10 to 30 minutes) before asking you to press enter or control-c for the setup script options. Successful completion of this section should look like below.

"install piBakery"

Finish installation

Press enter and answer all the setup questions. A successful setup script will finish asking you if you want to setup cron. Say yes to those two questions. Finally, you’ll see a message about Reboot required. Go ahead and reboot the rig. You’ve finished the loop installation. Login to the rig again. "install piBakery"

Troubleshooting: If your rig gets stuck at the point shown below, simply login to the rig again and run the setup script one more time. Usually, running the setup script a second time will clear that glitch. "install piBakery"

Once your setup script finishes, make sure to watch the pump loop logs

NOTE: If you are using RFM69HCW as RF module:

If you have connected your RFM69HCW module as described in Soldering RFM69HCW, while running interactive setup use following option:

3) RFM69HCW (DIY: SPI)

and then select your ttyport, depending on which you have wired your RFM69HCW to (CE0 on RPi pin 24 will be /dev/spidev0.0, CE1 on RPi pin 26 will be /dev/spidev0.1):

3) RFM69HCW on /dev/spidev0.0 (walrus)
4) RFM69HCW on /dev/spidev0.1 (radiofruit bonnet)