Ultrasonic sensor module JSN-SR04T

We are facing some issues as well as we have some queries related to Ultrasonic sensor Module Integration with ESP32.

In JSN-SR04T, STM8S003F3P6 controller is used and 8 pulses of 40 kHz signal is generated from the controller & given to transmitting part of the circuit. The transmitting side Vpp voltage is nearly 96V when we use STM8S003F3P6. The maximum distance is 600 Cm.

We are trying to interface with ESP32 controller. We generated 8 pulses of 40Khz from ESP32 and we are getting 70V as Vpp. The only change is STM8S003F3P6 from JSN-SR04T is replaced by ESP32. We are getting 213 Cm as a maximum distance.

Please give me a suggestion on how to increase the sensor distance?

Thank you!


Do you mean one of these?

Do you have a schematic and photos of your setup? 96Vpp is very high and shouldn’t be anywhere near that level at the output.

Are you saying you’re trying to desolder the micro-controller from the PCB and replace it with an ESP 32?

Have you accidentally put it in low power mode somehow? There’s some good detail on the DFRobot wiki:


Yes we used same as weather proof ultrasonic sensor as you attached. We desoldered STM8S003F3P6 from JSN-SR04T and replaced it with an ESP32


And We used floating mode (Mode 0)


Hmm, tricky. Have you managed to find a schematic or some other low level details on how the device works? I’ve only ever seen documentation at the user/implementation level. I imagine this will be a matter of completely reverse engineering it. Neat project!


Hi Kavitha,

Welcome to the forum!!

I love these kinds of projects, jumping deep into how a pre-existing bit of hardware works.

I can imagine there are lots of variables at play.
Would you even be able to keep the STM8 onboard and design a PCB that the ESP32 can sit on to interface with the sensor?

Back to figuring out to increase the range.
Do you have some additional boards to do some more testing on?
You mention that there are voltage up to 96Vpp, without knowing all of the other factors that can be dangerous but as @Oliver33 mentioned shouldn’t be popping up.

Using an oscilloscope I would probe the pins on the STM8 that are generating the 40KHz signal, and note down all of the measurements you can.
Do you have a link to a ‘Floating mode’ reference?
Measuring and comparing the two outputs from the microcontrollers will be key, while they are both considered ‘digital signals,’ at the end of the day it’s still an analog signal (paraphrasing from @Robert93820) There will be some stray impedance that will be altering the waves or it might even be damage.

I’m keen to see how this progresses!


Hi Oliver

I wouldn’t say this is too high. You are looking across a tuned circuit. I have had nothing to do with the inner workings this type of thing but I once decided to measure the DC voltage on the output stage of an echo sounder and lost the tip and half the meter probe with the AC component. Lesson learned.

To all
Why was the controller replaced. Surely at the end of the day what has to be done is interpret the echo signal. Regenerating the 40kHz pulse is like reinventing the wheel. Surely the new pulse is no better than the original. Seems to be worse I think.

Unfortunately I have no suggestion as to increasing the range. If it has come down from 600cm to 213cm then it seems to be related to pulse power. The only suggestion I can make is restore the device to original.

I can think of one possibility. Can you measure the pulse value at the source, where it is generated.
If the original was 5V and the new device outputs 3.3V that might explain the difference between 96V and 70V. Don’t forget the power reduction is the square of the difference. For instance for a voltage difference from 100V to 70.7V the power difference is half or 3db.
Cheers Bob