Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3745

Troubleshooting • Raspi 5 connecting to a ESP 32 Controller

$
0
0
Hello all,

I'm facing some issue and i'm not able to connect the Raspi 5 to my ESP 32 Controller.

I'm using this ESP 32 Controller (General Driver board for Robots, Based on ESP32, multi-functional, supports WIFI, Bluetooth and ESP-NOW communications)

I uploaded this sketch to with Arduino IDE to the ESP 32 Controller:

Code:

#include <ArduinoJson.h>#include <HardwareSerial.h>HardwareSerial mySerial(1); // Use UART1void setup() {  Serial.begin(115200);    // For debugging via USB  mySerial.begin(115200, SERIAL_8N1, 16, 17); // RX = GPIO16, TX = GPIO17  pinMode(2, OUTPUT); // Example pin for testing  digitalWrite(2, LOW);  Serial.println("ESP32 Ready");}void loop() {  if (mySerial.available()) {    String received = mySerial.readStringUntil('\n');    Serial.print("Received: ");    Serial.println(received);    // Parse JSON    StaticJsonDocument<200> doc;    DeserializationError error = deserializeJson(doc, received);    if (error) {      Serial.print("deserializeJson() failed: ");      Serial.println(error.f_str());      return;    }    // Extract values    int T = doc["T"];    float L = doc["L"];    float R = doc["R"];    // Respond back    mySerial.print("Acknowledged: ");    mySerial.println(received);    // Act on the command    if (T == 1) {      if (L > 0 && R > 0) {        // Move Forward        Serial.println("Moving forward");      } else if (L < 0 && R < 0) {        // Move Backward        Serial.println("Moving backward");      } else if (L == 0 && R == 0) {        // Stop        Serial.println("Stopping motors");      } else if (L > 0 && R < 0) {        // Turn Right        Serial.println("Turning right");      } else if (L < 0 && R > 0) {        // Turn Left        Serial.println("Turning left");      }    }  }}
When i Uploaded it from my PC the connection is working proberly, as soon i connected it to the Raspi i don't get any responds from the ESP 32 Controller. Any Help?
I also follow this Instruction from Waveshare step by step, i can see the AcessPopup Wifi but i'm not able to connect to it:aspberry Pi Host Computer
This chapter is tested with Raspberry Pi 5 and Raspberry Pi 4B.

Connect a USB camera to the USB interface of the Raspberry Pi, recommended IMX335 5MP USB Camera (B).
Install the Raspberry Pi onto the chassis.
Create an image, and download the host computer program to the Raspberry Pi.
Download link for ugv_rpi
cd ugv_rpi/
Add executable permissions to the installation script: sudo chmod +x setup.sh
Add executable permissions to the script for configuring automatic startup: sudo chmod +x autorun.sh
For International users: sudo ./setup.sh
After installation, configure automatic operation upon startup: ./autorun.sh (Note: do not use sudo to run this command).
Configure WIFI related functions (automatically switch to hotspot when there is no network): cd ugv_rpi/AccessPopup/
Install AccessPopup, add executable permissions to the installation script: sudo chmod +x installconfig.sh
Run the installation script: sudo ./installconfig.sh
Enter 1 to install AccessPopup, then press any key to exit, enter 9, and press Enter, to exit the installation script.
After restarting the device, the Raspberry Pi will automatically run the main program of the product host computer.

Statistics: Posted by Sandro1998 — Sun Jul 07, 2024 8:34 am



Viewing all articles
Browse latest Browse all 3745

Trending Articles