Inexpensive remote wifi web server for data aq control

For stand-alone microprocessors

Inexpensive remote wifi web server for data aq control

Postby Doug Coulter » Fri Jun 20, 2014 12:37 pm

I have 4 buildings on my campus, and am "home alone" so I have to do a lot of hoofing around to just see if something is freezing (or about to), how the solar systems on some of them are doing (some are just fed AC power from the nearest other building that has it), how the water system(s) are doing, general weather, and so on. When you get older in this situation, sometimes you feel like you're in a race against time to automate some of this manual hoofing around and judging when to turn valves on and off or put sticks in a fire - or just hoofing around to see if that's needed. Sometimes the weather isn't nice around here for all that, sometimes there's good or bad water in the rain barrel, and sometimes the cistern either does or doesn't need that water - definitely if it's pollen and algae, we dump it out and don't use it, for example. It'd be nice to know the thermal time constants of the various buildings vs outdoor weather as well, and the time constants of the various woodstove outputs vs fuel, stuff like that, so I can anticipate and save myself wasted trips here and there, it's not always fun.

So, Digilent sells this Chipkit WF-32 board, that is a wifi board over a pretty nice pic CPU (tons more powerful, without drawing more power, than an arduino). This is the base of the project and seems to have pretty decent wifi range, along with huge amounts of other i/o onboard to hook various sensors and servos up to.

They also have their own dev environmentwhich is more or less a clone of the arduino one, but with the right stuff for this CPU. It doesn't work right here on 64 bit linux (with the defalut JRE, I've not tried with the oracle one) so I just built a virtual box 32 bit linux mint-mate-17-LTS appliance to do my dev work on, which runs on any machine here. Sadly, I cannot share that on this host, trying to do that and incurring a single slow download of the 2.6 gb file (eg me testing if it was OK at 4 mbit) was enough to get this site banned for "bandwidth abuse" on a plan I paid way upfront for for "unlimited bandwidth and storage" but evidently this host doesn't mind changing the rules without warning and without refunding the money I paid (hint, we might be moving to another host because one thing I won't tolerate is being lied to by someone who took my money already - and being shut down without warning for doing what I'd been doing for over a decade already).

At any rate, here's what the current page looks like. The "perpetual" link will be dead in the sketch provided here, as it was 16 mb+ to test concurrency of the web server and file system (takes forever to download), and there's this new limit on "unlimited" for the present at this host, so I had to take it out of the "content" subfolder.
WifiServer.gif
Homepage of the test server


And here's the MPIDE sketch for the board. It's a work in progress, obviously, but you can add CGI's (written in C++) till you run out of memory, and they can do just about anything you'd want. For now, the main one just lets you look at and download the contents of a /data folder on the WF-32 board, which presumably some other process is writing log files to - the main function of this thing. But it will be easy to add a dynamic webpage that shows all the sensor outputs, or something that commands a valve open or shut later.
WebServerReduced.zip
Without one pretty cool but very large animated gif
(1.92 MiB) Downloaded 263 times


People looking at any of my code should note that I use a magic symbol - @@@ - in a comment near anything not finished or that I consider a little dodgy. Search for that to find the pain points.
In this case, I also used a precomputed WEP key, rather than a passowrd, as it takes the wifi chip about a minute to calculate that. Obviouslyl, you'll have to customize that set of settings for your own access point.

Right now, not all the buildings have their own solar/UPS system, some are just fed from the nearest building that does, with AC power. So I'm building a couple of temperature compensated UPSs just for these guys with a gel cel and charger, which should run one of these for days even without AC power going to that building. Who knows? If power fails for some reason, that might just be when I want data integrety the most! I'll post that project separately, probably in another forum, since it has little or nothing to do with software, but a lot with electronics, the voltage tempco of sealed lead acid batteries, efficiency (always if you're off grid) and so on.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Inexpensive remote wifi web server for data aq control

Postby Donovan Ready » Fri Jun 20, 2014 12:57 pm

Doug, I've got decent bandwidth, 97% uptime, and about 1Tb of free storage, if you want to host some stuff remotely. Let me know.

Edit: Here's the copy that Doug was having trouble with. As of sometime next week my server's bandwidth will jump from 2.1 MB/s to 20 MB/s, so it will be easier then. Please let me know if there are issues. Moving it from workstation to server is slow, even at 100 MB/s, so be patient.

ArduinoIDE. zip
Donovan Ready
 
Posts: 239
Joined: Thu Apr 17, 2014 1:22 pm
Location: Austin, Texas

Re: Inexpensive remote wifi web server for data aq control

Postby Doug Coulter » Sat Jun 28, 2014 7:39 pm

Thanks, Donovan. What I shared on this thread is easy, just a small sketch. If you've got the big IDE/Virtual box .ova there, it should also be linked here: viewtopic.php?f=15&t=824, just so people can find it, and so Jonathan's servers don't melt - more is better for this fer sure.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA


Return to Embedded software

Who is online

Users browsing this forum: No registered users and 1 guest