data logging to MySQL using serial port -- Firmata limitations

I am trying to build a small bio-reactor system that has various sensors and I/O connected to Arduino Uno. Initially I was planning on using the Firmata library to directly control the Arduino via Processing. The problem I ran into is that one of my sensors is the PING ultrasonic distance sensor. I need to access the delayMicroseconds() function in Arduino, but to my knowledge there is no capability to perform this through the Firmata library.

My idea to fix this is to eliminate Firmata from the project and have the Arduino perform all necessary I/O functions and signal conditioning. My system is relatively slow so data only needs to be collected and stored approximately every 2 minutes. I am thinking of the following pipeline:
Sensors > Arduino <–> Serial Port <–> Processing <–> MySQL

I am developing on a Windows machine and I would like to just take all the data necessary from the serial port (approx 15 floating point values) every two minutes, parse the data in Processing and store it in a MySQL database.

I was wondering if anyone has done something similar to this, or maybe there is a more efficient way to accomplish this. Any feedback is greatly appreciated :slight_smile:

but to my knowledge there is no capability to perform this through the Firmata library.

True.

Sensors > Arduino <–> Serial Port <–> Processing <–> MySQL

What, exactly, is Processing bringing to the party? Using an ethernet shield with a GET request to the server, asking it to, via a PHP script, store the data in the database is the more usual approach.

Thanks, that makes sense it may have been a somewhat backward approach. I guess because I was working on the GUI for the system in Processing, definite beginner in PHP so I don’t know about the graphic capabilities. I would eventually like to have the application web-enabled though. Do you think PHP is capable of handling the graphics and is a better route to accomplish this?

Advanced Serial Data Logger Pro can work as "Processing" and write data directly to the MySQL database (local or remotely). I have used this application in the past and this is a very flexible solution.

Do you think PHP is capable of handling the graphics and is a better route to accomplish this?

What graphics? Your post title says that you want to use the Arduino to record data in MySQL database. There are no graphics involved in that.

Sorry, ideas don't always come out coherently. I need to create a GUI to view the bio-reactor and see all important process parameters (gas production, temperature, etc...). This is why I was thinking of using Processing with the MySQL library to handle the serial stream from the Arduino, dump the values in MySQL, but also need to be able to call data from MySQL for historical trending (ie - I wonder what the temperature of the reactor was between April 3rd, 2012 and June 5th, 2012) you would be able to pull up a graph of this in the GUI by calling the correct data from MySQL. Any suggestions? Help is much appreciated. Thank you.

I've done a little project that was a subset of what you're trying to do. The arduino measures temperatures and sends them to a web server (over wifi) using a get request as PaulS suggested, the web server pushes the data into a MySQL database. Charting is done via a couple of additional pages driven by perl (only because I've never used PHP) which use Google charts to produce pretty pictures. I can post any or all of the code that does this if it would help.

wildbill: I've done a little project that was a subset of what you're trying to do. The arduino measures temperatures and sends them to a web server (over wifi) using a get request as PaulS suggested, the web server pushes the data into a MySQL database. Charting is done via a couple of additional pages driven by perl (only because I've never used PHP) which use Google charts to produce pretty pictures. I can post any or all of the code that does this if it would help.

wildbill: I've done a little project that was a subset of what you're trying to do. The arduino measures temperatures and sends them to a web server (over wifi) using a get request as PaulS suggested, the web server pushes the data into a MySQL database. Charting is done via a couple of additional pages driven by perl (only because I've never used PHP) which use Google charts to produce pretty pictures. I can post any or all of the code that does this if it would help.

Hello Wildbill, I have the same aim for my project as you, therefore could you post the codes that you used? Kindly thank you, Nat

There are plenty of client side javascript charting libraries out there as well. If you use one of these, it doesn't matter whether you use PHP or Perl or whatever. That link is a little old now, but it will get you started.

Does the Arduino actually control anything or is it just monitoring? If you want to be able to control things from your website (e.g. turn stuff on and off) then your solution will probably be different.