Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
9dda5f1
Update pm25_simpletest.py
MOVEUAS Sep 15, 2023
5049200
This commit is to add Alphasense python code to repo branch 1.
MOVEUAS Sep 15, 2023
0da7b0d
Found the function that pulls from all the bins
KalebNails Oct 6, 2023
1557fde
Update README.md
MOVEUAS Oct 6, 2023
7e5ac58
added the bin labels
KalebNails Oct 6, 2023
afe3cab
moving it to another computer, this version does not work
KalebNails Oct 6, 2023
af987d3
Update OPC_Simple_v2.py
MOVEUAS Oct 6, 2023
ad30bc6
debugged the code
KalebNails Oct 6, 2023
8d2e864
This adds a Ctrl + C function that turns off the sensor when the code…
KalebNails Oct 6, 2023
61f0d9b
This has added the serial code of the alphasense sensor to the first …
KalebNails Oct 6, 2023
6ac4f03
Fixed the spacing in the Serial name, and also changed the name of th…
KalebNails Oct 6, 2023
e5d184a
Create README.md
MOVEUAS Oct 11, 2023
7354b49
Update README.md
MOVEUAS Oct 11, 2023
ffb367b
Update pm25_simpletest.py
MOVEUAS Oct 11, 2023
9c1691e
Create sps30.py
MOVEUAS Oct 11, 2023
d1bb47c
Create exampleReadSPS30.py
MOVEUAS Oct 11, 2023
c9bd000
Update README.md
MOVEUAS Oct 11, 2023
9554c66
Update README.md
MOVEUAS Oct 11, 2023
93c9fa8
Update pm25_simpletest.py
MOVEUAS Oct 11, 2023
1e4dc67
Create SPS30_Senirion_Run.py
MOVEUAS Oct 11, 2023
13b9ecb
Update pm25_simpletest.py
MOVEUAS Oct 11, 2023
ee23072
Update README.md
MOVEUAS Oct 11, 2023
ca07165
Update README.md
MOVEUAS Oct 11, 2023
91a69a7
updated sensirion code so that it may work, still run into occasciona…
KalebNails Oct 11, 2023
b3afb84
We added a wait feature to initialize sensor before reading data. It …
KalebNails Oct 13, 2023
923465c
fixed the sensirion example and made the RUN code. Also in future add…
KalebNails Oct 13, 2023
4889faa
Added an option to dictate what port you want to use in the command l…
KalebNails Oct 27, 2023
1c110ff
Create README.md
MOVEUAS Oct 27, 2023
9c7b2be
added some extra prints and a print for time so its easy to see the v…
KalebNails Oct 27, 2023
ecfe6eb
Update README.md
MOVEUAS Oct 27, 2023
30a3279
Update README.md
MOVEUAS Oct 27, 2023
f69e2e8
Update sps30.py
MOVEUAS Oct 27, 2023
5316c3c
added a system arguement to the sensirion
KalebNails Oct 27, 2023
cd321c3
added a system arguement to the sensirion
KalebNails Oct 27, 2023
3ef8967
Update OPC_Simple_v2.py
MOVEUAS Dec 6, 2023
6360c3d
Update pm25_simpletest.py
MOVEUAS Dec 13, 2023
0195cab
Update README.md
MOVEUAS Dec 13, 2023
e0823fa
Update OPC_Simple_v2.py
MOVEUAS Dec 13, 2023
6cc8947
Update OPC_Simple_v2.py
MOVEUAS Dec 13, 2023
32f797d
Update SPS30_Senirion_Run.py
MOVEUAS Dec 13, 2023
e4b09a3
Update README.md
MOVEUAS Dec 13, 2023
8bfb6f9
Update README.md
MOVEUAS Dec 13, 2023
1a435fa
added gui files
KalebNails Jan 26, 2024
8004b93
Add files via upload
MOVEUAS Jan 26, 2024
9674b21
Add files via upload
MOVEUAS Jan 26, 2024
2bafc4a
Add files via upload
MOVEUAS Jan 26, 2024
9be4497
Create README.md
MOVEUAS Jan 26, 2024
04e9eae
Update README.md
MOVEUAS Jan 26, 2024
619deca
Update README.md
MOVEUAS Jan 26, 2024
3da0149
Update README.md
MOVEUAS Jan 26, 2024
cb3ef30
Update README.md
MOVEUAS Jan 26, 2024
b975089
Update README.md
MOVEUAS Jan 26, 2024
49c108c
Update README.md
MOVEUAS Jan 26, 2024
d6e796b
Update README.md
MOVEUAS Jan 26, 2024
02025ab
Update README.md
MOVEUAS Jan 26, 2024
9d59dd0
Update README.md
MOVEUAS Jan 26, 2024
c0f6ef2
Update README.md
MOVEUAS Jan 26, 2024
84daea3
Update README.md
MOVEUAS Jan 26, 2024
6247e6f
Update README.md
MOVEUAS Jan 26, 2024
d4442c0
Update README.md
MOVEUAS Jan 26, 2024
324b303
Update README.md
MOVEUAS Jan 26, 2024
02942a5
Update README.md
MOVEUAS Jan 27, 2024
f5c14ab
changed up the autorunning stuff
KalebNails Jan 27, 2024
38eff64
added requirements
KalebNails Jan 29, 2024
0e0f227
Update README.md
MOVEUAS Jan 29, 2024
f306f45
Update README.md
MOVEUAS Feb 2, 2024
928db44
Update README.md
MOVEUAS Feb 2, 2024
f2db208
Update README.md
KalebNails Feb 2, 2024
806f90a
Delete Alphasense/.gitkeep
KalebNails Feb 5, 2024
d6dec5a
Update OPC_Simple_v2.py
KalebNails Feb 6, 2024
daa3498
added post processing
KalebNails Mar 20, 2024
a2103d4
Create README.md
MOVEUAS Mar 20, 2024
2068569
Update README.md
MOVEUAS Mar 20, 2024
c4708db
Update README.md
MOVEUAS Mar 20, 2024
a2435c2
Update README.md
MOVEUAS Mar 20, 2024
8c9dd4a
Update README.md
MOVEUAS Mar 20, 2024
6f59fc0
Update README.md
MOVEUAS Mar 20, 2024
a402db3
Update README.md
MOVEUAS Mar 20, 2024
5656506
Update README.md
KalebNails Mar 25, 2024
77d0573
Update README.md
KalebNails Mar 25, 2024
cc0f634
Update README.md
KalebNails Mar 25, 2024
b2d27f3
Update README.md
KalebNails Mar 25, 2024
0b23f28
Update README.md
KalebNails Mar 25, 2024
4f29f4d
Update README.md
KalebNails Mar 25, 2024
8fc0605
Update README.md
KalebNails Mar 25, 2024
fc62033
Update README.md
KalebNails Mar 25, 2024
a2139b6
Update pm25_simpletest.py
KalebNails Mar 25, 2024
0eceb96
Update pm25_simpletest.py
KalebNails Mar 25, 2024
a16c426
Create .gitignore
MOVEUAS Mar 25, 2024
7a091b9
updated Post_Processing and fixed issues. the issues included not inc…
KalebNails Mar 25, 2024
90bb4f4
Update README.md
KalebNails Mar 25, 2024
646bcb5
Update README.md
KalebNails Mar 25, 2024
07bd217
Create serial_Vaisala_AQT_420.py
KalebNails Mar 29, 2024
ad88f3a
Create README.md
KalebNails Mar 29, 2024
92c3e97
Create CITATION.cff
MOVEUAS Jun 22, 2024
369c47c
Create LICENSE
MOVEUAS Jun 22, 2024
9053521
Create plot_generator.py
MOVEUAS Jun 24, 2024
1fae0c4
Update README.md
MOVEUAS Jun 24, 2024
099e0d1
Update README.md
KalebNails Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.csv
1 change: 0 additions & 1 deletion Alphasense/.gitkeep

