Chat freely about anything...

User avatar
By torjays455
#96085 In case someone else comes looking for an answer in the future, I figured out how to make this sensor work with an ESP8266 and ESP32. It turns out that you have to provide some signal/random noise on the RX pin of the A02YYUW sensor before taking a reading. I found this out by randomly jiggling the RX wire of the sensor after being frustrated for hours trying to get the sensor to output any measured distance values. The change of voltage levels on the RX pin made it magically work. So I added the following code to make the sensor get actual readings instead of ERRORing out.

Code: Select allvoid GetReading()
sensorSoftwareSerial.println("1"); // ** Put this line before your sensor reading code is **

// Code to perform the sensor reading goes here

Note that the value passed into println() doesn't matter. You can put any text in there (or even an empty string). This code line will cause the TX line on the ESP8266/ESP32 (which is connected to the RX of the sensor) to generate signals and thus "activating" the sensor.