Online temperature & humidity realtime data with DHT11 sensor and Raspberry Pi

UPDATE: take a look at this post (and 2)to see the new improved version of the device, using a DHT22, a light sensor, and sending data via Twitter

I found a great and detailed post about using the DHT11 humidiy sensor with Raspberry Pi and publish the data online.

I’ve made a little changes in case you don’t want (or you can’t) use your home Raspberry Pi as a wide open web server to make your data available on the net. In case you have a basic hosting service, the concept idea is to make a very simple (and not very secure in this example) web service to get and save the data, and use the crontab and wget utlility to call the webservice from your Raspberry Pi.

 

The super-basic web service to save data from Raspberry Pi to a file on your hosting server:

if (isset($_GET['data'])) {
	if (strlen($_GET['data']) < 40 && filesize("temp.log") < 50000000) {
		file_put_contents("temp.log",$_GET['data']."\n",FILE_APPEND);
	}
}

And here the line you must add to crontab to send the information from Raspberry Pi to your internet server:

* * * * * wget [YOUR_WEBSERVICE_URL]?data=`date +\%Y\%m\%d\%H\%M\%S`,`/home/pi/dht11`

 

DHT11 sensor realtime information

DHT11 sensor realtime information

Posted in Concept, DIY, Internet, PHP, Programming, Raspberry Pi Tagged with: , , ,
0 comments on “Online temperature & humidity realtime data with DHT11 sensor and Raspberry Pi
1 Pings/Trackbacks for "Online temperature & humidity realtime data with DHT11 sensor and Raspberry Pi"
  1. […] publish the weather data on the web you must follow my old DHT11 post and this one, but you must change the original DHT11 C program to the new DHT11/22 python […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*