Professional Documents
Culture Documents
Project Report For Website1
Project Report For Website1
Synopsis:
After this project (~40min) you should be able to turn on a digital output pin on the raspi from
nodered generated analog data coming form DHT11/22 sensor as well as outside temperature.
So if either one is higher than setpoint, pin will go high. A timestamp inject node will send input
data every 10 min. and email warnings if temperature passes certain point. Using a relay, we
can control high voltage loads from raspi pin (i.e. AC motor fan).
We will need internet on the raspi for outdoor weather information. Creating the user
interface(ui) will allow us to access the raspi generated data locally on any computer with
internet. This project was tested on a fresh install of Rasbian Stretch.
SSH (secure shell) with programs like PuTTY will make this easier as you can copy cmnds from
this document and paste them in Lxterm on any other LAN connected computer you have. To
do this turn on SSH (go to preferences – Raspi Configuration - interfaces). Open Putty on your other
computer and put IP of raspi for host. (default user is – pi && default pass is – raspberry)
You might also want to checkout WinSCP for easy files transfer to/from computer and raspi.
*Not necessary for this project.
-------------------------------------------------------------------------------------------------------------------------------
Used Hardware:
Raspberry Pi
DHT-22 or DHT-11 sensor (dht11 is less accurate/precise)
2N3904 Transistor (NPN BJT)
S108T02 solid-state relay (coil relays should work as well)
120 VAC Fan (or w.e. device for the relay to turn on; will need to open one side of the power
cable for switch control with the relay, be sure its unplugged 1st especially if its 120V.
Resistors-
o 10KΩ
o 330Ω
o 4.7KΩ
Breadboard & various jumper cables (mainly F/M)
-------------------------------------------------------------------------------------------------------------------------------
Instructions:
npm install node-red-contrib-ui (buncha WARN signs pop up but don’t worry)
cd node_modules
mv node-red-contrib-ui ~/.node-red/node_modules
cd
rmdir node_modules
1st need to install bcm2835 library before DHT sensor node. Find current version at
http://www.airspayce.com/mikem/bcm2835/
Replace 1.57 wherever its stated below with w.e. is newer
wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.57.tar.gz
tar zxvf bcm2835-1.57.tar.gz
cd bcm2835-1.57
./configure
make
sudo make check (Total should = 1 Pass)
sudo make install
cd
node-red-stop
node-red-start
JSON code for this project is posted on website (chansey.weebly.com) named node-
-------------------------------------------------------------------------------------------------------------------------------
Schematic:
-------------------------------------------------------------------------------------------------------------------------------
Node Expanation: Change the inject node(timestamp) to send as often as you like.
Step 2: Double click the “Open Weather Map” node and configure your City and Country:
The weather map app will ask you for an API key. You will need to make a free account on their
website to generate a random API key. Go to -
https://home.openweathermap.org/users/sign_in
Step 5: Connect the email node to the weathermap node and set your email and password.
With this you can monitor the weather conditions on your phone if you are not at
home.(optional)
-------------------------------------------------------------------------------------------------------------------------------
FAQ:
-------------------------------------------------------------------------------------------------------------------------------
Tips:
Easily add more data analysis from weathermap into the function node. The names used in the
function node are from expanding the complete weather msg payload in the debug tab
-------------------------------------------------------------------------------------------------------------------------------
References:
Project sites:
Chansey.weebly.com
https://www.hackster.io/ada-energy-17/home-automation-using-raspberry-pi-2-and-node-red-ede8ae
http://developers.sensetecnic.com/article/how-to-control-almost-anything-with-a-raspberry-pi-2-node-
red-and-wotkit/
https://raspberrypi.stackexchange.com/questions/67281/bash-npm-command-not-
found?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
https://www.instructables.com/id/Install-Nodejs-and-Npm-on-Raspberry-Pi/
AUX sites:
http://developers.sensetecnic.com/article/using-sqlite-with-fred/
https://randomnerdtutorials.com/getting-started-with-node-red-on-raspberry-pi/