This project creates an access system for the operation of power tools in FabLab, creating a safer environment by ensuring that only trained students can access the equipment for a limited time.
The website neatly displays the time log of anyone who have successfully turned on a machine with their comet card. It was primarily made for Tim to quickly view the usage of the machines and potentially narrow down issues.
- Sort log data by machine type
- Sort log data by month and day
- Download desired logs as a CSV file
- Deletion of machine if needed
- Automatically updates machine list from database
- Optimized connections using SQL pooling
- Node, express, mySQL
*Note: This guide assumes that you are cloning the repo into
home/pi/Desktop/for raspberry pi.
Clone main branch:
git clone https://github.com/UTDallasEPICS/UTDesign-FabLab-Tool-Access.git
All files under /Raspberry_Pi. (Other dirctories can be deleted)
We'll be using xterm for our terminal output (used in startup_script.sh). You can use any terminal that supports detached terminal -e such as lxterminal.
sudo apt install xtermIn FabFivePi.py, make sure to change the default values for machine_name = 'Bandsaw 1' & minutes = 5
Run python3 FabFivePi.py
Check out here to autostart the program at bootup.
Install Node (using nvm):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashnvm install nodeInstall dependencies:
npm ciTo start web server:
node server.js
Go to http://127.0.0.1:3000/ to view the website
If the database & server is not locally hosted:
- Configure mySQL connection in
database.js&FFServer.py - Change the IP address to bind:
- In server.js:
const hostname = "<IP address>"; - In FFServer.py:
ServerIP = '<IP address>' - In FabFivePi.py:
server_address = ('<IP address>', 2222)
Make sure to also run the python server module
python3 FFServer.py
A dockerfile is added to make it easier to automatically bundle the installation process for the website and the database. But currently FFServer.py has to be manually installed along with the dockerfile. To build the dockerfile, run:
docker compose up --buildRead more README.Docker.md
Create a new startup script (or use the one provided)
nano /home/pi/Desktop/UTDesign-FabLab-Tool-Access/Raspberry_Pi/startup_script.shMake the script executable
chmod +x /UTDesign-FabLab-Tool-Access/Raspberry_Pi/startup_script.shMake the script run from bootup using systemd
sudo nano /etc/systemd/system/startup_script.service[Unit]
Description=Startup Script
[Service]
Type=simple
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
ExecStart=/bin/bash /home/pi/Desktop/UTDesign-FabLab-Tool-Access/Raspberry_Pi/startup_script.sh
[Install]
WantedBy=default.targetsudo systemctl daemon-reload
To test:
sudo systemctl start startup_script.service
sudo systemctl status startup_script.serviceFor server side management (Node.js), highly recommend pm2:
https://pm2.keymetrics.io/docs/usage/quick-start/
Try installing the library globally
git clone https://github.com/dbrgn/RPLCD.git
Once in the cloned directory:
sudo python setup.py install