Introduction: Raspberry Pi Temperature & Humidity Network Monitor

Picture of Raspberry Pi Temperature & Humidity Network Monitor

Please note that there's a Git repo for code at:

https://github.com/jervine/rpi-temp-humid-monitor

If you'd like the latest fixes or would like to contribute. Thanks Jonny Ervine!


I had some issues with Kingston SD Cards, but the SanDisk cards I'm using now have run for weeks without issues, so I'm changing the parts list to reflect that.

Also, after some 49 days, 16 hours, the display flatlines, as the reading routines start returning the same number over and over again. A reboot clears it, so just reboot once a month until I figure out what's up.


Over the past summer, my vacation home had a small water leak for three months, and I realized that had I been measuring the humidity in the effected area, I'd have
seen it go to 100% for a long time and I could have dispatched someone to fix the small problem before it became a big one.
And since I've been playing with Raspberry Pi computers for a while now, and saw an inexpensive temperature/humidity sensor on AdaFruit, I had all the pieces I needed
to implement an inexpensive network-connected monitor.
The Bill Of Materials (BOM):
1) Raspberry Pi Model B
2) Case
3) SD Card
4) Temperature/Humidity sensor
5 ) Power Supply (I use PoE splitters, but any 5V 1A Micro-USB supply will work)
I used the following exact parts, but obvious substitutions can be made to match local conditions and the state of your junk box. Shipping and the availability of bundles
may effect your final price.
$35.00 RPi http://www.newark.com/raspberry-pi/raspbrry-modb-...
$ 8.12 Case http://thepihut.com/products/classic-raspberry-pi... (5.99 Euros)
$ 6.99 SD Card (Sandisk, not Kingston)
$15.00 Sensor http://www.adafruit.com/products/393
$15.99 PoE Splitter http://www.newegg.com/Product/Product.aspx?Item=N...
And a few other miscellaneous things like hand tools, soldering iron, hot melt glue gun, small pieces of plastic wood, etc.
Step

Step 1: Physical Assembly

Picture of Physical Assembly

Split the case, find the hardware bag inside, and set the rubber feet aside for later.

Attach the Raspberry Pi to the case bottom with the supplied hardware.

Remove the GPIO knockout with a razor blade or Xacto knife and snap the two case halves together.

To keep the power dissipation of the power supply and Raspberry Pi from effecting the sensor readings, I cut a piece of Azek plastic lumber about 1.1 x 2.4 x 0.75 inches as a standoff.

Heat up your hot-melt glue gun and stack the parts as in the picture. You'll have a few seconds to make the alignment perfect before the glue sets, so get the alignment close before you press the parts together.  Be careful not to use so much glue that it extrudes from the edges of the seams or extrudes into the case, where it might interfere with the SD card connector.

1) Glue the sensor to the standoff

2) Glue the standoff to the top half of the case. Be careful not to block the LED cutouts on the one side or the ribbon cable cutout for the camera on the other side.

3) Glue the case bottom to the top of the PoE adapter. Make sure the "LAN Out" connector is on the same side as the Raspberry Pi Ethernet adapter.

4) Stick the 4 rubber feet to the bottom of the power adapter.

5) Ensure the voltage-output selection switch is set to 5V. Put a dab of hot-melt glue in the switch to prevent it from being changed and destroying your Raspberry Pi.

Step 2: Electrical Assembly

Picture of Electrical Assembly

The White wire from the sensor is a spare ground, and is not needed.  Cut it off inside the sensor case, being careful not to cut any of the other wires.

Braid the other three wires to keep them together, and cut them off about 3.5 inches long.

Prepare a 5-pin single inline female connector (cut from https://www.sparkfun.com/products/115 or equivalent), and solder the wires to it:

1) Red (+3.3V)
2) No Connection
3) No Connection
4) Yellow (Data)
5) Black (Ground)

Plug the connector into the GPIO on the Raspberry Pi so that pin 1 on the connector (red wire) is on pin 1 of the GPIO connector (label P1 on the board, upper right in the picture).  Note that the Red wire is on GPIO Pin 1 (+3.3V), the Yellow wire is on GPIO pin 7 (GPIO 4), and the Black wire is on GPIO Pin 9 (Ground).

Tuck the excess wire into the case.

