Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

A-Star 32U4 Mini LV to Raspberry Pi via Serial


I have a completely innocent project that has nothing to do with world domination in which a peaceful little robot needs to have the A-Star 32U4 Mini LV send data to a Raspberry Pi (Model 2) over serial and wanted to use USB as I have other 5v sensors on the I2C bus. I was trying to use Oscar Liang’s instructions at blog.oscarliang.net/connect-rasp … usb-cable/

I loaded the following test sketch and added in a delayed blinking light so I could see on the A-Star’s LED if it was running.

[code]// Test sketch for serial connections

void setup(){
pinMode(13, OUTPUT);

void loop(){
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
Serial.println(“Hello Pi”);

When testing the main program or this test sketch on the A-Star I have had no issues getting serial data back to the Arduino IDE over USB. After installing pySerial on the Raspberry Pi I checked to see what TTY was assigned.

With the A-Star, no new port was ever detected and /dev/ttyAMA0 seems to be used for something else as I had to run python as sudo to access it with this code but never saw any data:

import serial ser = serial.Serial('/dev/ttyAMA0', 9600) while 1 : ser.readline()

Tried the A-Star at both 9600 and 115200 baud, no difference. Also tried Serial1.begin and Serial1.println just in case, no joy (I know, that is for the TX and RX pins, just wanted to try).

I ordered the “Logic Level Shifter, 4-Channel, Bidirectional” just in case I have to go all GPIO wiring on this like some sort of savage but would prefer USB for form and function reasons.

When I swapped out the A-Star for an Arduino Uno a new port appeared on the Raspberry (ttyACA0) and after s/ttyAMA0/ttyACA0/ above the serial connection worked fine.

Any assistance you can provide would be appreciated.



The virtual serial port for the A-Star should be /dev/ttyACM*, which is stated under “The A-Star 32U4 USB interface” in the A-Star’s user’s guide, not /dev/ttyAMA*. Can you type ls /dev/ttyACM* and show/post the output from that command here? Also, which version of Python are you using?

- Amanda


Yeah, I had hoped for the standard virtual serial port, was not sure if that might be dynamically named…

to answer:

pi@luna:~ $ ls /dev/ttyACM*
ls: cannot access /dev/ttyACM*: No such file or directory
pi@luna:~ $ ls /dev/ttyA*
pi@luna:~ $ python -V
Python 2.7.9

I should have mentioned that when I tried lsusb -v -d 1ffb: as mentioned in the A-Star’s user’s guide I saw no data and assume this is significant

pi@luna:~ $ lsusb -v -d 1ffb:
pi@luna:~ $

Thank you in advance for your help


It looks like your Raspberry Pi is not recognizing the A-Star at all. Can you try using a different USB cable (one that you know is working) and a different USB port? Can you run dmesg in a terminal immediately after plugging in the A-Star to your Raspberry Pi and post the output results here?

- Amanda


So… I learned something important today. Those conveniently short USB cables that come with phone charging batteries? Only two wires, not the usual full set.

I connected the two with a normal USB cable and everything works fine… /dev/ttyACM0 joined the party and reads dat ajust fine.

Issue was on OSI layer 1… sorry to waste your time :frowning:


I am glad that the issue has been resolved (it is good practice to check the physical layer first); thanks for letting us know.

By the way, we have seen the same problem when other people try to connect our products to their computers using power-only USB cables (e.g. cell phone charging cables) instead of USB cables with data lines. It is understandable to confuse the two USB cable types, since they look quite similar to each other, and to expect all USB cables to have data lines.

- Amanda


Thank you for your help!