Skip to content

Instantly share code, notes, and snippets.

@jmsaavedra
Last active May 1, 2019 20:22
Show Gist options
  • Save jmsaavedra/145b20c3338738bb89dceeaefe9a1939 to your computer and use it in GitHub Desktop.
Save jmsaavedra/145b20c3338738bb89dceeaefe9a1939 to your computer and use it in GitHub Desktop.

20p Raspberry Pi Setup

##Hardware

##SD / OS / Software Setup

  1. Download latest raspbian here: https://www.raspberrypi.org/downloads/raspbian
  2. Follow SD card format & flash steps here: https://gist.github.com/jmsaavedra/d8375a91f24b8ed15282
  3. Bootup rPi from SD card, with all peripherals including WiFi connected to board
  4. Update system configuration (expand filesystem, boot settings)
$ sudo raspi-config
  1. Update the core OS packages (this takes several minutes)
$ sudo apt-get update
$ sudo apt-get upgrade
  1. Enable remote desktop. Instructions here
  2. Follow phat-dac installation guide here. Quick install:
$ curl -sS get.pimoroni.com/phatdac | bash
  1. Reboot pi
$ sudo reboot
  1. Install Node via NVM
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
$ nvm install v5.8.0
$ nvm alias default v5.8.0
  1. Install mpg123 audio playback utility
$ sudo apt-get install mpg123

Setting up AP mode

Configuring Wireless Access Point (AP) mode allows for the following UX when setting up their device for the first time: User plugs in device. Device is not connected to the internet (ships with no WiFi credentials), and therefore boots up in "configuration mode". In configuration mode, the device itself broadcasts it's own WiFi network "MomBox", and the user joins this network on a laptop or phone. User opens browser, and is served a single webpage that contains a form with fields for "WiFi Network Name (SSID)" and "WiFi Password". Upon hitting the Submit button on this form, the device reboots and attempts to join named network. If the device ever fails to connect to the WiFi going forward (ie, network is down) it should boot up in Configuration Mode again. A single, inconspicuous button is on the bottom of the device to reboot in Configuration Mode at any time (ie, user wants to change WiFi networks).

Resources and tutorials for AP Mode on RPi w/Ubuntu:


Setting up ad-hoc mode

Ad-hoc mode is similar to AP mode, however the WiFi broadcasted is as a single device. This is useful for device to device connection; not as useful for serving a webpage/interface and far less device compatible. Not what we will use, but interesting to note.

  $ cd /etc/network
  $ sudo mv interfaces interfaces_wifi
  $ sudo touch interfaces
  $ sudo nano interfaces

Add the following to the interfaces file, then save & exit nano:

 auto wlan0
  iface wlan0 inet static
  address 10.2.1.1
  netmask 255.255.255.0
  wireless-mode ad-hoc
  wireless-essid myRpiNet
  wireless-channel 1

Try restarting networking services:

  $ sudo service networking restart
  $ sudo systemctl daemon-reload
  
  # if all else fails, reboot pi:  
  $ sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment