Shop OBEX P1 Docs P2 Docs Learn Events
Logging Data From Pink Web Page — Parallax Forums

Logging Data From Pink Web Page

Ralph TurnerRalph Turner Posts: 7
edited 2010-11-27 13:43 in BASIC Stamp
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

  • stamptrolstamptrol Posts: 1,731
    edited 2010-11-26 07:30
    Hi,
    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,
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2010-11-26 09:18
    Could you log hourly averages, minimums, maximums into the BS2pe memory, and have a button on the web page to step back through values from memory on your web site, or to simply show a listing of historical values? 32k of memory in the Stamp can hold quite a lot of data.
  • Ralph TurnerRalph Turner Posts: 7
    edited 2010-11-27 04:03
    Thanks for the great suggestions. Ultimately, for convenience, I'm looking for a software solution. It has been suggested to me that I may be able to get the data by "scanning" the web page with java script and saving it to a file. Is anyone familiar with a programming technique like this?
  • obrienmobrienm Posts: 65
    edited 2010-11-27 06:17
    Ralph,
    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
  • Ralph TurnerRalph Turner Posts: 7
    edited 2010-11-27 13:43
    Michael, I just spent about 2 hours on the web looking at "web data scraping" and variations. I still don't know how to actually do it, but I'm confident that this is what I want. Any tutorial suggestions would be appreciated. Thank you very much!
Sign In or Register to comment.