Using a Raspberry Pi Zero WH, a temperature sensor, and some code, I created a device that would notify me every so often if the temps are below the set threshold.
Cold Snap: Temperature Reporting IoT Device
Once connected, run the Node program from within the root of the project:
$ node .
The optional CLI arguments are as follows:
- Temperature threshold in Fahrenheit (default: 35 deg)
- Sensor read frequency in milliseconds (default: 5 seconds)
- Report frequency in milliseconds (default: 1 hour)
To have the program take a measurement every second and report the temperature every 10 seconds if the temperature is under 60 degrees, run the following:
$ node . 60 1000 10000
I recommend you follow along in the walkthrough if you plan on using these examples
In order for the Pi to register the temperature sensor connected to GPIO pin #4, sudo add this line at the end of /boot/config.txt of your Pi:
dtoverlay=w1-gpio
In order for ngrok to be run at boot time by systemd, you'll need to create an ngrok config:
authtoken: <add_your_token_here>
tunnels:
ssh:
proto: tcp
addr: 22