This file was deleted.

174 changes: 174 additions & 0 deletions Alphasense/OPC_Simple_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#Created by: Kaleb Nails, Erik Liebergall, Marc Compere
#created : 10/6/2023
#modified: 13 Dec 2023
#from time import sleep
import sys
from usbiss.spi import SPI
import opcng as opc
import os
import time
import signal
import subprocess
from datetime import datetime # datetime.now()


#this is a slightly ugly way to make sure the while loops are killed and the program can exit propperly
global DataLoop
global InitializeLoop
InitializeLoop = True
DataLoop = True

# This is to handle interuptions and turn the alphasense
def handle_interrupt(signal, frame):
global DataLoop
global InitializeLoop
print("Ctrl+C pressed. Performing cleanup or other actions...")

#exits the while loops
DataLoop = False
InitializeLoop = False
time.sleep(.5)
dev.off()
print('sensor off')
exit(0) # Terminate the script gracefully

signal.signal(signal.SIGINT, handle_interrupt)


device='/dev/ttyACM0'
#device='/dev/ttyUSB1'



if len(sys.argv)==1:
#print('sys.argv[0]={0}'.format(sys.argv[0]))
print('provide a device name to read, like:')
print(' python3 pm25_SPS30_Senirion_Run.py /dev/ttyACM0' +"\n")
print('\033[91mWARNING: DEFAULT PORT WILL BE ACM0\033[0m' +"\n")
print('this default setting was left for developement' + "\n" + "\n")
time.sleep(2.5)



