Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Logging temperatures using RRDTool and Highcharts

Sat Nov 03, 2012 7:23 pm

I am using my RaspberryPi to record temperatures and humidity in my apartment. After recording I generate nice charts using the HighCharts library. The result looks like this:
Image

You can check out the project, including a little write up, at: http://pi.tafkas.net/temperatures/

Any feedback is welcome.
Last edited by Tafkas on Thu Jun 05, 2014 4:31 pm, edited 1 time in total.

cisasteelersfan
Posts: 3
Joined: Sat Nov 03, 2012 7:44 pm

Re: Logging temperatures using RRDTool and Highcharts

Sat Nov 03, 2012 7:47 pm

That is really awesome! Great graphs! I'm working on setting up a temperature logger for my house. I think I'm going to use the DS18B20 temperature sensors. I'm taking calculus in school so I want to apply that by finding the slopes of the heating and ambient temperatures inside vs outside. Like see how outside temperature affects the temperature inside, see how long it takes to drop a certain temperature, etc.

One question: what theme/template is that for your website? It's very clean, I love it!

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Sun Nov 04, 2012 11:37 am

cisasteelersfan wrote:One question: what theme/template is that for your website? It's very clean, I love it!
The template is provided by Twitter Bootstrap. Either get it from them directly at http://twitter.github.com/bootstrap/ or look at http://www.initializr.com/

lumav
Posts: 3
Joined: Tue Nov 13, 2012 10:00 am

Re: Logging temperatures using RRDTool and Highcharts

Tue Nov 13, 2012 10:15 am

Hi Tafkas.Very nice job!.
I like very much your graphs.
I've done a similar project using DS18B20 sensors.
I've followed succesfully your guidelines up to the generation of xml's but I'm having some trouble on rendering the graphs properly through Highcharts.
I think I'm missing some code with options definitions under $(document).ready(function(). Will you be so kind to share the missing part of code to make it work.
Many thanks.

lumav
Posts: 3
Joined: Tue Nov 13, 2012 10:00 am

Re: Logging temperatures using RRDTool and Highcharts

Tue Nov 13, 2012 5:14 pm

I found the missing code in js/chart.min.js
Graphs are coming out nicely.
Thanks!

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Mon Nov 26, 2012 8:44 pm

Thank you for the kind words. I just played with the Javascript again and added a functionality that computes sunrise and sunset for the 24h, 28h, weekly and monthly chart. Then I use this information to plot vertical bands on the chart indicating the effects of the sun on temperatures (and humidities).

Image
Image
Image

You can check it out at: http://pi.tafkas.net/temperatures/index.html?1w

All information are computed on the client-side at runtime.
Last edited by Tafkas on Thu Jun 05, 2014 4:32 pm, edited 1 time in total.

lumav
Posts: 3
Joined: Tue Nov 13, 2012 10:00 am

Re: Logging temperatures using RRDTool and Highcharts

Wed Nov 28, 2012 10:51 am

Cool!!
Very nice sunrise-sunset add-on Tafkas.
I have a couple of questions for you regarding graphs.
Do you know why graphs with points over 1 hour are shown at odd hours (1.00,3.00, 5.00....) instead of even hours (0.00,2.00...)? Three months reports are shown at 1.00 and 13.00 instead of 0.00 and 12.00.
I've been trying unsuccesfully to change it. I believe is related to RRDtool and maybe UTC timing.
Another problem I've discovered is when drawing MAX or MIN graphs. I've tried with the yearly graph where just 1 point is taken for each day and it doesn't match with the expected results. Ideally the max or min temperature for a particular day (from 0.00 to 24.00) should show, but that's not the case. I guess this may be related with the starting time of the database creation which I guess also determines the intervals when max and min values are captured? THis may also be related to the previous issue.
Any clues on how to fix this?
Many thanks for your great work!

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Dec 04, 2012 11:39 pm

I put a Min-Avg-Max graph together real quick:
Image

I will tune it a little bit on the weekend when I have more time.
If you want to check it out live: http://thule.mine.nu/html/lastyearminmax.html

Hoagie
Posts: 120
Joined: Sun Sep 23, 2012 7:19 pm

Re: Logging temperatures using RRDTool and Highcharts

Wed Dec 05, 2012 7:12 am

Yfory wrote:Very cool, well done!

The USB device looks awesome, do you think it can receive data from WH1080 weather sensors? Commonly sold by Maplin in the UK... http://j.mp/YlEWmM
I had a PC recording graphs from a similar wireless weather station. However, I did it by intercepting the radio transmission and hacking the protocol. I'm looking to do it again with the Pi, but struggling to find the time. I'll post something if I ever get it going.

kenmc
Posts: 58
Joined: Fri May 04, 2012 8:02 am
Location: Dublin, Ireland

Re: Logging temperatures using RRDTool and Highcharts

Wed Dec 05, 2012 8:53 am

Check out http://www.susa.net/wordpress/2012/08/r ... nd-rfm12b/ for intercepting the data directly
http://goatstownweather.eu.pn

Levaillant
Posts: 18
Joined: Wed Sep 26, 2012 7:10 am
Location: France, Paris

Re: Logging temperatures using RRDTool and Highcharts

Mon Dec 10, 2012 12:55 pm