Use a short CAT5 cable (something like http://www.monoprice.com/Product?c_id=102&cp_id=10232&cs_id=1023201&p_id=7505 ) to connect the LAN OUT on the PoE splitter and the Raspberry Pi Ethernet jack.  Twist it up to make it stay close to the case.

Take the PoE output cable and a Micro-USB connector or cable and solder them together.  If using an AdaFruit http://www.adafruit.com/products/1390 Micro-USB connector, wire it up as shown at http://learn.adafruit.com/assets/12402 , if using a cut-off cable, determine +5 and Gnd wires with a multimeter.  Note that the TP-Link wire with the white stripe is POSITIVE.

 

Step 3: Raspberry Pi Software Setup

Picture of Raspberry Pi Software Setup

Getting the basic Raspberry Pi software up and running has been documented elsewhere, but basically, go to:
http://www.raspberrypi.org/downloads
download the latest NOOBS (v1.3.2 as of this writing)
Format the SD card using the SD card tool at https://www.sdcard.org/downloads/formatter_4/
Unzip the NOOBS file and put the contents at the root of the SD card.
Insert the SD card into the Raspberry Pi
Connect a keyboard, monitor, mouse, and LAN cable to the Raspberry Pi and connect the power supply (when you plug the PoE splitter into the LAN cable, the Raspberry Pi will power up).

Select the Raspian distribution and install it.
While that's installing, select English-US keyboard, which autoselects US Keymap

On first boot, the raspi-config utility will run.
Select Console Login as the default on boot
Change Locale to en_US UTF-8
Set timezone for your location
Set keyboard to Generic 105-key, English US
Enable the camera
change the hostname to something memorable (I used 'rpithon' for Raspberry Pi Temp/Humid On Net)
set 16M memory split as we'll be running headless
Enable SSH
reboot

Now you can either continue to use the console or ssh to it from another machine.  From my Mac I can just say:
ssh pi@rpithon
and log in using the password 'raspberry'.  If your router doesn't do the DNS to help you find 'rpithon' then make note of the IP address on the console and use that instead.

Update everything (this will take a while):

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

and reboot

Since this is going to be a LAN-only device, I get sick of playing "Mother May I?" with sudo, and I want to avoid any permissions problems with the additional software, so let's enable the root user and delete the pi user:

sudo passwd root
<rootpassword> repeated twice
exit

log back in as root user (or ssh root@rpithon) using the password selected above

remove pi user:

deluser -remove-home pi

I prefer Emacs, and don't want all the X-Windows stuff, so:

apt-get install emacs23-nox

Tell it to check the disk (SD Card) every time it boots:

tune2fs -c 1 /dev/mmcblk0p6

emacs /etc/ssh/sshd_config

change X11Forwarding to no
UseDNS no
ClientAliveInterval 60

service ssh restart

Step 4: Setting Up LAMP Server (web Server)

Picture of Setting Up LAMP Server (web Server)

So we want to be able to see the graphs we'll be generating (below), so we need to install a LAMP server.

LAMP: /Linux/Apache/MySQL/PHP&Perl

Linux is the operating system you are using (Raspian is a version of Debian, which is one of the common flavors of Linux)
Apache is the name of the web server software
MySQL is a SQL (Standard Query Language) database interface.  Databases sound really scary, but they are easy to use for simple things once you get used to them.
PHP and Perl are programming languages that are commonly used with websites, though we'll be using the Raspberry Pi standard Python for graphing the data and 'creating' the website.

apt-get install apache2  php5 mysql-client mysql-server vsftpd

This takes a while to install.  Midway through it'll ask you for a MySQL password, pick one memorable, I'll use 'password' for this tutorial.

Now you should be able to browse to http://rpithon (or http://<IP ADDRESS> if the DNS doesn't work) and see a demo web page.  Try to edit /var/www/index.html and see if your changes show up when you refresh the webpage.

Step 5: Ez_setup, MySQL, Matplotlib

Picture of Ez_setup, MySQL, Matplotlib

ez_setup is a Python program that loads some nice addons (think of it as apt-get on steroids)

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python ez_setup.py

These next steps install some integration between Python and MySQL:

apt-get install python-mysqldb
apt-get install libmysqlclient-dev
easy_install MySQL-python

We'll be using the wonderful, powerful, and free(!) matplotlib for graphing our data, though we won't be using much of its power.

apt-get install libblas-dev liblapack-dev python-dev libatlas-base-dev gfortran python-setuptools python-scipy python-matplotlib

Step 6: WiringPi - GPIO Interface

Picture of WiringPi - GPIO Interface

Gordon Henderson has created a wonderful programming interface for the GPIO pins, including some drivers for the esoteric interface that our Temperature/Humidity sensor uses.  See http://wiringpi.com/ for more details.

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
cd examples
emacs rht03.c (change the line #define RHT03_PIN 0 to #define RHT03_PIN 7 for the GPIO pin we're using)
make rht03
./rht03
(you should get continuous temperature and humidity readings)

now we know our hardware is working, let's write our own program...

Step 7: Set Up a Database and a Table

Picture of Set Up a Database and a Table

So we have database software, but there's no database, or tables, so let's create them:

Open the MySQL command interface:

mysql -ppassword <-- the mysql password you picked previously

[...]

Create a new database, called Monitoring

mysql> create database Monitoring;
Query OK, 1 row affected (0.00 sec)

Select that as our current database

mysql> use Monitoring;
Database changed

Create a single table in the database called TempHumid, which will contain the Unix Epoch (seconds since 1970) and Temperature and Humidity readings

mysql>create table TempHumid (ComputerTime INTEGER UNSIGNED,Temperature DECIMAL(5,1), Humidity DECIMAL(5,1));
Query OK, 0 rows affected (1.70 sec)

Done with MySQL, exit back to the command prompt.

mysql> exit
Bye

Step 8: Add Readings to the Database

Because the timing is tight on the sensor protocol, we're going to use C code to communicate with the sensor and add readings to the database.

So go to the root user's default directory:

cd ~

copy the Makefile (instructions on how to build the code we're going to create)

cp wiringPi/examples/Makefile .

emacs makeFile
change the two lines below to match this:

INCLUDE = -I/usr/local/include,/usr/include/mysql

LDFLAGS = -L/usr/local/lib,/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -lrt -ldl

Now copy th.c (included here) into your default directory. Change the password on line 68 from "password" to whatever you chose as the MySQL password.

When you compile it:

make th

you'll get a couple of warnings about declarations of exit, but it'll work fine.

Now you can run the program by typing:

./th

It waits for a 60-second interval (minute) to end, then reads the sensor, inserts the time and sensor readings into the database, and loops forever.

Once we have that working properly, we want it to start whenever the Raspberry Pi starts up:

emacs /etc/rc.local
insert:

/root/th >> /root/th.log &

before the line that reads "exit 0"

reboot and see if th.log grows by one line per minute:

tail -f th.log

You can confirm that the data is getting into the database with:

mysql -ppassword
use Monitoring;
select * from TempHumid;

You should get a list of all values in the database.

Step 9: Graph Data From the Database

Picture of Graph Data From the Database

We're going to use Python for pulling readings out of the database and graph them with matplotlib.  Log in as root.

Set up the directory structure we'll be using:
mkdir Graph
cd Graph
mkdir graphics

copy GraphTH.py into the Graph directory
Change the password on line 40:
DBconn = mdb.connect('localhost', 'root', 'password', 'Monitoring')
to match the MySQL password you set previously.
You can also set <location_name> on line 81 to match your desired location name

Try running it:

python GraphTH.py

It will get the last 24 hours of readings from the database, reorganize the data, throw out obvious bad data, create a graph of the results, and copy TH.png to /var/www so you should be able to see a new graph time you run GraphTH.py  at http://rpithon/TH.png

Now we want this to run every minute, so:
export EDITOR=emacs
crontab -e
Add the line:
* * * * * /usr/bin/python /root/Graph/GraphTH.py >> /root/Graph/GraphTH.log
at the bottom of the file.

Now GraphTH.py should run every minute, and if you update http://rpithon/TH.png (or http://<IP ADDRESS>/TH.png you should see it change about once a minute.

In the example above I covered the sensor with a damp Kleenex while it dried as a test.

Step 10: Monitor More Than One Location

Picture of Monitor More Than One Location

So I built five of these boxes for various locations, and on the LAMP server of one of them, added the following TH.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <meta http-equiv="refresh" content="60" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>Temperature and Humidity readings</title>
  </head>

  <body>
    <div id="outline">
      <div id="caption">
<h1>
   <br>
     Temperature and Humidity
     <br />
   </h1>
</div>
   <div id="text">
     <p>
       <br>
  Sensor locations:
       <br>
       <br>
  White  - A Room
       <br>
  Green  - Another Room
       <br>
  Blue   - A Place To Monitor
       <br>
  Purple - Another Place
       <br>
  Orange - Somewhere Else
       <br>
       <br>
  Graphs are updated every minute.
       </br>
     </p>
   </div>
</div>
      </body>
      <a    href="http://rpithon-wht/TH.png">
<img src="http://rpithon-wht/TH.png" align="center" width="320" height="240">
</a>
      <a    href="http://rpithon-grn/TH.png">
<img src="http://rpithon-grn/TH.png" align="center" width="320" height="240">
</a>
      <a    href="http://rpithon-blu/TH.png">
<img src="http://rpithon-blu/TH.png" align="center" width="320" height="240">
</a>
      <a    href="http://rpithon-pur/TH.png">
<img src="http://rpithon-pur/TH.png" align="center" width="320" height="240">
</a>
      <a    href="http://rpithon-org/TH.png">
<img src="http://rpithon-org/TH.png" align="center" width="320" height="240">
</a>
</html>

so now I can point my browser at: http://rpithon-wht/TH and see all of the graphs updated every minute.

Step 11: Extras - Camera

Picture of Extras - Camera

You remember how we enabled the camera module when we installed the Raspian operating system?  Now we can add a Raspberry Pi Camera module:

$25 http://www.newark.com/raspberry-pi/rpi-camera-board/add-on-brd-camera-module-raspberry/dp/69W0689

Just feed the camera cable through the slot in the top case and plug it into the connector on the Raspberry Pi as per the instructions at http://www.raspberrypi.org/camera using the connector next to the Ethernet port, with the tinned leads pointing away from the Ethernet connector.

I used another piece of Azek to position the camera with some hot melt glue, but there are obviously  a lot of options.

Now you can use the camera module to let you see into the area you are monitoring for temperature and humidity.  From another computer you can do something like:

ssh root@rpithon 'raspistill -o image.jpg'
scp root@rpithon:image.jpg .

Or have a cron job save a new file to the webserver on a regular basis!

In addition to the camera, there are lots of other peripherals and functions you can add to the Raspberry Pi, let your imagination guide you!

Comments

eduardo.correalima.50 (author)2015-02-24

Ok gang, a colleague of mine helped out with a python script of his own that works really well with this project. You can set your temperature thresholds, and if three consecutive measurements exceed those thresholds, then an email is sent out using Python's mail feature. Example of the email received is below.
-----

Temperature and/or Humidity Anomaly Detected!

Temperature exceeded threshold for 3 consecutive
measurements at 2015-02-24 16:25:00

Humidity exceeded threshold for 3 consecutive
measurements at 2015-02-24 16:25:00

-----

I don't know how to attach the python script to this post, but I should probably make it available to wpnsmith so he can include it as an option.

Great, PM it to me and I'll figure out how to include it.

Thanks!

DanialH1 (author)wpnsmith2015-11-22

can u send me the script?

I can. Send me a private message and I will email you the python script for email alerts.

Hi Eduardo.

Will it be possible to send me the python script? I'm conducting a student project on the same topic and will be glad to have it as a reference.

You can mail it to me at qwamedusei@gmail.com

fallen293 (author)2014-05-22

Excellent guide! Thanks for doing this.

Quick question for you:

I was going through the code and I have been trying to figure out how instead of having the y axis go in increments of 20, could I have the scale be in increments of 10? (Still going to 100)
Thanks again!

wpnsmith (author)fallen2932014-06-05

Good question! Sorry for the delay, the answer is well hidden. 8*)

in GraphTh.py after the line:

plt.axis(ymax=100,ymin=0)

add

plt.yticks(numpy.arange(start=0,stop=100,step=10))

MichaelS1334 (author)2017-07-03

This is pretty dated and some links are broken. Any way to get this updated from original and all the comments and moved files for Raspberry Pi 3?

wpnsmith (author)MichaelS13342017-07-03

Yeah, it's been a few years, and I've changed the sensor and rebuilt it on the latest Jessie release, but finding the time to redo the Instructable is now the hard part. It's amazing how much time something like that takes...

It's on my list of projects, but I've got tradeoffs between building Instructables and hacking my own projects....

When I get a Round Tuit 8*)

teroenza (author)2015-12-09

I can't get it to start TH.c when it boots. It's pretty confusing since my rc.local file is essentially empty except for the /root/th >>
/root/th.log & entry. I can tell it to print to the screen before and after that line and it does that just fine, and I can start the program manually after it boots up.

ZackH8 (author)teroenza2016-01-21

I'll say I had an issue with mine as well. I'm assuming being this recent you're running the newest image of Raspbian (Jessie), which is apparently known to have issues with certain things running out of the rc.local file (other comments below recognizing this, but not with any real solution). However, the issue I saw was not the rc.local file not running, it was that the file would run at boot but wouldn't actually read from the sensor. When I ran the tail cmd I would get that it was just printed up to the "Sync to cycletime..." message into the logfile but none of the temp entries -- and no entries were being added to the database. To get around this issue, I created a systemd service file and have enabled it to run at boot that way. This required modifying the th.c file to create a daemon as well. If you need any help figuring it out, let me know.

altralosix (author)ZackH82016-03-30

If you could tell me how you did this I would greatly appreciate it.

scalimani (author)altralosix2016-04-03

Hi,

in rc.local use this syntax:

/root/th > /root/th.log 2>&1 &

With "2>&1" you are redirecting errors to "th.log" together with normal output. In this way I saw that the problem was with mysql socket, basically I think that MySQL was still not running when th started.

I solved adding a delay in "th.c" before connecting to the DB. Just add line "delay(60000);" before line "MYSQL *con = mysql_init(NULL);"

It works for me!

kramsnosrap (author)scalimani2017-03-16

I'm having the same issue (having to manually start th.c "./th" to get everything up and running.

I added the 2>1 to my rc.local file, and now my th.log is giving me the error:
"Can't connect to local MySql server through socket".

I added the "delay(60000);" in the line listed above, but no change.

Any ideas?

kramsnosrap (author)kramsnosrap2017-03-16

This was fixed by adding "sleep 10" to line above th>>th.log in /etc/rc.local file, fix given below for me.

newechelon (author)2016-02-13

I was having an issue after reformatting my drive and rc.local seems to not be running.

After looking, this can be updated by adding

"sleep 10" before the execution:

/root/th >> /root/th.log &

kramsnosrap (author)newechelon2017-03-16

Thanks for this, seems to have fixed the MySql failed socket connection on boot.

JayV36 (author)2017-01-14

How do you connect the sensor to the pi?

RonnieB32 made it! (author)2016-12-22

Works great. Thanx for the write up. I need the code to email alert as well please. Also how can i change it from C° to F°?

wayne.clements.16 made it! (author)2016-12-02

I really enjoyed building this. I built 2 of them, and the worked great for a year. I updated when Jessie came out, and they no longer worked. I tried to patch them up, but was unsuccessful. Now I would like to try streaming video, but want to be sure it is going to last through time. Does anyone know a really stable way to stream video from numerous Raspberry pi computers to a web browser? I am monitoring with stills every minute, but want to go video. I have 5 cameras. Will have at least 8.

cold_fashioned (author)2016-11-22

I upgraded to MacOS Sierra and now I can't view my temperature / humidity graph. Has anyone else run into this problem and have any tips on how to go about fixing this? I might just have to give up on my TH sensor project, and re-purpose this RasPi for something else. Bummer.

wpnsmith (author)cold_fashioned2016-11-22

So what error are you getting? It's possible there's a (m)DNS or Bonjour lookup problem, try going to http:// instead of http://name.local

cold_fashioned (author)wpnsmith2016-11-23

I get a screen that says "This site can't be reached... pitemp's server DNS address could not be found."

Thanks for your help!

I followed some instructions on how to re-setup apache2, etc. in Sierra, and that didn't seem to work. Then, out of the blue, I went to my graph site and it was back, working again. Can't explain it, but I'll take it!

ShelbyGTH (author)2016-11-10

Hi, I have a couple question for you.

I am getting stuck on the th.c bit. I have created the file in my root dir and when it hit make th i am getting this. Any Idea's?

root@raspberrypi:~# make th

cc th.c -o th

th.c:26:2: error: invalid preprocessing directive #defineRHT03_PIN7

#defineRHT03_PIN7

^

th.c: In function ‘finish_with_error’:

th.c:34:3: warning: incompatible implicit declaration of built-in function ‘exit’

exit(1);

^

th.c: In function ‘main’:

th.c:93:27: error: ‘RHT03_PIN’ undeclared (first use in this function)

status = readRHT03 (RHT03_PIN, &temp, &rh);

^

th.c:93:27: note: each undeclared identifier is reported only once for each function it appears in

<builtin>: recipe for target 'th' failed

make: *** [th] Error 1

root@raspberrypi:~# ./th

bash: ./th: No such file or directory

Other question is it possible config a second sensor to it? and if so how?

Thanks

NLseb (author)2016-11-05

Awesome Tutorial! It is working well.

I was wondering how I can get the current temperature en humidity printed on my PNG. Can some help me out?

josh-ellis (author)2016-10-06

Could you possibly make a raspberry pi device that you could plug into your pc to display the pc's Core temp / clock speed / utilization in real time... output to some cool display made of nixie or neon tubes?


I think that would be totally bad as, and useful for gamers who don't want to tab out of a game to check hardware monitor or whatever

BQZ made it! (author)2016-09-02

Just completed this.

Very pleased with the results.

Couple of alterations I had to make are; -

1. Ran the following to get ez setup - wget https://bootstrap.pypa.io/ez_setup.py
-O - | python

2. Had to enable root login

sudo nano /etc/ssh/sshd_config

look for

PermitRootLogin without-password

change it to

PermitRootLogin yes

3. Used scalimani solution to delay startup. as was generating SQL errors without it.

But all in all an excellent article. Thanks to all contributors.

day_of_the_sometimes (author)2016-08-11

Hi! I'm pretty far along on this, but the python script seems to be unhappy with something I have done. When I attempt to run it to verify that I'm on track, I discover that I am not when it returns as follows:

python GraphTH.py

GraphTH.py V1.69 12/04/2013 WPNS Thu May 19 03:51:15 2016 Samples: 18, DataPoints: 3 Anomalies: 0

Traceback (most recent call last):

File "GraphTH.py", line 93, in <module>

plt.savefig(FileName)

File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 577, in savefig

res = fig.savefig(*args, **kwargs)

File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1470, in savefig

self.canvas.print_figure(*args, **kwargs)

File "/usr/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 2194, in print_figure

**kwargs)