if len(sys.argv)>1:
print('using command line arg, and provided device!')
device=sys.argv[1]


#setting up more sensor stuff from the library
spi = SPI(device)
spi.mode = 1
spi.max_speed_hz = 500000
spi.lsbfirst = False

#This loop initializes the sensor and should only run at the start
while InitializeLoop == True:
try:
#This detects which model of opc and prints the relevent data
dev = opc.detect(spi)
# print(type(dev))
print(f'device information: {dev.info()}')
print(f'serial: {dev.serial()}')

#this just formats the serial number string to look better
SerialNumberStr = str(dev.serial())
SerialNumberStr = SerialNumberStr.replace("N3","N3-")
SerialNumberStr = SerialNumberStr.replace(" ","")

print(f'firmware version: {dev.serial()}')
print('sucessfully connected to device')
break

except Exception as e:
print('ERROR connecting to sensor, trying again........')
print(e)
time.sleep(1)


#This exits one directory at a time so its on the local computer so you dont get csvs on your repository
os.chdir("..")
os.chdir("..")

#This creates the file and the first row and and the labels
fname = '{0}_Alphasense_{1}.csv'.format(datetime.now().strftime("%Y_%m_%d__%H_%M_%S"), SerialNumberStr)
file = open(fname,'w')
titleStr = 'Serial Number,Date Label, Dates (YMD), Bin 0, Bin 1, Bin 2, Bin 3, Bin 4, Bin 5, Bin 6, Bin 7, Bin 8, Bin 9, Bin 10, Bin 11, Bin 12, Bin 13, Bin 14, Bin 15, Bin 16, Bin 17, Bin 18, Bin 19, Bin 20, Bin 21, Bin 22, Bin 23, Bin1 MToF,Bin3 MToF,Bin5 MToF,Bin7 MToF,Sampling Period,SFR,Temperature C,Relative humidity,PM1 ug/m3,PM2.5 ug/m3,PM10 ug/m3,#RejectGlitch,#RejectLongTOF,#RejectRatio,#RejectOutOfRange,Fan rev count,Laser status,Checksum'
file.write(titleStr +"\n")
file.flush()
dev.on()

#This loop controls data collection
while DataLoop ==True:
try:
# query particle mass readings
time.sleep(1)
#print(dev.pm())
recorded_data = dev.histogram()
print(recorded_data)

dataStr = ', {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23},\
{24}, {25}, {26}, {27},\
{28}, {29}, {30}, {31},\
{32}, {33}, {34}, \
{35}, {36}, {37}, {38}, {39}, {40}, {41}'.format(
recorded_data.get('Bin 0', ''),
recorded_data.get('Bin 1', ''),
recorded_data.get('Bin 2', ''),
recorded_data.get('Bin 3', ''),
recorded_data.get('Bin 4', ''),
recorded_data.get('Bin 5', ''),
recorded_data.get('Bin 6', ''),
recorded_data.get('Bin 7', ''),
recorded_data.get('Bin 8', ''),
recorded_data.get('Bin 9', ''),
recorded_data.get('Bin 10', ''),
recorded_data.get('Bin 11', ''),
recorded_data.get('Bin 12', ''),
recorded_data.get('Bin 13', ''),
recorded_data.get('Bin 14', ''),
recorded_data.get('Bin 15', ''),
recorded_data.get('Bin 16', ''),
recorded_data.get('Bin 17', ''),
recorded_data.get('Bin 18', ''),
recorded_data.get('Bin 19', ''),
recorded_data.get('Bin 20', ''),
recorded_data.get('Bin 21', ''),
recorded_data.get('Bin 22', ''),
recorded_data.get('Bin 23', ''),
recorded_data.get('Bin1 MToF', ''), # 24
#recorded_data.get('Bin2 MToF', ''),
recorded_data.get('Bin3 MToF', ''), # 25
#recorded_data.get('Bin4 MToF', ''),
recorded_data.get('Bin5 MToF', ''), # 26
#recorded_data.get('Bin6 MToF', ''),
recorded_data.get('Bin7 MToF', ''), # 27

recorded_data.get('Sampling Period', ''), # 28
recorded_data.get('SFR', ''), # 29
recorded_data.get('Temperature', ''), # 30
recorded_data.get('Relative humidity', ''), # 31

recorded_data.get('PM1', ''), # 32 (ug/m3), datasheet pdf page 13
recorded_data.get('PM2.5', ''), # 33 (ug/m3)
recorded_data.get('PM10', ''), # 34 (ug/m3)

recorded_data.get('#RejectGlitch', ''), # 35
recorded_data.get('#RejectLongTOF', ''), # 36
recorded_data.get('#RejectRatio', ''), # 37
recorded_data.get('#RejectOutOfRange', ''), # 38
recorded_data.get('Fan rev count', ''), # 39
recorded_data.get('Laser status', ''), # 40
recorded_data.get('Checksum', '')) # 41

