Bulding Automation & Sensor aquisition : Reccomendations for general approach

Hi all,

I currently have an arduino Mega controlling via RS485 a number of relays around the building as well as polling an increasing nummber of sensors also scattered around the building ranging from temperature , humidity, air quality etc.
At the same time the same arduino stores the sensor values into RAM and posts them on a website.

As the number of sensors increase, the workload is stretching the resources and therefore am reconsidering the whole system from the beginning.

I am thinking of having a dedicated arduino for sensor polling (front end) which would then save all collected data on mysql database hosted on a Win Server 2008 machine.
Then another arduino can pull data from the database and run a webserver for data presentation.

This way I could even see historical data which is something not avalable right now since the Arduino Mega only holds the last values collected.

I would love to have your comments on the above approach and any reccomendations you might have.

Please also note that I have absolutely no experience with mysql and I never came anywhere near it so far!

I am currently reading of how to use XAMPP!

Any guidance welcome :slight_smile:

Hi,

Watcher:
I currently have an arduino Mega snip stores the sensor values into RAM and posts them on a website.

You say "posts them on a website", do you mean the Mega is serving the web pages ?

I am thinking of having a dedicated arduino for sensor polling

Ok, you could, of course, have more than one of these POSTing stuff to a database in JSON format perhaps.

mysql database hosted on a Win Server 2008 machine.

You seem to be moving from a "just leave it and it runs" Mega, to something which may need a lot more time and management... just a thought.

Then another arduino can pull data from the database and run a webserver for data presentation.

Don't know why you would want to do this when you have a perfectly good Win Server with the database already in it.

This way I could even see historical data which is something not avalable right now since the Arduino Mega only holds the last values collected.

Ah, I think I see now, the Mega stored the last 'n' values and served 'em up.
Back to my point about the database; This happens a lot: We've got a database now... lets store everything, forever... things get slower and disk space gets eaten up and...

I am currently reading of how to use XAMPP!

Ok, Apache probably have some easy to install plug'n'play setup... you'll have to look it up (I only use my Synology NAS for dev. then it's hosted elsewhere).

Note that, although everyone still says "MySQL", what you probably want now is "MariaDB" which is what I use now.

As far as the actual web pages to display your data, you could write all your pages in php at the server side. Depending on what other experience you might have, looking at AngularJS (along with Javascript) for client-side presentation is really very good (but the learning curve is a bit vertical).

Hopefully some of that was food for thought.

Yours,
TonyWilk

Thanks for the reply.

You say "posts them on a website", do you mean the Mega is serving the web pages ?

Yes the Mega is serving the web page. It loads the static content from the SD card and populates it with the dynamic values from the sensors.

You seem to be moving from a "just leave it and it runs" Mega, to something which may need a lot more time and management... just a thought.

Probably right. But the current setup is getting too much for the Mega.

Don't know why you would want to do this when you have a perfectly good Win Server with the database already in it.

Because already did it on the Arduino... and dont know how to do it on a PC :slight_smile:

Watcher:
Because already did it on the Arduino... and dont know how to do it on a PC :slight_smile:

Can't argue with that !

I gather there is an "Arduino MySQL Connector" library (never used it, just heard it mentioned), so it might be a useful 'mid step' then to use your Arduino's to INSERT data to and SELECT data from the database before having to get involved in re-writing your web access in PHP or something.

Yours,
TonyWilk

P.S. To avoid confusion: the MySQL library will work with MariaDB, the reason you'll probably end up with MariaDB on your server is that the actual MySQL has ended up commercial and MariaDB is the 'free' version. They are basically identical.

P.S. To avoid confusion: the MySQL library will work with MariaDB, the reason you'll probably end up with MariaDB on your server is that the actual MySQL has ended up commercial and MariaDB is the 'free' version. They are basically identical.

Yes..already installed xampp with MariaDB.
Still trying to set it up properly since the admin UI is not accessible from other hosts.

Setting up a DB is not straight forward at first. Guess i ll have to do some tutorials.