Skip to content

Instantly share code, notes, and snippets.

@jyaw
Last active May 1, 2019 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jyaw/a3a6cc316820dd1b828c715bccae2e94 to your computer and use it in GitHub Desktop.
Save jyaw/a3a6cc316820dd1b828c715bccae2e94 to your computer and use it in GitHub Desktop.
Raspberry Pi 3 OpenAPS Setup

#How to Setup a Raspberry Pi 3 for OpenAPS

Much of the information here is derived from the hard work of others at the following sources:

These instructions detail how to configure the Raspberry Pi 3 for OpenAPS using a USB-serial cable. Most of these changes are unnecessary for the Raspberry Pi 2 models. Note that a Windows machine was used to interface with the Pi 3 in developing these instructions and use of a wireless things RF module (e.g. Slice of Radio) is assumed (requires UART access). I've attempted to keep the instructions generic enough so they can be applied to multiple platforms.

  1. 🍟 Write the latest Raspbian Jessie to your SD card as you would for the OpenAPS Raspberry Pi Setup in the latest OpenAPS docs
  2. 🍩 In order to enable the serial console, navigate to the mounted "boot" partition on your SD card while it is still in your computer and add the following to the config.txt file:
# Enable miniUART
enable_uart=1
# Force the core frequency to maximum
force_turbo=1

This will enable the /dev/ttyS0 mini-UART on the Pi 3 and force the core frequency to the max rather than the default minimum. 3. πŸ• Put your SD card in the Pi, connect the serial cable (see pic below) and connect via terminal (putty (windows), screen (linux/mac), etc). The baud rate is 115200. Raspberry Pi Console Cable 4. 🍺 Update the repository and upgrade the installed packages:

pi@raspberrypi:~ $ sudo apt-get update && sudo apt-get upgrade -y

Update the firmware:

pi@raspberrypi:~ $ sudo rpi-update

Reboot to apply the changes:

pi@raspberrypi:~ $ sudo reboot
  1. πŸͺ Continue with the OpenAPS docs pi setup instructions, making sure to complete the following steps:
  • setup the user password
  • expand the filesystem
  • set the timezone
  • setup wifi networks
  1. 🍭 Make sure you are able to ssh into the Raspberry Pi 3 before proceeding! In the next step you will disable the serial console, so you want to be sure you can access the Raspberry Pi 3 command line.
  2. πŸŽ‚ SSH into the Pi 3
  3. 🍯 To disable the console, edit the /boot/cmdline.txt file as follows:
pi@raspberrypi:~ $ sudo nano /boot/cmdline.txt

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

Reboot to apply the change:

pi@raspberrypi:~ $ sudo reboot
  1. 🍨 Proceed with installing OpenAPS dependencies and software. Use /dev/ttyS0 as the mmeowlink port.
@Jieseldeep
Copy link

Who created this guide? Would you have any interest in helping create a Moto Z mod using the pi hat and incorporating it into AndroidAPS? Let me know and I'd be happy to find a Moto Z and developer Pi Hat mod for you to tinker with!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment