Arduino sending data to MySqL on UDOO.

Discussion in 'General Programming Discussion' started by Stebar59, Nov 17, 2013.

  1. Stebar59

    Stebar59 New Member

    Joined:
    Nov 17, 2013
    Messages:
    5
    Likes Received:
    0
    Hello everyone,
    I would like to use my UDOO board for a project where the Arduino collect some sensor data and write it to a MySQL database.
    I already tested the communication Arduino-> MySQL using an Arduino Ethernet board sending commands to a web server installed on a local PC where a PHP script store the data in the MySQL database.
    It is possible to do the same using only the UDOO board?
    I've seen the tutorial to install the web server on UDOO (but didn't try it right now) and I'm asking me if (and how) the Arduino Due can then "speak" to the web server.
    Who can give me some hints?

    Many thanks

    Regards
    Stefano
     
  2. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    Hard to give anything other than general advice without knowing more details.

    Having said that here's 3 quick points:
    1. yes of course the i.mx6 can run Apache, MySQL, PHP etc - plenty of power/resources in hand to do that.
    2. The i.mx6 as well as the SAM3X8E can read the state of the pins (you say you're collecting info so I won't repeat the usual warning about both CPU's writing).
    3. There is an internal UART (serial) connection between the CPU's - you can use this to pass info back and forth.
     
  3. stejep

    stejep New Member

    Joined:
    Oct 30, 2013
    Messages:
    1
    Likes Received:
    0
    Hi,

    I will be looking at doing the same thing. I currently have my project running on a Arduino Mega, with temp senors (plus others soon), LCD, clock SD card to save data.

    Now with the UDOO, I plan to have the Arduino do the sensor data and then send it to the MYSQL via the serial link. Then using a web server to serve up the data. including a PHP graphing plugin that I found to display graphs of the data.

    I am still in play mode at the moment, but the project is being designed in my brain. when I get something running I will post my project.

    Steven
    Melbourne Australia
     
  4. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    If you haven't already, you may want to explore having an Asynchronous Serial Message Queue/Handler on both sides.

    No need to re-invent the wheel either, there are existing serial interfaces for the Arduino and also Asynchronous options. There are also Message Queue/Handler libraries. You would, ideally, need a full Serial Asynchronous Message Queue/Handler (IE the combination of both) but it depends on your needs/expectations whether you want to go that far.

    Of course anything you have on the SAM3X8E you'll need on the i,MX6 side too. IE 'port' the code to same/equivalent code over.
     
  5. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    Another option is SLIP (or possibly PPP). There is at least one SLIP library for the Arduino (although a couple of years old without updates I notice).

    SLIP has the advantages of cutting out the middle man as it implements a TCP/IP stack IE the SAM3X8E is 'connected' with its own IP address which opens up possibilities.

    I suppose PPP is an option too, not sure if anyone has done a PPP library yet (but would be over serial, so not sure if any benefit over SLIP which is more lightweight)

    Edit: Of course you can still put in a Message Queue, just rather than it using Serial underneath it would now utilise TCP. No great advantage on the SAM3X8E side but a big advantage on Linux/Windows of course.
     
  6. Stebar59

    Stebar59 New Member

    Joined:
    Nov 17, 2013
    Messages:
    5
    Likes Received:
    0
    @Lifeboat_Jim: many thanks for your suggestions. For me, as a beginner, the solution with the serial message queue/handler seams to be too complicated and I think I'll go in the direction of the serial communication between the 2 CPU's.
    @stejep: I think we have the same type of project and I will appreciate any founding/idea you will explore and, of course I'll share mines.
    To try to be more precise on my project, my idea is to have a system to track the shelf position of all my books. Each book will have a RFID tag and taking it out or putting it in a shelf will register the movement (in or out) using a RFID sensor and store it in a MySQL database. The database will then be queried to find a book returning his position.
    At the moment I have the following configuration: Arduino Uno with Ethernet shield reading the RFID tag and sending it via GET request to a server on a local PC (with MySQL database on it) which stores the data in the database with a PHP script. The end configuration will be the UDOO board doing all the work: reading the tag and storing the data in the database.
    Many thanks for all suggestions

    Saluti
    Stefano
     

Share This Page