File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 526, in print_png

filename_or_obj = open(filename_or_obj, 'wb')

IOError: [Errno 2] No such file or directory: '/root/Graph/graphics/TH.png'

Only one diversion from directions to admit: I was getting by on "sudo" for a good part of this project even though the instructions said to run as root. I noticed no issues, though.

Anyone able to help me out?

Did you create the /root/Graph/graphics/ directory (or if you are running with the pi user, it's probably /home/pi/Graph/graphics/ but then you have to fix the code...

Thanks! I ... should have taken it as a sign to review when I needed to say "the only part of the directions I didn't follow was X, but I never compensated for this change." Awesome project!

JürgS3 (author)2016-08-04

Good morning!

I tried this project and it works really fine. I got just one last question. Under http://IP Adress/TH.png i can see the value from the last 18 hours.

Is there a option to display the values weekly, monthly or through a year? I don't like to open the database, i'd like to have it graphical

wpnsmith (author)JürgS32016-08-11

Sure, modify the SQL to get the data for the last (60*60*24*32) seconds (32 days), and then tweak set_major_formatter and set_major_locator for something like %m%d and matplotlib.dates.DayLocator

alebadywallaa (author)2016-08-10

Excuse me . can we use ( wifi )instead of PoE splitters???

wpnsmith (author)alebadywallaa2016-08-11

Umm, sure? Go right ahead, there are lots of WiFi setup totorials around, and the Pi3 even has built-in WiFi. Get a good power supply, if you see the power LED flickering or flashing, that's an indication that your power supply doesn't have enough capacity...

JürgS3 (author)2016-07-28

Hello everybody
I like this project and that's why I bought a pi. I tried to install but i failed. Can you help me?
I came up to step 8, my last successful step was:
emacs makeFile
change the two lines below to match this:


INCLUDE = -I/usr/local/include,/usr/include/mysql

LDFLAGS = -L/usr/local/lib,/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -lrt -ldl

Now copy th.c (included here) into your default directory. Change the password on line 68 from "password" to whatever you chose as the MySQL password.
But i can't find in "password" in the file.

wpnsmith (author)JürgS32016-07-28

What do you see on line 68 of the th.c file? It should look like:

printf("rh.c rev 1.79 12/04/2013 WPNS %sCycle time: %i seconds, %i retries\n",ctime(&oldtime),CYCLETIME,RETRIES);

fflush(stdout);

MYSQL *con = mysql_init(NULL);

if (con == NULL) finish_with_error(con);

if (mysql_real_connect(con, "localhost", "root", "password",

"Monitoring", 0, NULL, 0) == NULL) finish_with_error(con);

JürgS3 (author)wpnsmith2016-07-28

Ooh i see the mistake! I opened the Makefile and edit the two lines (INCLUDE & LDFLAGS). After that i searched line 68 in the same file.
Now i closes the Makefile but i can't find th.c, can you tell me how i can find it?

Khord (author)JürgS32016-07-30

th.c is attached to that step in the Instructable

JürgS3 (author)Khord2016-08-03

Thank you very much! I transmit the file with WinSCP and it works!

Unfortunately i'm hanging on Step 9 :-/
I can not access http://IP-Adress/TH.png or http://PI02/TH.png i just get the error 404 page not found.
Unter /var/www is a file named TH.png and a folder called html. I reboot my Pi but it didn't helps so i restarted the project on another sd card. The error is still present. When i try to access http://IP-Adress it will show me the Apache2 Debian Default Page


This was the last step i did:
root@PI02:~/Graph# python GraphTH.py
GraphTH.py V1.69 12/04/2013 WPNS Wed Aug 3 06:50:23 2016 Samples: 8, DataPoints: 3 Anomalies: 0 Copy to Web Server... Done at Wed Aug 3 06:50:24 2016

wpnsmith (author)JürgS32016-08-03

Two possibilities:

if your Pi is named Pi02, then try http://pi02/TH.png or http://pi02/TH.png

Later releases of Raspian put the web server files in a subdirectory, so change this line in GraphTH.py:

Destination = '/var/www/'

to:

Destination = '/var/www/html'

JürgS3 (author)wpnsmith2016-08-03

The first i tried but the seccond one works! Thank you very much!

Khord (author)JürgS32016-08-03

Oops, see that the author has already replied, disregard

Khord (author)JürgS32016-08-03

The structure of the webserver has changed since this instructable. You will need to adjust any scripts that place files in /var/www to place them in /var/www/html.

RatnakarV1 (author)2016-07-08

Hi , I am not able to locate the code for SRC folder for .C files which we can see in M akefile.

https://github.com/jervine/rpi-temp-humid-monitor

Can you please let me know where I can see these files.

blink.c blink8.c blink12.c \ blink12drcs.c \ pwm.c \ speed.c wfi.c isr.c isr-osc.c \ lcd.c lcd-adafruit.c clock.c \ nes.c \ softPwm.c softTone.c \ delayTest.c serialRead.c serialTest.c okLed.c ds1302.c \ lowPower.c \ rht03.c piglow.c
wpnsmith (author)RatnakarV12016-07-28

Sorry for the delay, those are all part of the WiringPi installation

Evannpz (author)2016-06-07

cool!,can you send me the Python Script?

Evannpz (author)2016-06-07

cool!,can you send me the Python Script?

thashiznit2003 (author)2016-05-27

for some reason, I can't get the th file to run on bootup. I've tried crontab, and rc.local, and even removed the part where it writes to the log file, and nothing. Can anyone help? It runs fine when I manually start it.

AaronD71 (author)2016-05-18

I couldn't, originally, get the wget ez_setup link to work -- for reference, I found it here: https://github.com/pypa/setuptools/blob/bootstrap/ez_setup.py where the project is upkept.