I want to use ThinkerAI A9G module via it AT commands, but i cannot make my ESP32 communicate with it. I have connected them but all i get is some strange random symbols. As i understand i could be caused by not matching baud rates, but i have tried all most popular baud rates and tried sending "AT" command to A9G so that it changes its baud rate to match mine, but i always get the same result. Also tried SoftwareSerial, but with it i was not getting anything in my terminal at all.
So heres my setup:
So my ESP32 is connected to A9G like this (left side is esp32):
- VBUS <-> VUSB
- GND <-> GND
- PIN2 <-> TX
- PIN4 <-> RX
And heres my Arduino sketch:
#include <Arduino.h>
void setup() {
Serial.begin(115200);
Serial1.begin(115200, 2, 4); //Here, as i understand i set pin2 to RX and pin4 to TX
}
void loop() {
while (Serial.available() > 0) {
Serial1.write(Serial.read());
}
while (Serial1.available() > 0) {
Serial.write(Serial1.read());
}
}
And when i power everything up, open serial monitor and click "Reset on A9G" i get this:
And when i send any AT commands it doesn't respond. So i suppose i got something wrong and it is not working properly. So i would like to know how to fix this issue and to communicate with A9G.
Upd: was able to get an output to terminal using SoftwareSerial, by setting inverse to true (TX pin on A9G in high when nothing is transmitted, checked with oscilloscope, so not sure if that was the right decision just experimenting to try to make it work), but still i get random junk in the terminal. Sketch:
#include <SoftwareSerial.h>
SoftwareSerial softSerial(2, 4, 1);
void setup() {
Serial.begin(115200);
softSerial.begin(115200);
}
void loop() {
while (Serial.available() > 0) {
softSerial.write(Serial.read());
}
while (softSerial.available() > 0) {
Serial.write(softSerial.read());
}
}
Result:
Also heres the images of the components that i am using (if its any help):
SoftwareSerial softSerial(2, 4, 1);
\$\endgroup\$SoftwareSerial softSerial(2, 4, 1)
and it seems to me that i understood all the parameters right. 1: RX pin (should support interrupts, and from what i could find 2nd pin of esp32 supports it), 2: TX pin, 3: inverse_logic: used to invert the sense of incoming bits. I set inverse_logic to true, because i had tried without setting this parameter and i dont get anything in the console at all, so i just experimented. Please let me know if i understand something wrong. Thanks. \$\endgroup\$