1
$\begingroup$

I have an arduino uno and a BeagleBone black and would like them to talk with eachother. Both the beagleBone and the arduino have their own 5V power supplies so no need for power to be transferred over usb. The used communication line we would like to use is the direct serial line. Preferably in such a way that the arduino can just call Serial.read() in order to get the bytes it needs (there won't be many). How do I get this to work on the BeagleBoneBlack? I suspect we can call the serial.write somewhere inside the BBB(we mainly program in C++). But how do we achieve this?

$\endgroup$
  • $\begingroup$ Isn't BeagleBone running Linux? Can't you write to serial port the same way you would do in Linux everywhere? $\endgroup$ – Shahbaz Dec 11 '14 at 15:37
  • $\begingroup$ The beagleBone is running ubuntu-ARM but so far I have only writen to serial using the build in tools inside the arduino ID so how would I do this? $\endgroup$ – Thijser Dec 11 '14 at 15:41
  • $\begingroup$ Would this help? $\endgroup$ – Shahbaz Dec 11 '14 at 15:46
3
$\begingroup$

Beaglebone USB

When you plug a USB cable between the USB B plug of the Arduino Uno and the USB A plug of the Beaglebone Black, the Beaglebone should be able to talk and listen to it the same way any other Linux distribution talks and listens to any other CDC class USB peripheral.

On the Beaglebone, a CDC class USB peripheral can be read an written to through "/dev/ttyUSB0" or "/dev/ttyACM0" or something similar.

# warning: untested code
import serial
serial_port = serial.Serial( port="/dev/ttyUSB0", baudrate=9600, timeout=1 )
while True:
    serial_port.write("Hey.")
    print hex(ord(serial_port.read()))

The Arduino uses Serial.read() and Serial.write(). Any of the Arduino serial demo scripts that read and write to the Arduino serial monitor when the USB cable is plugged into a "big" computer should work just fine when that same cable is plugged into a Beaglebone instead.

Beaglebone UARTs

p.s.: You may find it easier to wire one of the six BeagleBone UARTs directly to the Arduino UART ("Enable serial/UART/tty on BeagleBone Black"; "Python PySerial ... using Beaglebone Black"), rather than trying to stick the more complicated USB in the middle somewhere.

$\endgroup$
  • $\begingroup$ This dues write to Serial however the data arrives malformed and the print causes the code to crash once it runs out of serial data to read. $\endgroup$ – Thijser Jan 12 '15 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.