-
Some time ago I have purchased an A02YYUW - Mini Ultrasonic Sensor (it is similar to SR04 sensor module) which uses a serial UART command control with 4 byte output (Header,DATA_H,DATA_L,SUM). I have understand that Tasmota SR04 module supports both Trig/Echo and UART serial devices, but I can't to read any data from the A02YYUW when using the SR04 module. If I connect the sensor Tx output to GPIO3 and Rx to GPIO1(of WeMos D1 Mini) and use the Tasmota module configuration Generic(18) configured for RX GPIO3 = SerialRx / GPIO1 = SerialTx and send a "SerialSend4 1" command from the console, I can see one measurement in the console: 16:32:11.001 CMD: SerialSend4 1 When I set the module configuration so that RX GPIO3 = SR04 Ech/RX and TX GPIO1 = SR04 Tri/TX then after restart in console I can see once: 00:00:01.006 RSL: RESULT = {"SerialReceived":"FF05DADEFF05DADE"} It means SR04 driver does not recognize the sensor? I'm using tasmota-sensors firmware version 14.2.0(release-sensors)-2_7_7 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have found solution. there is in "xsns_22_sr04.ino" hardcoded baudrate to 9600 00:00:01.006 RSL: RESULT = {"SerialReceived":"FF05E0E4FF05DEE2"} Thank you for your code and Tasmota |
Beta Was this translation helpful? Give feedback.
I have found solution. there is in "xsns_22_sr04.ino" hardcoded baudrate to 9600
if (SR04[i].sonar_serial && SR04[i].sonar_serial->begin(9600))
But the sensor is using 115200, when it is changed, it is working as expected.
00:00:01.006 RSL: RESULT = {"SerialReceived":"FF05E0E4FF05DEE2"}
00:00:01.947 SNS: Hardware Serial
00:00:01.948 SR4-1: Mode 3
...
19:55:16.285 RSL: sensors = {"sn":{"Time":"2024-09-16T19:55:16","SR04":{"Distance":150.4}},"ver":1}
Thank you for your code and Tasmota