G+_Travis Hershberger Posted July 23, 2015 Share Posted July 23, 2015 So, anyone here used a Raspberri Pi and a temp/humidity sensor to get a web server displaying historical temp/humidity values? I'm thinking of using Adafruit's HTU21DF for this. Link to comment Share on other sites More sharing options...
G+_Taylor Graham Posted July 23, 2015 Share Posted July 23, 2015 +610bob did something similar not long ago (using a beagle board) https://plus.google.com/+610bobdotcom/posts/RzvR3ccsiSC Link to comment Share on other sites More sharing options...
G+_610GARAGE Posted July 23, 2015 Share Posted July 23, 2015 Taylor Graham Good memory. Travis Hershberger Basicly, what you need to do is to find the driver for your sensor. That driver will basically create a file for you to read ( because linux is great! ). Then you need create a server program that will read the sensor and log it. Then create a php script that will connect to the server over tcp to grab the results ( I like the zeromq library but any should do). Then using Javascript, graph the results from the php script and display it. I know, it seems like a convoluted way of doing it, but thats the web for ya. :) If you want my source, just let me know and I'll pop it onto github or something. Just be warned, I may have forgotten to go back and comment it. :) If your main goal is to plot out temp/humidity. You may want to give this website a look: https://plot.ly/ I belive they have an api for devices to update graphs. Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted July 23, 2015 Author Share Posted July 23, 2015 610bob I need to keep everything "in-house" as I possibly can, lawyers, uck. I'm planning to use the sensor parsed to a simple csv file. From that I'll take the information and do things like make graphs and such from it. It's an i2c sensor, so hooking it up to the pi is easy. Adafruit only has code for the Arduino on their web page, which should work with a little futzing about with it. Link to comment Share on other sites More sharing options...
G+_610GARAGE Posted July 24, 2015 Share Posted July 24, 2015 Just curious, would it be easier if you just use an arduino and just swap out sd cards? Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted July 24, 2015 Author Share Posted July 24, 2015 Possibly. I figured with the pi I could incorporate the web server directly. Link to comment Share on other sites More sharing options...
G+_610GARAGE Posted July 25, 2015 Share Posted July 25, 2015 Yea, but development time for an arduino would be less than an hour. Reverse engineering the driver may take a few days. But I guess it would depend on how long you plan to use it and how fast of a programer you are. Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted July 25, 2015 Author Share Posted July 25, 2015 Correct me if I'm wrong, but it's possible to run compile code written for an Arduino on a Pi, right? After all, it's mostly standard C code with the communication bit pre-configured for you. Link to comment Share on other sites More sharing options...
G+_610GARAGE Posted July 25, 2015 Share Posted July 25, 2015 Yes its C, but its not always standard. I find that the arduino api is deeply entrenched into arduino libraries. If it's fairly simple operation, then yea, just supplement your own functions that the library requires. But if it requires a ton of arduino functions, then it can turn into a migraine quick. You also have to take timing into consideration. I see a lot of libraries using NOP for super short, accurate delays. Which won't work in a linux, or any real time operating system environment. I usually find reverse engineering to be better in a situation like this rather than porting. But keep in mind, I have only done something like this (using arduino code as a jumpstart) once or twice. So I might be missing something. I also havn't looked at the library in detail, so I could be totally overthinking this. Link to comment Share on other sites More sharing options...
Recommended Posts