Hi all
I’m trying to use a AJ-SR04M ultrasonic sensor with a ESP8266 module, but I can’t seem to get it working
After the config is configured and uploaded to the module I get an error where the sensor is not connected and the value returned is “nan”
This sensor works with 3-5V so I believe the 3.3V of the ESP8266 module would be sufficient.
(I’ve tested it with an Arduino on the 3.3V rail with the ping library and worked 100%)
I believe the trigger command is sent as the sensor has a LED on the board itself which lights up if a trigger is “sent” but it seems like no valid value is returned.
The trigger period is set to 1s
However, I’ve observed that if the 3.3V supply to the sensor is removed there is a single value returned and it’s quite accurate, if the 3.3V is supplied to the sensor again the nan value returns.
This got me thinking, do I need to put a pullup or pulldown resistor maybe on the echo line, maybe the pin used is not pulled down to 0v or something like that.
I’m really not sure what causes this weird behavior.
Any help or advice would be greatly appreciated!
Keep on automating!
Cheers