Sheepdog Software HOME  »  ArduServer & ArduSimpSrv HOME
Delicious.Com Bookmark this on Delicious    StumbleUpon.Com Recommend to StumbleUpon

ArduServer "Watcher" program...

Automatically, periodically harvests data
from an Arduserver across the internet or on a LAN

For some time now, I have had Arduinos on the World Wide Web. You can visit some of them, if you like (at least one of them is usually "up"... sometimes all of them!)

Each is a tiny remotely accessible "node" in the "internet of everything". You can see the values being reported by sensors on the Arduinos; you can turn an LED on the remote Arduino on or off. The Arduservers just illustrate what is possible. (If you can change the state of an LED, you can do much, much more, if you replace the LED with something else.)

However, this page has nothing to do with the Arduservers' output facilities.

This page gives you access to a free VERY CRUDE program to fetch data from Arduservers. Automatically. Periodically.

And the data is passed to a text file, nicely formatted for pasting into a spreadsheet or other, for data display and analysis.

The free program isn't very flexible. But, it works.

It needs your Arduserver to create, as the 7th line of the html it generates, something like....

(You can point the program at my Arduserver on...

http://mon7nc.dyndns.org:81

... for SHORT tests (no more than an hour, please) to see all is working, if you like.

The data in that line parses as follows. The width of each field never varies, leading or trailing zeros are added, by the Arduserver, as needed.

5035+268702491023

... or, with spaces not present in the data line, as returned inside the html...

5035  +2687  0249  1023

5035: Number of times Arduserver has been accessed since re-booted.

+2687: Current temperature is +27.87 degrees Celsius.

0249: Reading on one of the analog inputs to the Arduino. On the one at mon7nc...:81, that, at September 14, is outdoor light levels, arbitrary units.

1023: Reading on another of the analog inputs to the Arduino. On the one at mon7nc...:81, that, at September 14, is outdoor light level experienced by a phototransistor opposite the LED users can turn on or off, arbitrary units.

So! That's what you have to provide in your Arduserver, if ArduWatcher is to "do its thing", in its present, crude form.



Here is what you see when the program runs. Don't try to puzzle it all out. There's an explanation below the graphic.

-

The program is new. I've admitted it is crude. It is free. In other words: Use it if you like, don't "moan" (or judge my other software by this!) if you don't like what you see or find.

The "Do It Now" button would make the program try to take a reading, put data in the output file. You don't HAVE to click it.

The "Do Now and..." tick box is always ticked at this time. A reading is taken when the program launches, and periodically thereafter. You can't "see rems".

Where it says "laBHrNow", I think the hour, as understood by the program (taken from the system time of the computer ArduWatcher is running on) will appear, and change, each time the hour of the day changes.

In the edit box holding "index.htm" in the example above, you put the name of the page the Arduserver you want to access returns.

In the edit box holding "http://mon7nc.dyndns.org:81" in the example above, you put the URL of the Arduserver you want to access. Something like 192.168.0.143 would work if you had an Arduserver on your LAN at that address. You may or may not need something like ":81" at the end of the URL, depending on how you have your Arduserver set up.

The long line... "C:\Users\TBoyd...." should tell ArduWatcher where you want the data written. Note the separate edit box with ".txt" to establish the output file's name. At the present time you will probably get a file called "LDN026 clone2 harvest-FROM-yyyymdd-hhmm.txt, in the folder you've put the .exe in. At least the yyyymdd-hhmm will be replaced with a datestamp, as discussed below. (Remember: The program is free!)

Besides what you specify ("Tmp.txt" in the example above), (which for the moment is ignored!) the program WILL (even in this version) add a date/time stamp to the filename, e.g....

Tmp-2015320-0917-055.txt

... for a file harvested in the year 2015, 3rd month, 20th day. Note that each of those will always occupy 4,1 and 2 characters respectively, Oct, Nov, and Dec specified with a, b and c.

Then we have the time of day... 4 digits, and seconds and tenths, as I recall... 055 signifying 5.5 seconds past 9:17(am) in the example. (The datestamp reflects when the data in the first record in the file was collected.)

MAJOR annoyance with current version of the program. It "works", but...

The datafile is only started, and only subsequently updated each time the time of day is "00", "20" or "40" minutes past the hour. Yes, this should (and could) be fixed. The program is free. Don't moan.

I BELIEVE the "record from/ to" specifications are respected by the program.

The program... currently!... accesses the Arduserver it is Watching once a minute.

Over time, an output file like the following builds up....

Product of LDN026-clone2, ver:3 Nov 14 All fields are fixes width.
Data is as follows... Datetime of record-compressed,
Date of record, Time of record (these two repeat, with less precision, data already presented
... and then the other data of the record...
cccc,stttt,aaaa,bbbb, where....
c is clicks of Arduserver since last boot,
stttt is temperature: s=sign (+/-), tttt is tture in centidegrees C
aaaa is reading from 1 ADC, probably outdoor light level
bbbb is reading from second ADC, probably level of light on LED.
yyyy,mm,dd,hh,mm,ss,t,dd/mm/yyyy,hh:mm,cccc,stttt,aaaa,bbbb

2015,03,27,15,50,45,1,27/03/2015,15:50,1987,+2575,0460,1023
2015,03,27,15,50,46,7,27/03/2015,15:50,1988,+2568,0460,1023
2015,03,27,15,51,01,6,27/03/2015,15:51,1989,+2568,0464,1023
2015,03,27,15,52,01,0,27/03/2015,15:52,1990,+2568,0468,1023
2015,03,27,15,53,01,7,27/03/2015,15:53,1991,+2581,0468,1023
2015,03,27,15,54,01,1,27/03/2015,15:54,1992,+2581,0470,1023

(The headers don't "grow", but more and more lines like the last shown are gradually... in batches, every 20 minutes, added to the file.)

The three memo boxes between the label "Currently hardcoded to..." are just "windows" on what is happening. First is a log of messages from the system to the user. (That log is not saved anywhere).

The second is a look at what the data file will look like. Recent records may not yet be in the data file.

The last is a raw dump of the most recent data harvest from the Watched Arduserver.



It works. It is free. However "imperfect"

I wrote the program for my own purposes. That time is re-paid.

I doubt you appreciate just how much extra work it is to provide you with a page like this, a way to download the program, etc.

A little of your time exploring my other pages, Facebook "Liking" something, mentioning something in a forum, blog, etc., would be appreciated. If you've read this far, it can't be complete rubbish. There is no point in me writing these things if no one knows they are here. After many years of doing them, I am beginning to conclude that they are rubbish, and that I should turn to other pursuits.

You only need to click here to download 'LDN026.exe' the complete, compiled, .exe. (The program only runs on Windows.) Yes... you will have to set up an Arduserver, and have it produce the comment line in the format and place described above, if you want to use the program to collect data that means something to you. (I've also put it on my server as LDN026._xe in case your environment doesn't like downloading .exe's. I may forget to update the ._xe version if I update the "main" file, but I'll try not to. At 03 Apr 15, you should get "vers 3Apr15" in the title bar of the program when it runs.)



Program created with...

The program was created with Lazarus, a free, multi platform, general purpose programming language with many commonalities with the outstanding Delphi. I am an advocate for Lazarus, for kids, hobbyists, and more obligated people. It made use of a free TCP/IP library from Synapse... see http://wiki.freepascal.org/Synapse.



Contact this page's editor, Tom Boyd


Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org.

- - - Page ends - - -