Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: 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 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found