RaspberryPi Remote Temperature Sensing
Well I finally got around to setting up an I2C device properly on the RaspberryPi, in this case a PCF8591 4-input analogue-to-digital converter (A/D for short). The PCF8591 is easy to communicate with and has 8-bit resolution so it is okay for basic applications.
Now the fun part! The Python script reads the PCF8591 and if the voltage on input '0' has changed it prints it out, but also writes this out to a file called 'liveData' which just happens to be in the Apache 'www' server directory. There is also a neat AJAX JavaScript file called 'reloader.js' lurking in there and an HTML page to wrap it. The re-loader goes back to the server every 5 seconds and updates the value in 'liveData' which is a representation of the temperature.
Voila, a remote temperature sensing device that only needs to be in range of the wi-fi access point to serve live temperature data out over the Internet.
The only problem I'm having is setting up the D-Link router to give external access to the RaspberryPi server. I can test everything okay using the internal IP address of the RPi, which I have made static, but until I figure this one out, I can't read the data from Ulan Batur, Tomsk or Easter Island.
I have also managed to get the No-Ip client working in Linux and have a domain name set up so it would be nice to be able to go to my domain, click on a 'Home Temperature' link and see live data. I'll get there eventually.
UPDATE - This works fine online. I needed to test it using a 3G 'phone because my router doesn't allow Internet loopback so you can't test the server as if you were out in the big bad world if you are on my local network. Anyway the NO-IP client works fine and sets up my URL to follow the dynamic IP address automatically and the temperature is displayed and updated online. Sweet!
ReplyDelete