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);
Serial.begin(9600);
}
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”);
delay(2500);
}[/code]
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.