Information on using a Raspberry Pi as a Beeminder traffic light
- Pi Traffic Light for the Raspberry Pi
- Raspberry Pi 4 Model B/1GB
- Power supply
- Mini SD card to install Raspbian OS on
- For setup: monitor, keyboard, mouse
- Monitor adapter, if needed, such as this VGA one
- Install Raspbian on mini SD card
- Log into device using a monitor and keyboard
- Enable SSH in the Raspbian system preferences (source)
- Open Terminal
- Type
ifconfig
and find IP address of device on your network (source) - On a different computer on the network, enter
ssh pi@[your pi's IP]
and provide password (default is raspberry) (source) - Install Mu (may already be installed):
sudo apt-get install mu-editor
- Set Git username:
git config --global user.name "John Doe"
- Set Git email:
git config --global user.email [email protected]
- Check your changes:
git config --list
- SSH into Pi
sudo raspi-config
- Navigate to boot options, and set to "Console Autologin - Text console, automatically logged in as 'pi' user"
- Hit right arrow key until 'Finish' is highlighted, and press enter, opting to reboot the Pi when asked
- Reconnect via SSH once Pi has rebooted
- Install remote desktop server on Pi via SSH:
sudo apt-get install xrdp
- Open (or install as needed) Microsoft Remote Desktop
- Configure new connection, using Pi's IP as computer name, and
pi
as username
Mount the traffic light component on GPIO pins 9, 10, and 11. If you're using the Pi 4 model B (pin diagram), it should look like this, with 7 pins to the left of the lights:
- SSH into Pi
cd
to desired locationgit clone https://github.com/narthur/beeminder-traffic-light.git
cd
intobeeminder-traffic-light
directorypython3 -m pip install --user -r requirements.txt
cp config-example.yaml config.yaml
- Edit
config.yaml
with your username and auth token python3 main.py
Your Pi's IP may change periodically unless you assign a static IP to it.
- Boot the Pi using a keyboard and monitor connected directly to it.
- Open terminal.
- Type
ifconfig
and find IP address of device on your network (source)
Run these commands on the pi, either directly or via an SSH connection.
Command | Description |
---|---|
ifconfig |
Find IP address of device |
sudo poweroff |
Turn off Pi (source) |
sudo reboot |
Reboot Pi (source) |
sudo raspi-config |
Configure Pi - docs |
Command | Description |
---|---|
ssh pi@[your pi's IP] |
SSH into Pi |