This is a project for ES1050 at Western University. For proper use, you'll need a backend server and a raspberry pi with a compatible temperature sensor and camera.
These instructions cover only the setup of the backend server. Client instructions are detailed elsewhere. These instructions are for Ubuntu 20.04
It is recommended to set this project up in a container (using something like LXD) if applicable.
- Connect to your server over ssh, and run all commands as root.
- Run each of the lines below:
apt update apt install -y git curl curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash - sudo apt-get install -y nodejs
- Upload the repository under
/root/hoophouse-manager
, or clone with git:cd /root sudo apt-get install -y git git clone https://github.com/kurmachu/hoop-manager.git
- Set up the server service and dependancies:
cd hoop-manager/server npm install cp ./hoophouse-server.service /lib/systemd/system systemctl enable hoophouse-server.service
- Reboot the server. You can probaby do this by running
init 6
The client is a simple single-page web app, to set it up it is recommended you install a web server on the same sever you host the backend. DigitalOcean has a great guide on setting up NGINX
After setting up, edit the first line of god.js
to point to your server and port. Then, upload the files and check that you can navigate to them.
It is recommended you use Windows with Windows terminal.
- Install and run the Raspberry Pi Imager
- Connect the SD card to the computer
- Select
CHOOSE OS
>Raspberry Pi OS (other)
>Raspberry Pi OS Lite (Legacy)
- Select your drive from the select storage menu
- Flash
- When done, open the
boot
device in explorer. If you don't see it, eject and reconnect the SD card. - Add an empty file called
ssh
toboot
. Make sure you can see file extensions, as you need a file namedssh
and notssh.txt
- Create a file called
wpa_supplicant.conf
and fill in the following values, replacingYOUR WIFI
andYOUR WIFI PASSWORD
with a network you would like to use. If you are not in Canada, change yourcountry=
to the correct country code. This is for legal reasons.The above code works best with wifi networks that do not contain spaces.country=CA ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YOUR WIFI" scan_ssid=1 psk="YOUR WIFI PASSWORD" key_mgmt=WPA-PSK }
- Eject the usb, and insert it into the Pi
- Power on the Pi
- Open Windows Terminal, or your terminal application of choise.
- Find the ip of the Pi, if you are on windows you can use Angry IP Scanner
- Connect to your Pi over ssh, by running
ssh pi@
[The IP of your Pi] - Follow the connection steps. The default password is
raspberry
- Run the following commands to set up the client:
sudo apt update sudo apt install -y git curl curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash - sudo apt-get install -y nodejs git clone https://github.com/kurmachu/hoop-manager.git cd hoop-manager/client sudo cp ./hoophouse-client.service /lib/systemd/system npm install
- Create the default config file by running
npm run client
, then pressingCtrl+C
to quit the program once it fails to connect to the server - Edit
config.json
in your favorite text editor (vi, nano, pi doesn't come with vim so install it if you would like) - Set the websocket url to point to your correct server and, if you changed it, port.
- Save and quit whatever editor you are using
- Run
sudo raspi-config
- Navigate to
interface options
, selectcamera
, selectyes
, selectok
- Press escape to exit
- Run
sudo systemctl enable hoophouse-client.service
to enable the client software to run as a service - Run
passwd
, and follow the steps to set a new password for the Pi. This is important, as the default password is well known and could lead to your Pi being used for nefarious purposes by others. - If the Pi is in place, run
init 6
to reboot. If you would like to shut down, and boot the next time power is attatched, runinit 0
The Pi will now be set up to communicate with your server.