Skip to content
Cold Snap™️
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.editorconfig
.eslintrc.json
.gitignore
README.md
package-lock.json
package.json

README.md

Temperature Sensor

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.

Walkthrough

Cold Snap: Temperature Reporting IoT Device

Usage

Once connected, run the Node program from within the root of the project:

$ node .

The optional CLI arguments are as follows:

  1. Temperature threshold in Fahrenheit (default: 35 deg)
  2. Sensor read frequency in milliseconds (default: 5 seconds)
  3. Report frequency in milliseconds (default: 1 hour)

Example

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

Config Examples

I recommend you follow along in the walkthrough if you plan on using these examples

config.txt

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

ngrok.yml

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
You can’t perform that action at this time.