dateStr =', Date:, {0}'.format(datetime.now())

print("\n" + SerialNumberStr + dateStr + dataStr + "\n")
file.write(SerialNumberStr + dateStr + dataStr + "\n")
file.flush()

except BaseException as e:
print(e)
except RuntimeError:
print("Unable to read from sensor, retrying...")
continue

6 changes: 6 additions & 0 deletions Alphasense/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
This is code to read the alphasense through USB. There is also code to read it through the aurduino if thats possible.



Below is an image from the datasheet:
![image](https://github.com/MOVEUAS/Sensor_Code/assets/117048000/1c60443e-5b40-4c41-8a4c-d5d731657155)

20 changes: 20 additions & 0 deletions Alphasense/start_Alphasense_loggers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -x
#
# bash shell script to start multiple logger codes
#
# mdc
# created : 13 Dec 2023
# modified: 13 Dec 2023

alpha1_device='/dev/ttyACM0'
alpha2_device='/dev/ttyACM1'

echo "starting alpha1 logger"
screen -dm -S alpha1 python3 OPC_Simple_v2.py $alpha1_device

echo "starting alpha2 logger"
screen -dm -S alpha2 python3 OPC_Simple_v2.py $alpha2_device




14 changes: 14 additions & 0 deletions Alphasense_Start_Script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

alpha0_device="/dev/ttyACM0"
echo "Starting alpha0 logger"
screen -dm -S alpha0 python3 OPC_Simple_v2.py $alpha0_device

alpha1_device="/dev/ttyACM1"
echo "Starting alpha1 logger"
screen -dm -S alpha1 python3 OPC_Simple_v2.py $alpha1_device

alpha2_device="/dev/ttyACM2"
echo "Starting alpha2 logger"
screen -dm -S alpha2 python3 OPC_Simple_v2.py $alpha2_device

9 changes: 9 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cff-version: 1.0.0
message: "If you use this software, please cite it as below. Additional authors and contributors are cited in individual files or READMEs."
authors:
- family-names: Nails
given-names: Kaleb
orcid: https://orcid.org/0009-0007-8786-837X
title: "MOVEUAS PM sensor software"
version: patch-1
date-released: 2023-07-19
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 MOVEUAS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions PMS plantower/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Documentation #
Official Documentation:
https://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms5003-manual_v2-3.pdf

Necessary uncommon imports pip commands are found on the line they are imported in.
(THIS IMAGE IS NOT THE EXACT SENSOR, BUT THEY ARE THE SAME AT A GLANCE, just for reference)
![Alt Text](https://m.media-amazon.com/images/I/71+cgzmX+pL._AC_SX679_.jpg)



# Personal Knowledge #
For this code run: python3 pm25_simpletest.py
this will default to USB0 of your computer, and you will get a warning as well.

If you have multiple sensors or its just on another port use:
python3 pm25_simpletest.py /dev/ttyUSB#

The # is the port it is on.


BELOW ARE IMAGES ON HOW WE WIRE THEM (not for everyone):
![image](https://github.com/MOVEUAS/Sensor_Code/assets/117048000/d1159ea7-c33e-477f-a33f-659150fc29de)
![image](https://github.com/MOVEUAS/Sensor_Code/assets/117048000/ca50b5bd-99b6-46cc-95a3-b07300ec5d48)
Loading