Running udoo brick and arduino sensors simultaneously?

Discussion in 'UDOO NEO' started by Gla, Dec 14, 2016.

  1. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
    Hi....

    i have connected in my udooneo board multiple "arduino" sensors to the analog ports and I can read their data.
    In another experiment i have connected a udooneo brick (Barometer Brick - MPL3115A2) and I can also read the sensor brick data.
    Still, in the same udooneo board i want to connect both the brick and the arduino sensors and read/write their data simultaneously. Is that possible?
    In my initial tests i have difficulties in accessing the brick sensor data.
    Has anybody tested sth similar?
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Default the I2C-2 port for brick sensor is assigned to the A9 core so you can read it from Linux. With the device tree editor you can assign it to the M4 core so you read it with arduino. http://www.udoo.org/docs-neo/Cookbook_Linux/Device_Tree_Editor.html

    On the Arduino IDE there are examples for your brick available that you can use after you have assigned the brick I2C port to the M4 (Arduino)
     
    Gla likes this.
  3. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Gla likes this.
  4. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
    thanks for your help.

    In the http://www.udoo.org/docs-neo/Cookbook_Linux/Device_Tree_Editor.html link it is mentioned that:
    " I2C-2: SNAP-IN Bricks connector
    By default the snap-in connector is assigned to the A9 and it’s possible to control it by Linux driver. The I2C signal are also available on SDA - SCL pins and on pins 36/37.If you need to use this on the M4 Arduino core, you need to remove it from the A9 core, right-clicking on the corresponding pins and removing it. After a reboot it will be possible to connect an external I2C device to the SDA SCL pins and control it from the Arduino M4 core."

    From the above i derive that i cannot use simultaneously the brick ( A9 core ) with the analog sensors ( Arduino M4 core) , only if i will assign the snap-in connector to the other inputs ( SDA - SCL pins and on pins 36/37) and control it from the Arduino M4 core.
    Both A9 and M4 cannot work the same time. Right?
     
  5. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    Indeed, you cannot use them on A9 and M4 at the same time. I stream the values I read on M4 to the A9 with the Serial.
     
  6. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
    How many udoo bricks can be connected in the same board simultaneously? just one?
     
  7. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
  8. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
    Is there any way to connect two or three udoo bricks simultaneously in the same udoo board?
     
  9. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    The UDOO bricks can be chained. Note that the connectors are directional. I guess the UDOO bricks will all have a unique I2C address. If you want to connect two bricks of the same type you'll have to check how to change the brick's I2C address.
     
  10. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
    What do you mean two bricks of the same type? Two identical bricks?
    The point for me is to connect many udoo bricks of different sensors in the same board and to act (send/receive) data simultaneously ( for example a temperature brick, a light brick and a humidity brick) . I suppose these bricks are different.
     
  11. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    From the Udoo shop:
    But I believe that it is not possible to change the I2C address of the current Bricks (do not know about the new Bricks) so it is not possible to use for example 2 temperature bricks.
     
  12. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    Yes, they are, and will thus have a different i2c address.
     
  13. Gla

    Gla New Member

    Joined:
    Oct 25, 2016
    Messages:
    25
    Likes Received:
    4
    If UDOO Bricks work along a cascade configuration, so you can attach them all together without wasting space in a truly intuitive way, has anyone tried to work with different type udoo bricks and take measurements? I have also asked Andrea Robai for this scenario.
     
  14. Mibokay

    Mibokay New Member

    Joined:
    Dec 22, 2016
    Messages:
    4
    Likes Received:
    2
    Hey guys, I want to use the Barometer Brick to get the temperature over the M4.
    I already used the Device Tree (http://www.udoo.org/docs-neo/Cookbook_Linux/Device_Tree_Editor.html) to assign it to the M4 and can read the data just fine.

    My Problem is, that I want to stream the Data to the A9 via the serial communication (http://www.udoo.org/docs-neo/Arduino_M4_Processor/Communication.html).
    I used the java serial bidirectional example as a guideline (http://www.udoo.org/docs-neo/Serial_Libraries/Java_Serial_Libraries.html) and can get data from the analog or digital pins.

    Now the Barometer Brick also uses a Serial communication and it messes up my bidirectional setup. Is there another way I can get the data from the Brick or am I missing something entirely else?
     
  15. Maurice

    Maurice Active Member

    Joined:
    Oct 13, 2015
    Messages:
    394
    Likes Received:
    87
    The bricks use i2c, not serial, so there isn't any messing up. If you need to send commands from the A9 to the barometer brick for some reasons you should send them over the serial to the M4, whereas you interpret the data and issue the corresponding commands.
     
    Mibokay likes this.
  16. Mibokay

    Mibokay New Member

    Joined:
    Dec 22, 2016
    Messages:
    4
    Likes Received:
    2
    Yes you are right, I got confused on the Serial part.
    I am currently sending commands from the A9 to the M4 (eg. turn on/off Pin 13) and now I want to command the M4 to check the barometer brick. But as soon as I implement the code for the brick all I receive from the M4 is "null" and the Udoo freezes I think.
    I think I am maybe missing something and a little bit of tinkering is all that's required.
     
  17. Mibokay

    Mibokay New Member

    Joined:
    Dec 22, 2016
    Messages:
    4
    Likes Received:
    2
    I found the error I made.
    I forgot to include:
    Code:
      if (! baro.begin()) {
        Serial.println("Couldnt find sensor");
        return;
      }
    now everything works just fine, thanks for your quick reply Maurice
     
    waltervl likes this.
  18. Mibokay

    Mibokay New Member

    Joined:
    Dec 22, 2016
    Messages:
    4
    Likes Received:
    2
    Hey guys it is me again, I have run into another problem.
    When I want to just read the pressure value (float pascals = baro.getPressure(); ) I receive the right value (1000 hPa).

    When I want to read the pressure value and the temperature value (float tempC = baro.getTemperature(); ) I get the right value for the temperature (~21*C) but the pressure value is way to low (~0.3 hPa ).

    (when I first check the value of the pressure and then the value of the temperature the first value for the pressure is correct but every value after that is the same bogus value)

    By what is this problem caused and is there a way to fix it?

    EDIT:
    Seems like I found a workaround to the Problem:
    Instead of just checking the value that I would like to know I can update all values and then check only the one I need. It is not the best solution but it works.
     
    Last edited: Jan 5, 2017
    Andrea Rovai likes this.

Share This Page