Sending Sensor Data Values from Arduino through Serial Link

Discussion in 'General Discussion' started by shunter93, Feb 11, 2015.

  1. shunter93

    shunter93 New Member

    Joined:
    Feb 6, 2015
    Messages:
    2
    Likes Received:
    0
    Hi there,

    I've only just recently bought my UDOO Quad for use in a project and I've only really had experience with Arduino programming, MySQL and C++ as seperate entities but never together and I'm struggling to picture what it is I have to do! I'm in desperate need of some guidance.

    I am reading the data from an SRF08 ultrasonic sensor using the Arduino IDE. I would then like to further process this data using C++. It is my understanding that in order to get this data from the Arduino to the IMX6 processor on the board, I need to send the data via the serial link.

    I've read a number of forum posts and tutorials which describe setting up a MySQL database which listens and reads from the serial link and collects the data in a database. This can then be read from using C++.

    First of all, am I barking up the wrong tree with this? Is there a simpler way to achieve what I'm after? Secondly, if anyone could point me in the right direction of any tutorials which describe how to set up MySQL to read from the serial connection on the board?

    Thanks!
     
  2. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Re: Sending Sensor Data Values from Arduino through Serial L

    Hi shunter93,
    this is the tutorial that will help you sending data through serial
    http://www.udoo.org/ProjectsAndTutorial ... lioID=1394
    Regarding the database, MySQL can't take data from the serial. You need an entity in the middle, like Java, C, C++ or Python.
     
  3. fetcher

    fetcher Member

    Joined:
    Mar 9, 2014
    Messages:
    166
    Likes Received:
    20
    Re: Sending Sensor Data Values from Arduino through Serial L

    SInce that sensor is an I2C device, unless you already have suitable Arduino code on hand, you might want to consider reading it directly from the Linux side (i.MX6 main CPU0), rather than delegating this work to the SAM3X secondary CPU and having to coordinate the two processors via serial.

    This would require recompiling your kernel to enable the i2c bus on pins 20,21 though-- it's labeled I2C1 in the pinmux headers, but becomes /dev/i2c-0 to Linux. See these threads for some details on the kernel build:

    recompile-i2c-t2203.html
    solved-ish-getting-i2c-working-t1380.html

    The only thing that absolutely requires using the Arduino/SAM3X side is analog I/O via the ADCs and DAC channels. Most other types of communication are supported on both chips. Using the SAM3X could still make more sense if you have hard timing requirements, though.
     

Share This Page