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?
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()))
- "EZ430 Chronos and the BeagleBone"
- "USB (serial) GPS Reader with pyserial, Redis, Ubuntu 12.10 on Beaglebone"
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.
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.