It's definitely awesome!

cdjaco
Posts: 18
Joined: Tue Aug 28, 2012 6:53 pm
Location: Colorado, United States

Re: Logging temperatures using RRDTool and Highcharts

Mon Dec 10, 2012 5:36 pm

Very nicely done. Thanks for posting the write-up!

Levaillant
Posts: 18
Joined: Wed Sep 26, 2012 7:10 am
Location: France, Paris

Re: Logging temperatures using RRDTool and Highcharts

Tue Dec 11, 2012 10:28 am

Code: Select all

       # Format data
       "{? line # 1, 1,} $" tmp = `echo | tr ',' ','`.
       data = `echo" $ {tmp% N% 0} "| sed 's / :: /: U :/ g' | sed 's / :: /: U :/ g'`
       data = $ data {%%}
       # Update rrd
       rrdtool update temperatures.rrd $ data
Sorry, there is one thing I really don't understand in your script.
Where did you set your data with the date parameter?
I think I've forget sommething...

Edit:
And I suppose you use a cron job, do you?

Levaillant
Posts: 18
Joined: Wed Sep 26, 2012 7:10 am
Location: France, Paris

Re: Logging temperatures using RRDTool and Highcharts

Thu Dec 13, 2012 12:15 pm

Ok, I finally understand the N:
rrdupdate N:value1:value2:valueN
N: means now...

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Sat Dec 15, 2012 10:19 pm

Exactly. You can either specify a time in seconds since 1970-01-01 or by using the letter 'N', in which case the update time is set to be the current time.

jschacon
Posts: 3
Joined: Sun Jan 13, 2013 11:11 pm

Re: Logging temperatures using RRDTool and Highcharts

Sun Jan 13, 2013 11:32 pm

Hi Tafkas,

great project!!I would like make one similar. Do you mind tell me the reference of the weather sensors that you had used for your project? I dont find them on the elv page. Did you buy them on http://www.elv.de?


Thanks!

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 22, 2013 3:03 pm

Hi all,

same question: Do-you have any feedback on the temperature/humidity sensors?

Which are best with Raspberry?
How many can you plug in your Raspberry?


Many thanks

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 22, 2013 3:43 pm

I use the USB-WDE1 receiver (link) and six sensors (link).

albundy
Posts: 31
Joined: Tue Jul 17, 2012 4:56 pm

Re: Logging temperatures using RRDTool and Highcharts

Wed Jan 23, 2013 8:04 am

Hi Tafkas,

I managed to add some DS18B20 sensors to the Pi and read the temperatures into a rrd database.
Exporting the data does also work. A cron job is filling the database every 5 minutes with sensor data.

But here ends my knowledge. I tried to figure out what to do with help of your website but was unable to produce something that worked.

I have no knowledge of ajax, java, html etc so I am lost at this point.
What do I need? Can you give me a step by step instruction what to do to get these awesome graphics?

Many thanks.

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Logging temperatures using RRDTool and Highcharts

Wed Jan 23, 2013 1:36 pm

I found this exemple to log data on a website...don't know if you did the same with your sensors?


I'd like to put one sensor in each room, so usb isn't really an option. It cost a lot and isn't suposed to cover 20m...

I think the 1-wire cables are better for that purpose. But if I want to record about 5-10 sensors, I guess RPI won't be enough. I'll have to buy a shield or Arduino... How have you done that?


And do you know a good 1-wire sensor that combine temperature and humidity?...and if possible, that can be put outside?


Thanks!

gglaspi
Posts: 1
Joined: Sat Jan 12, 2013 4:18 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 29, 2013 3:23 pm

Hi Tafkas,

Thank you ! I could set up the same config at home thanks to you !

I'm duplicating your http://thule.mine.nu/html/ pages for my personal use since they're just great, are you ok with this ?

jschacon
Posts: 3
Joined: Sun Jan 13, 2013 11:11 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 29, 2013 5:02 pm

Hi gglaspi,

Do you mind tell me the reference of the weather sensors that you had used for your project?


Thanks!

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 29, 2013 5:14 pm

gglaspi wrote:Hi Tafkas,

Thank you ! I could set up the same config at home thanks to you !

I'm duplicating your http://pi.tafkas.net/temperatures/ pages for my personal use since they're just great, are you ok with this ?
Sure, go ahead. I basically just used the Bootstrap Framework without any alterations: http://twitter.github.com/bootstrap
Last edited by Tafkas on Thu Apr 10, 2014 8:37 pm, edited 1 time in total.

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 29, 2013 5:15 pm

jschacon wrote:Hi gglaspi,
Do you mind tell me the reference of the weather sensors that you had used for your project?
Thanks!
Check out Post 17, where I put the links of the receiver and the sensors.

jschacon
Posts: 3
Joined: Sun Jan 13, 2013 11:11 pm

Re: Logging temperatures using RRDTool and Highcharts

Tue Jan 29, 2013 5:38 pm

Tafkas wrote:
jschacon wrote:Hi gglaspi,
Do you mind tell me the reference of the weather sensors that you had used for your project?
Thanks!
Check out Post 17, where I put the links of the receiver and the sensors.
ok. Thanks!

Return to “Automation, sensing and robotics”