ceefan
Posts: 15
Joined: Fri Mar 16, 2012 7:46 pm

Saving Sensor Data

Wed Jan 02, 2013 7:41 pm

I have set up a series of sensors for temperature and humidity, each connected to and saving data on its own Raspberry Pi. Since these sensors are spread around physically, I would like them all to talk to a central server that's more powerful.

Right now, the output is not going into a database but is being stored in a plain text log on each Raspberry Pi, sort of like this:

~/log/Sensor[XX]/[YYYY]/[MM]/[DD].txt

Where each sensor is in its own folder, and the files are sorted by year, month, and day.

My goal is to run an rsync --daemon on the server and have the log files continuously sync with this location via inotify + rsync. This way, I would have several Sensor[XX] folders (Sensor01, Sensor02, etc.) each with date sorted log files that I can then process into a database.

Am I heading down the right path with this thinking? Is this the way to go to continuously sync the files?

Thanks for your help.

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Saving Sensor Data

Wed Jan 02, 2013 9:07 pm

ceefan wrote:I have set up a series of sensors for temperature and humidity, each connected to and saving data on its own Raspberry Pi. Since these sensors are spread around physically, I would like them all to talk to a central server that's more powerful.

Right now, the output is not going into a database but is being stored in a plain text log on each Raspberry Pi, sort of like this:

~/log/Sensor[XX]/[YYYY]/[MM]/[DD].txt

Where each sensor is in its own folder, and the files are sorted by year, month, and day.

My goal is to run an rsync --daemon on the server and have the log files continuously sync with this location via inotify + rsync. This way, I would have several Sensor[XX] folders (Sensor01, Sensor02, etc.) each with date sorted log files that I can then process into a database.

Am I heading down the right path with this thinking? Is this the way to go to continuously sync the files?

Thanks for your help.
Since they're all networked, why not just get each Pi to talk to the head-end via MySQL[1] directly? MySQL is designed to be used over a network...

Each logging Pi can save locally, then do the database update - or, if the network isn't avalable, then just keep track locally until the network is avalable.

Seems easier to me...

-Gordon
[1]postgresql, mariadb, etc. whatever you choose
--
Gordons projects: https://projects.drogon.net/

Tafkas
Posts: 49
Joined: Sun Sep 16, 2012 11:15 pm
Contact: Website

Re: Saving Sensor Data

Thu Jan 03, 2013 10:21 am

You could also use rrdtool for that.

aarone
Posts: 4
Joined: Thu Jan 03, 2013 8:39 pm
Location: Northern California
Contact: Website

Re: Saving Sensor Data

Thu Jan 03, 2013 9:00 pm

Hello, I would like to know more about what kind of sensors you used. I am new to the Raspberry Pi and want to see if I can find what type of thermocouple would work with it. I need to connect temp sensors to a water tank inlet and outlet in my race car and to the air inlet and outlet to the supercharger and eventually to the exhaust for test reasons to study after our land speed runs each day, so I would need to be able to save and download the readings.
Can you give me any input on the idea?

Return to “Automation, sensing and robotics”