Has anyone connected a raspberry pi to the BiBoard using the Tx,Rx, Ground, and 5v GPIO pins? I was able to run ardserial.py using the usb-c port connected to the Rpi, but didn't have any luck with GPIO.
I've gotten the serial monitor to work on both USB and UART2 with the XS command. I'm having trouble getting the IMU data to send to my raspberry pi through the "v" command though. When I enter "v" through the raspberry pi, the IMU data is printed on the arduino IDE serial monitor, but not on the PI. Do you have any insight on this?
Not within imu.h without throwing missing definition errors, but adding io.h to the include statements causes multiple declaration errors. It was simpler to just add the Serial2 print statement.
Following up on this post, I'm still trying to get the Tx and Rx pins on the ESP32 to work for serial communication with a raspberry pi. I've noticed that the OpenCatEsp32.ino file has this in the setup loop:voidsetup() {
}Where the line that is commented out has a comment that this is for the second serial port, while the first Serial.begin statement is commented to be for the USB serial. I tried removing the comment, however the board is unresponsive when I do this.
Additionally, I've been able to test the serial communication with this .ino file:void setup() {
Serial.begin(115200); // Initialize Serial for debugging
Serial2.begin(4800, SERIAL_8N1, 16, 17); // Initialize Serial2 with a lower baud rate
Serial.println("Serial2 test started");
}
void loop() {
if (Serial2.available()) {
String incoming = Serial2.readStringUntil('\n');
Serial.print("Received from Pi: ");
Serial.println(incoming);
// Send a response back to the Raspberry Pi
Serial2.print("Hello from ESP32\n");
}
delay(1000);
}and this python script running the on the Raspberry Pi:import serial
import time
# Configure the serial port
ser = serial.Serial(
port='/dev/serial0', # Use the correct serial port for your setup
baudrate=4800, # Lower baud rate
timeout=1
)
def main():
time.sleep(2) # Give some time for the connection to establish
print("Starting Serial communication with ESP32")
while True:
# Send a message to the ESP32
ser.write(b'Hello from Raspberry Pi\n')
print("Sent: Hello from Raspberry Pi")
# Wait for a response from the ESP32
response = ser.readline().decode('utf-8').strip()
if response:
print(f"Received: {response}")
else:
print("No response received")
time.sleep(1) # Delay before the next message
if __name__ == "__main__":
main()This test worked as expected to communicate using the Tx and Rx pins on the Pi and Esp32. I'm just having trouble tracking down where in the OpenCatESP32 code I need to adjust things to get commands working with this port.
I've gotten the serial monitor to work on both USB and UART2 with the XS command. I'm having trouble getting the IMU data to send to my raspberry pi through the "v" command though. When I enter "v" through the raspberry pi, the IMU data is printed on the arduino IDE serial monitor, but not on the PI. Do you have any insight on this?
Following up on this post, I'm still trying to get the Tx and Rx pins on the ESP32 to work for serial communication with a raspberry pi. I've noticed that the OpenCatEsp32.ino file has this in the setup loop: void setup() {
// put your setup code here, to run once:
Serial.begin(115200); // USB serial
Serial.setTimeout(SERIAL_TIMEOUT);
// Serial1.begin(115200); //second serial port
while (Serial.available() && Serial.read())
; // empty buffer
initRobot();
} Where the line that is commented out has a comment that this is for the second serial port, while the first Serial.begin statement is commented to be for the USB serial. I tried removing the comment, however the board is unresponsive when I do this.
Additionally, I've been able to test the serial communication with this .ino file: void setup() {
Serial.begin(115200); // Initialize Serial for debugging
Serial2.begin(4800, SERIAL_8N1, 16, 17); // Initialize Serial2 with a lower baud rate
Serial.println("Serial2 test started");
}
void loop() {
if (Serial2.available()) {
String incoming = Serial2.readStringUntil('\n');
Serial.print("Received from Pi: ");
Serial.println(incoming);
// Send a response back to the Raspberry Pi
Serial2.print("Hello from ESP32\n");
}
delay(1000);
} and this python script running the on the Raspberry Pi: import serial
import time
# Configure the serial port
ser = serial.Serial(
port='/dev/serial0', # Use the correct serial port for your setup
baudrate=4800, # Lower baud rate
timeout=1
)
def main():
time.sleep(2) # Give some time for the connection to establish
print("Starting Serial communication with ESP32")
while True:
# Send a message to the ESP32
ser.write(b'Hello from Raspberry Pi\n')
print("Sent: Hello from Raspberry Pi")
# Wait for a response from the ESP32
response = ser.readline().decode('utf-8').strip()
if response:
print(f"Received: {response}")
else:
print("No response received")
time.sleep(1) # Delay before the next message
if __name__ == "__main__":
main() This test worked as expected to communicate using the Tx and Rx pins on the Pi and Esp32. I'm just having trouble tracking down where in the OpenCatESP32 code I need to adjust things to get commands working with this port.
Hi,
Have you dialed the switch from Voice to UART2?