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 reply to Re: Web moniitoring with Perl, comments and suggestions on general approach please by stevieb
in thread Web moniitoring with Perl, comments and suggestions on general approach please by predrag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.