- Raspberry pi with built in bluetooth.
- Adafruit DHT22 temperature-humidity sensor
- Install raspbian...
- I used the April 2018 image.
- Wire up the pi to the sensor.
- Use the diagram and instructions on this page https://learn.adafruit.com/dht/connecting-to-a-dhtxx-sensor.
- Plug the left pin (red pin) into 5v.
- Plug the right pin (black pin) into ground.
- Plug the inner left pin (green pin) into a gpio pin, I chose 4.
- Raspberry pi pins.
- Plug in the pi, connect it to your local network, and enable ssh.
- I used the following link to do this before I plugged in the pi: Prepare SD card for Wifi on Headless Pi.
- Install node on the pi.
- I used nvm Node Version Manager to do this.
- Make sure node is working on the pi.
npm install -g cowsay
cowsay hi
- You might need to
source ~/.bashrc
before nvm works.
- Setup the
node-dht-sensor
- The instructions are on the link, here's what I did:
- On the pi, run the following code:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.56.tar.gz tar zxvf bcm2835-1.56.tar.gz cd bcm2835-1.56 ./configure make sudo make check sudo make install
- On the pi, run the following code:
- The instructions are on the link, here's what I did:
- Write the code.
- Create a new node project, so just
mkdir sensor
or something. - Inside that directory,
npm install node-dht-sensor
, might take a while. - I've included my code in this gist, you can just copy and paste it.
- Run the app,
node app.js
- 🤗
- Create a new node project, so just