A project to experiment with IoTs, data handling and web apps.
The project has also a related tutorial on Medium (wrok in progress).
The project gets an initial inspiration from a job interview I had with the guys of Fybra - Indoor air quality more specifically with their tech lead Davide Violante.
- โ step 1: an Arduino with analog photoresistor converts data to digital, which is sent serially through usb to a Raspberry which (optionally sends the data via MQTT pub/sub protocoll to an other Raspberry who acts as broker who then) sends the data to Influxdata cloud database
- โ step 2: Backend in Node.js that queries the data from InfluxDb and serves it with Express
- ๐๏ธ step 3: Frontend with React
- step 4: migrate backend to Google Cloud Functions
- step 5: React Native mobile app
- step 6: change/add sensor to CO2/other
- step 7: experiment with AI
- Ip local address raspberry pi: 192.168.1.180
- Ip local address laptop: 192.168.1.65
Connect via ssh ssh pi@[ip-address]
Check README.md in arduino folder
Check README.md in raspberry folder
Check README.md in backend folder
Check README.md in frontend folder
HTTP requests to the express endpoints are in requests
folder (Installation of VSCode plugin REST Client is required).
Because this repo has multiple sub-repos: in order to have Vscode ESlint plugin working, add to the Vscode settings (File > Preferences > Settings) the parameter:
"eslint.workingDirectories": [
"./backend", "./frontend
]
-
Install broker (on laptop)
sudo apt-get install mosquitto
sudo service mosquitto status
sudo service mosquitto restart
-
to allow access from other address on port 1883 with no authentication add to file
/etc/mosquitto/mosquitto.conf
:
listener 1883
allow_anonymous true
- Install client
sudo apt-get install mosquitto-clients
- subscribe to a topic (from laptop)
mosquitto_sub -h localhost -t "my_topic"
- pubblish to a topic (from Raspberry)
mosquitto_pub -h 192.168.1.65 -t "my_topic" -m "hello world"
- Install influx CLI Docs
- Configure connection
influx config create --host-url CLUSTER_URL --org pcolt --token INFLUX_DATA_TOKEN --active --config-name sensors1
- Write data Docs
influx write --bucket sensors1 -p s "home2,location=studio light=600 1708502477"
- query all data from one table Docs
SELECT * from home2;
- query all tables in bucket
SHOW TABLES;