I've been working on bits and pieces of a project to be able to record and view data in near real time for the last few months. It's one of those things where each layer has its own set of challenges and is written in its own language. But I finally put all the pieces together this week.
I used what hardware I had laying around, which turned out to be an arduino and a light dependent resistor (LDR). The light dependent resistor is exactly what it sounds like, a resistor that changes resistance depending on how much light shines on it. This effectively makes it a light sensor. I attached the LDR and a resistor to one of the analog pins on the arduino and wrote some code on the chip to read the value or the LDR and report it when asked over serial/usb.
Then I wrote a script in python to ask the arduino how much light the LDR was reading and take the answer and dump it in a database. I scheduled the script (with cron of course!) to run every 2 minutes. Then I wrote a webpage in php that read the last 36 hours of data in the database and drew a graph of it.
If by now you're wondering “why?”, because it's fun. And also it's practice. I would like to get more interesting sensors; I already have some temperature sensors in the mail. It's been hot recently and I've often wondered just how hot it gets in my room, perhaps in comparison to how hot it is outside. But there are many more options, cloud sensors, power consumption, wind speed, sound, the list goes on. Now I have the infrastructure in place, all I have to do is think about what kind of data I would like to see.