"be consistent" | |
PerlMonks |
Re: Web moniitoring with Perl, comments and suggestions on general approach pleaseby stevieb (Canon) |
on Jan 23, 2017 at 23:49 UTC ( [id://1180188]=note: print w/replies, xml ) | Need Help?? |
You may be interested in App::RPi::EnvUI. It's a Dancer2 application that uses several external sensors (hygrometer, moisture etc) on the Raspberry Pi, with built-in async timers to fetch the data from the sensors, turn on/off fans, humidifiers when limits are reached, with a jQuery one-page front-end, with statistics graphing for temp/humidity. It also provides basic authentication for the "routes" that perform write operations. The data is stored locally on the Pi in the above cut, but it'd be trivial to write to a remote DB backend. Even though the code isn't yet finished (as I'm still writing drivers for some sensors), it definitely works (as I'm using it currently in one of my grow rooms), but it might give you some ideas... update: This software writes to the DB at least once every three seconds per sensor (by default), which doesn't include incidental writes (user toggles a UI switch, background maintenance etc, so there could be ~10 writes/sec or sometimes more), and reads happen every three for every browser pointed to the site. It's on an SQLite DB, running off of a micro SD card and it's been in operation for nearly six months. Specs for the DB server and front-end web server will be determined by the speed of data transactions, and the number of visitors to the site (amongst other things). Because my app is essentially for me, it's quite speedy even on the RPi hardware, but I've at most had four different browsers to it open at once. In essence, what you're wanting to do can most certainly be done in Perl (the backend and web front end for sure), and depending on the microcontroller, the sensors can be driven in Perl as well (in my case, Perl API that wraps over my (and others) C code that interacts with the actual sensors). If you're using a literal microcontroller (ie., eg: Arduino) that can't run Perl, the C code can gather the data, and send it back somewhere else where it can be processed./update
In Section
Seekers of Perl Wisdom
|
|