- Flash Rasbian Lite OS onto SD card
- Enable SSH and wifi - https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
- Add a file named
ssh
- Add a file named
wpa_supplicant.conf
- For the
wpa_supplicant.conf
, set the contents to the below to establish and initial wifi connection to download what we needcountry=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="<Your Home WiFi Name>" psk="<Your Home WiFi Password>" }
- Add a file named
- Enable SSH over USB (Optional)
- In
config.txt
appenddtoverlay=dwc2
to the end - In
cmdline.txt
appendmodules-load=dwc2,g_ether
on the same line afterrootwait
with a single space between the two.- NOTE: if you see something like
quiet init=/usr/lib/raspi-config/init_resize.sh
afterrootwait
, just insert it between the two, but still making sure there is a single space between everything
- NOTE: if you see something like
- In
- Boot up Raspberry Pi
- SSH into the Raspberry Pi
- If setup over usb, it'll be
ssh pi@raspberrypi.local
- If setup over usb, it'll be
- Run initial update commands
sudo apt -y update sudo apt -y upgrade
- Enable the camera (If using CSI camera port) with
sudo raspi-config
->Interfacing Options
->Camera
- Setup the project's folder
- Run
sudo mkdir /opt/rpic
- Run
sudo chown pi:pi /opt/rpic
- Run
sudo mkdir /opt/i2smic
- Run
sudo chown pi:pi /opt/i2smic
- Run
- Add the project code to the Raspberry
- Install git onto the raspberry
sudo apt install git
- Run
git clone https://github.com/Turkey2349/RPIC-Record-and-Stream.git /opt/rpic
- Install git onto the raspberry
- Install FFmpeg with
sudo apt install ffmpeg
- Setup python
- Run
sudo apt install python3-pip python3-gpiozero
- Install the python requirements
sudo pip3 install -r /opt/rpic/requirements.txt
- Run
- Setup the i2s mic
- Run
sudo pip3 install --upgrade adafruit-python-shell wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2smic.py -P /opt/i2smic sudo python3 /opt/i2smic/i2smic.py
- Setup for switching to AP Mode
- Run
sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
- Set the filecontents to
country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 ap_scan=1 ### your hotspot ### # has to be the first network section! network={ priority=0 # Lowest priority, so wpa_supplicant prefers the other networks below ssid="<accesspoint>" # your access point's name mode=2 key_mgmt=WPA-PSK psk="<passphrase>" # your access point's password frequency=2462 } ### your network(s) ### network={ ssid="<yourWifi>" psk="<passphrase>" }
- Run
sudo mkdir /opt/auto-hotspot
- Run
sudo git clone https://github.com/0unknwn/auto-hotspot.git /opt/auto-hotspot
- Run
cd /opt/auto-hotspot
- Run
sudo chmod +x auto-hotspot install.sh
- Run
sudo ./install.sh
- Run
- Setup as service for on startup
- Run
sudo nano /etc/systemd/system/camera.service
- File contents:
[Unit] Description=RPIC Record and Stream service After=multi-user.target [Service] Type=simple ExecStart=/usr/bin/python3 /opt/rpic/main.py [Install] WantedBy=multi-user.target
- Run
sudo systemctl enable camera
- Run
sudo systemctl start camera
- Run
TheTurkeyDev/RPIC-Record-and-Stream
Source code for my implementation of an action camera on a Raspberry Pi Zero
HTML