BeagleBone Black Talks to Arduino through USB/I2C

Hey everyone,

I'm looking for a way to talk from my Arduino to my BeagleBone Black. I don't have any available GPIO pins on my BBB, but I know there has to be another way. So I did some Googling and discovered some USB to I2C adapters. I'd like to use an Arduino voice-recognition shield (EasyVR Shield) to control what happens on my BBB. So Arduino (I2C pins) to BBB (USB).

I started digging for possible adapters/bridges. Links to those are below:

http://www.robotshop.com/en/devantec-usb-i2c-spi-serial-interface.html

http://www.robotmarketplace.com/products/0-A000053.html

Any and all suggestions are welcome. Thanks!

  • John

Have you thought about communicating with the Arduino through the BBB usb port? I've experimented with my RPi and it seems to work ok.

I was told that wasn't possible, but found some resources that say it is. I'm going to try that out Monday when my new BBB Rev. C comes in so I don't mess up my current LED matrices setup on my BBB Rev. B.

I was just looking for a Plan B just in case the USB to USB doesn't work. If you have or know of any example/test Python or #C programs that would be a huge help.

Thanks for looking out!

  • John

Looking for some coding help here. I've gotten my BBB to print what it reads from an Arduino through a serial connection, but can't get it to do more than one thing depending on the interaction. Here's the python package/library I'm using to help interface with the Arduino: GitHub - thearn/Python-Arduino-Command-API: A Python library for communicating with Arduino microcontroller boards. But how would I, for simplicity's sake, make it print different things depending on a couple buttons that are pressed? I tried some If, Then statements, but have been unsuccessful.

The example Python code is:

from serial import *
ser = Serial( "/dev/ttyACM0" , 9600 )

while 1:
    print ser.readline()

The example Arduino code is:

void setup() {
    Serial.begin(9600); //Initialize serial communication at 9600 baud
}
void loop() {
    Serial.println("Hello from Arduino");
}

Thanks!

  • John

I now have functions that make 3 LEDs go off at different interaction points. They use digital pins 8,9,10. With the Python code below in theory it should print when one of the pins is activated. The code doesn't return any noticeable errors. It just doesn't read the pins correctly. Help? I'm not the greatest with Python. Thanks!

from Arduino import Arduino
import time

board = Arduino("9600", port="/dev/ttyACM0")

smile = 0
wink = 0
laugh = 0

while True:

        print board.digitalRead(8)

        smile = board.digitalRead(8)
        if smile == 1:
           print("SMILE, IT WORKED!")
           time.sleep(0.1)
           break

        wink = board.digitalRead(9)
        if wink == 1:
           print("WINK, IT WORKED!")
           time.sleep(0.1)
           break

        laugh = board.digitalRead(10)
        if laugh == 1:
           print("LAUGH, IT WORKED!")
           time.sleep(0.1)
           break

Nevermind. I got it working. Thanks.