Skip to content

UTDallasEPICS/UTDesign-FabLab-Tool-Access

Repository files navigation

Project Overview

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.

Website Overview

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.

Key features

  • 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

Frameworks

  • Node, express, mySQL

Get started

*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

Setup Tool Access System:

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 xterm

In 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.

Setup server:

Install Node (using nvm):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install node

Install dependencies:

npm ci

To 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:

  1. Configure mySQL connection in database.js & FFServer.py
  2. 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

Using Docker Engine (Experimental)

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 --build

Read more README.Docker.md


Setup FabFivePi.py to auto start in Pi (Optional)

Create a new startup script (or use the one provided)

nano /home/pi/Desktop/UTDesign-FabLab-Tool-Access/Raspberry_Pi/startup_script.sh

Make the script executable

chmod +x /UTDesign-FabLab-Tool-Access/Raspberry_Pi/startup_script.sh

Make 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.target
sudo systemctl daemon-reload
To test:
sudo systemctl start startup_script.service
sudo systemctl status startup_script.service

For server side management (Node.js), highly recommend pm2:

https://pm2.keymetrics.io/docs/usage/quick-start/


Issues?

ModuleNotFound: RPLCD

Try installing the library globally

git clone https://github.com/dbrgn/RPLCD.git

Once in the cloned directory:

sudo python setup.py install

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors