Logging Data From Pink Web Page
Ralph Turner
Posts: 7
I am using a Basic Stamp 2pe to communicate data from several digital and analog sensors to a PINK embedded web server so that I can monitor the data from a web page on my local area network. We operate several greenhouses at our farm in Maine, and it is important for me to be able to monitor the operation of the heating systems in the winter from inside our home. The sensors, stamp, and PINK are located in the greenhouses and the pink is connected to our local area network through a Cat 5e cable that runs in conduit about 200 feet underground to our house. This part works great. I can remotely monitor the current state of any sensor from a web page. I would like to log the data that I can view on my browser onto that same computer. It seems that if I can see the data on a web page on my remote comuter I shoud be able to log it somehow. From research on the web I understand that no HTML code exists to write data from a page into a file. I am a beginner at programming VBA and have no experience with Java, but I am more than willing to learn. Can anyone make a suggestion for how to store the data to .csv, .xls, .xlm or any other format that I can use to evaluate the historical trends and determine the exact time of failure, alarm, or operational events after the fact. I could log the data to a thumb drive using the memory stick dtata logger, but that would require going to the greenhouse to swap the thumb drives. I'd like to be able to know when something failed before I go out to the greenhouse. Thanks.
Comments
I'm just across the border in New Brunswick so I know your weather is probably cooling off fast, so I'll give you a quick solution. It isn't the most elegant solution but is cheap and I'm sure some other suggestions will pop up before too long.
Essentially, get the data from the Stamp to be sent serially to a computer running Hyperterminal which has been put into the "log" mode. This won't interfere with the presentation the PINK is doing. The data received by Hyperterminal can be imported into Excell for analysis and graphing.
The serial data can be sent to the house over a spare pair in the CAT5 cable, or you can use a set of wireless transceivers from the greenhouse to the house. I'd set up the logging on an old laptop or PC.
Cheers,
Good question, this is a common enough pattern tha most app servers and google do this. For yourself, you can write a small program in a Net capable lamguage like C#,Java or VB.NET that reads from a URI and either stores and parses or parses the input stream from any web content on the fly. This is called web scraping or other names.
I had a similar use case to yours where i needed to parse out bugs from a web based query that i was working on.
The java based web "robot" does this every 5 min and sends the data to a propeller based LED display.
http://javahardware.blogspot.com/2010/11/led-display-board-driven-by-javaxcomm.html
So this is just one of many ways to do this, your program could just write out a text csv instead.
Ralph: if you look at ApplicationService in the link above (the web crawler) you will see how to use HttpURLConnection to read/parse the inputstream from the URL object which would point to your page.
Thank you
Michael O"Brien