2023-11-09 16:39:31 -05:00
# Introduction
2023-11-09 14:52:08 -05:00
2024-05-09 16:15:21 -04:00
The interlock folder contains P1AM-100 code (which is Arduino MKR1000).
2023-11-09 14:52:08 -05:00
2024-05-09 16:15:21 -04:00
The Listen2Arduino.py is a script for listening the P1AM-100 output (via USB), and put the status, the tritium, Vaccum, and SubPump reading to the fsunuc.physics.fsu.edu database. It will also save the status into ~/data.txt. The data.txt is used for the statusDisplay to run the local dashboard.
2023-11-09 16:39:31 -05:00
2024-05-09 16:15:21 -04:00
A brief diagram to show the data flow
```cpp
P1AM --> Listen2Arduino.py
+---> data.txt --> statusDisplay
+---> database
```
# Setup using Arduino IDE 1.X
2023-11-09 14:52:08 -05:00
The P1AM.h library is needed.
2023-11-09 16:39:31 -05:00
2024-05-09 16:15:21 -04:00
* PA1M.h
* Ethernet.h
* liquidCrystal.h
also, need to add board MKR1000, use the baord manger, search for
* Arduino SAMD Boards
# Setup the Raspberry Pi
need to install the python package for InfluxDB-client
```sh
sudo python -m pip install --break-system-package inlfuxdb-client
```
## influx_token.txt
the influx database need a token for access. the token for the interlock can be found in https://fsunuc.physics.fsu.edu/elog/LabMaintenance/7
## interlock database at fsunuc.physics.fsu.edu
database name : interlock
2023-11-09 16:39:31 -05:00
## Setup system service for the Listen2Arduino.py
2024-05-09 16:15:21 -04:00
In order to make the Listen2Arduino.py to run at startup and as a background daemon,
2023-11-09 16:39:31 -05:00
copy the listen2P1AM.service to /etc/systemd/system/
run
2024-05-09 16:15:21 -04:00
```sh
sudo systemctl daemen-reload
sudo systemctl enable listen2P1AM.service`
sudo systemctl start listen2P1AM.service`
```
2023-11-09 16:39:31 -05:00
2024-05-09 16:15:21 -04:00
## make a symbolic link to ~/data.txt
2023-11-09 16:39:31 -05:00
2024-05-09 16:15:21 -04:00
Once the Listen2Arduino.py is running, it will create ~/data.txt, so that the local status display can read and update the status. create a symbolic link
2023-11-09 16:39:31 -05:00
2024-05-09 16:15:21 -04:00
```sh
cd ~/Multi-SNICS_Interlock/statusDisplay/
ln -s ~/data.txt .
```