Is there any access to the Arduino I/O from Android or Linux

Discussion in 'General Programming Discussion' started by markAtUMR, Nov 27, 2013.

  1. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    I'm curious about accessing the Arduino I/O pins from a couple of different paths:

    1. Is there a way to access them from Android Apps running on the UDOO? I assume there would need to be a UDOO specific Android SDK for this.

    2. To be able to do really interesting things such as vision guided robotics on the UDOO, I think that you really want to work outside of the Arduino space and work directly in Linux in some other development environment where you have access to both a camera (USB or the UDOO camera) and to the Arduino I/O so that you can access a camera, acquire images, process them using a vision library, determine what to do (possibly with additional input from sensors connected to the Arduino I/O) and then control motors and servos via the Arduino I/O. Is this ability currently available in any language on the UDOO while in Linux? I realize that this http://www.udoo.org/forum/viewtopic.php?f=8&t=436 might be the answer, but this is not exactly what I am thinking of in terms of ease of use for all users.

    Thanks,
    Mark
     
  2. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
  3. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    Re: Is there any access to the Arduino I/O from Android or L

    Yes, I have seen OpenCV, I was just not naming any example vision libraries as I'm interested in the Arduino I/O pins here. But, thanks!
     
  4. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    Re: Is there any access to the Arduino I/O from Android or L

    Ok, well if you look at the Pinouts documentation you can see what is available.

    Note: There does seem to be an oversight in making Analogue Pins available on the i.MX6 side currently
     
  5. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    Re: Is there any access to the Arduino I/O from Android or L

    I assume you mean this?

    http://udoo.org/download/files/pinout/U ... iagram.pdf

    So it looks like the digital pins are available. For example, if you want to access the D23 Pin on the SAM3X, it is gpio124 on i.Mx6?

    So then I assume it is probably a matter of doing something like the other post that I linked to ( viewtopic.php?f=8&t=436 ) and that there are no libraries currently on the UDOO in C++, Java, etc. for Linux or Java for Android for easily doing it at the moment.

    And, yes, looking at the above link to the pinout, it does look like the analog is not available (if I am interpreting the diagram correctly). But, at least with a ADC, you could make up for that if you needed too (if a digital I/O sensor or an I2C sensor wouldn't meet your needs for your robot, etc.).

    If there is anyone from the UDOO team reading this, are there any plans to develop such libraries? It seems like it would make sense for the libraries for this to be available in whatever language the libraries to access the UDOO camera will be available in; at least for the use case that I'm thinking of which is vision guided robotics. Otherwise, you have to then do more complex development potentially to access the digitial I/O (and/or I2C lines) in one language and the camera in another and then a vision library in potentially another.

    Mark
     
  6. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    Re: Is there any access to the Arduino I/O from Android or L

    Actually, it looks like you can quite easily at least read and write digital I/O from the Linux side as described here:

    http://udoo.org/download/files/Document ... 8_2013.pdf

    Funny, how it is so easy to ask in a forum before reading the manual! :)

    However, it might still be good to have libraries for doing that in C++, etc. to make it easy for new users.

    I'll have to keep reading and maybe experiment to see if that works for I2C too.
     
  7. EBrown

    EBrown New Member

    Joined:
    Dec 9, 2013
    Messages:
    48
    Likes Received:
    0
    Re: Is there any access to the Arduino I/O from Android or L

    I'm assuming the analogue pins don't work due to the mention in this (viewtopic.php?f=24&t=364#p3672) topic. The workaround I suggested is to read the analogue values in the Sam3X then pass them through the serial bus to the i.MX6. This should work fine though I've yet to test it.

    It would be nice if there were a way to rewrite the kernel to be able to accept the analogue values and convert them to digital values in the software, but I am assuming the issue lies with the i.MX6 itself. I assume it does not have the ability to read varying voltage on those pins, and treats anything above the threshold as 1 and anything below as 0.

    Now, someone ambitious enough to solve this \would have two options to relieve this issue and pass analogue values directly to the i.MX6:

    1. Find a ADC chip that can take an analogue input and convert it to, say eight, bits to pass to eight GPIO's for the i.MX6. Now this would be extremely inefficient on the GPIO's as you would be required to do this for each analogue signal you wish to monitor.

    2. Add an additional chip for the ADC conversions that can take multiple analogue inputs and convert them to digital on request. (I.e. act as if the chip is "RAM" for analogue signals, send an address and a read or write signal and then the chip returns the signal on that line, or sets the signal to that line.) This would be more expensive but would allow you to use how ever many digital outputs are on the chip in GPIO's, and give you however many analogue inputs are on the chip. This would be slower in the end as you would need to manually request the value from the analogue pin.

    Both of these options have their faults, and neither is particularly glamorous, though that is a problem when the chip itself cannot understand how to process analogue signals.

    I want to note, that this post is based on the ASSUMPTION that the i.MX6 is the reason the analogue signals are passed as digital signals. If it is in fact a software issue then one could simply rewrite the operating system to convert the analogue signals to n-bit digital signals.

    Thanks,
    EBrown
     

Share This Page