Skip to content

Instantly share code, notes, and snippets.

@glennschler
Last active November 11, 2019 15:19
Show Gist options
  • Save glennschler/78d96f84dfdcd0a63159 to your computer and use it in GitHub Desktop.
Save glennschler/78d96f84dfdcd0a63159 to your computer and use it in GitHub Desktop.
Raspberry Pi Zero Notes 2015-2019

Setup initial access

  1. Step 1. Edit config.txt & cmdline.txt
  • Read learn.adafruit.com first time boot rPi. After creating raspbian SD image, edit and create the following 3 files in the SD boot volume

    • Add dtoverlay=dwc2 to the last line of config.txt
    • Edit cmdline.txt. Search rootwait text, and after add a space and then modules-load=dwc2,g_ether
    • Create an empty file named on ssh
  1. Edit /etc/network/interfaces as shown below
  2. Create wpa_supplicant text
wpa_passphrase "SSID" [wifi passphrase]
  1. Edit /etc/wpa_supplicant/wpa_supplicant.conf as shown below
  2. Some options
wpa_cli list_networks
wpa_cli select_network 1
  1. Run the sudo raspi-config to enable SSH next time and resize the SD

  2. Update all, and Remove node 10.x

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove nodejs
  1. Install more

    sudo apt-get install vim tmux
    
  2. Tmux config vim ~/.tmux.conf

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix# Start window numbering at 1
set -g base-index 1
  1. Install node 11.x
# Node version 10 is the last version to support ARMv6
wget https://nodejs.org/dist/latest-v10.x/node-v10.17.0-linux-armv6l.tar.gz
tar -xvf node-v10.17.0-linux-armv6l.tar.gz
cd node-v10.17.0-linux-armv6l
sudo cp -R * /usr/local/
rm -r node-v10.17.0-linux-armv6l
rm node-v10.17.0-linux-armv6l.tar.gz
  1. Avahi-daemon implements the Apple Zeroconf specification, (like bonjour) after this it is easy to ping hostname_pi.local from OS X or other Zeroconf configured machine. Secondly, avaih-utils will make it easy to find other RPis on the local network.
sudo apt-get install avahi-daemon avahi-utils
  1. Logoff/Login
  2. Run node -v

Slideshow

  1. Install Feh image vierwer for slideshow, and screen saver.
sudo apt-get install feh
sudo apt-get install xscreensaver
  1. In raspbian UI preferences, set to never enable screen saver

  2. Create Feh script ~/start_feh.sh

echo "feh --recursive --randomize --auto-zoom -F -x -D5 -B white -Y -r /home/pi/Pictures" > ~/start_feh.sh
chmod 755 ~/start_feh.sh
sudo vim ~/.config/autostart/start_feh.desktop

Add this to the start_feh.desktop

[Desktop Entry]
Name=feh_slideshow
Exec=/home/pi/start_feh.sh
Type=Application

johnny-five

  1. Install node modules
mkdir src/nodedev
cd src/nodedev
git clone https://github.com/rwaldron/johnny-five.git
npm install
npm install raspi-io

# optional

Firewall

sudo apt-get install ufw
sudo ufw status verbose

# turn it on, and set to enable at boot
sudo ufw enable

sudo ufw allow ssh

# other linux (not needed on rPi. already installed)
sudo apt-get install openssh-server

VNC

  1. config
sudo apt-get install x11vnc avahi-daemon
sudo x11vnc –storepasswd /etc/x11vnc.pass
  1. Add the following to the last line of /etc/mdm/Init/Default and reboot
# do not use -ncache option
nohup x11vnc -auth /var/lib/mdm/:0.Xauth -noxrecord -noxfixes -noxdamage -bg -forever -nolookup -rfbauth '/etc/x11vnc.pass' -o /var/log/x11vnc.log 2> /dev/null 1>&2 &
# Not needed for modern raspbian versions
#
# /etc/network/interfaces
#
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa_roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
sudo apt install -y tightvncserver
sudo apt install -y xrdp
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs
#
# /etc/wpa_supplicant/wpa_supplicant.conf
# config will connect to either WPA1 or WPA2
#
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="wifi_temp1"
psk="temp-pass"
scan_ssid=1
id_str="temp1"
priority=1
}
network={
ssid="wifi_temp2"
psk="temp-pass"
scan_ssid=1
id_str="temp2"
priority=100
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment