-->
Page 1 of 1

ESP-01 with JSN-SR04T Boot issue

PostPosted: Thu Feb 28, 2019 4:03 am
by DavidRK
Hi guys, first time posting here (go easy), but I have been playing around with IC's again (after 20 years lol), To get me started on a few projects around the house I got a load of ESP8266-01 due to their small footprint and most my applications only needing 1/2 IOs.

Its been a love/hate month but I feel like I have the chip down pat on most things, but of recent I have had issues with connecting up the JSN-SR04T-2.0 Ultrasonic sensor (for a water tank level reading).
I am using the NewPing library v1.8 as all the newer ones threw a wobbler when compiling, I am using GPIO0/2 for the Trigger/Echo and a 3.3k pull up on GPIO0, I have the SR04 powered by the 3.3v supply.

If I boot it with everything connected, it won't start. In the serial monitor, I get an endless loop of character gargan, not even any of my sketch serial prints.
BUT if I remove the echo pin from the SR04 on boot and once running setup connected it again, bam all works sweet as. I can't detect any weird voltage spikes and adding a pullup to GPIO2 or a voltage divider does nothing.

Now in a normal world with a larger waterproof enclosure I would just use one of my ESP-12s and use a Mosfet on another input to delay the connection of the echo pin, but I only got 2 IOs and I really like to keep the TX/RX IOs free for debugging. I really need this to work as I am soldering the reset to the GPIO 16 for deep sleep, and needed to unplug the echo pin on restart is definitely not an option.

Anyone experience this weird behaviour or have any tips on how to figure out what's causing it.

Thanks Dave

Re: ESP-01 with JSN-SR04T Boot issue

PostPosted: Sat Mar 02, 2019 10:03 am
by DavidRK
Well, in case anyone has similar issues, normal boot required GPIO0 and GPIO2 to be pulled high, the JSN-SR04T sending a low signal at boot was just causing a boot issue.

My solution while still keeping the package small was to use the RX pin (GPIO3) and change its pinMode in setup to FUNCTION_3. I can still use the TX for serial debugging while having the input connected. I am not sure if TX works with FUNCTION_3 but for the moment this is perfect for switches that start LOW and any other modules that pull LOW at boot on the ESP-01.

Re: ESP-01 with JSN-SR04T Boot issue

PostPosted: Thu Jan 23, 2020 12:56 am
by Fhy40
Thanks for documenting this, will be useful in the future

Re: ESP-01 with JSN-SR04T Boot issue

PostPosted: Fri Feb 05, 2021 2:32 pm
by xjust
David,
Im interested to use this with esp01
im glad the JSN-SR04T works on 3.3v

care to show how you connected everything and maybe share some code?
thanks