JSN-SR04T-2.0

Can anyone tell me how the new JSN-SR04T-2.0 differs from JSN-SR04T?

I have ordered a lot of JSN-SR04T but have got JSN-SR04T-2.0.

The code I use works fine on JSN-SR04T but when I try with JSN-SR04T-2.0 only 0 is printed

Thank you

I have same problem.

I put 10K pullup resistor and it started to work, but not stable. With 4,7K resistor looks better, but still not as good as SR04T. Does anyone solved this problem already?

Hi M_a_x,

Thank you for the quick response.

Can you please provide the circuit that you use?

Thank you

Just solder resistor between +5V pin and Echo pin. But it's just a try which not solved my problem at all - sensor works unstable..

I have the same problem, does somebody has any other tip?

Same issue. I tried the new ping library also tried giving my own trigs and monitoring echo, none worked. I dont see the echo coming up at all on the scope. Not seen anything but zero with Jsn-sr04t 2.0.

Please advice if someone found a solution. Unfortunately the unit doesn't have any datasheet either for reference.

Found a document (unfortunetly I don't speek chinese) however google translate too. I have tried JSN-SR04T-2.0 mode 0 with R27 open however I don't get any sign on trigger. https://pan.baidu.com/s/1sllkK93 check the doc + google translate maybe it helps for somebody.

some text from google translate :-)


Mode 1: R27 = open The pattern is described below 1, the basic working principle: (1) using IO port TRIG trigger range, to a minimum of 10us high letter. (2) module automatically send 8 40khz square wave, automatically detect whether there is a signal to return; (3) a signal to return, through the IO port ECHO output a high level, high time is the duration of ultrasound from the launch to the return time. Test distance = (high time * sound velocity (340M / s)) / 2; (4) module is triggered after the distance measurement, if you can not receive the echo (the reasons beyond the measured range or the probe is not on the measured object), ECHO port will automatically become low after 60MS, marking the End of measurement, whether successful or not.

(5) LED indicator, LED non-power indicator, it will receive the trigger signal after the module, then the module is working.

Mode 2: R27 = 47K is the welding 47K resistance. This mode shows that the following serial output format is TTL level. Note: The module automatically outputs the distance value in units of 100 ms. Serial baud rate: 9600, n, 8,1. Module power recognition, directly into the working mode, the module to carry out a distance every 100ms, and from the pin TX output of a frame, with four 8-bit data. Frame format: 0XFF + H_DATA + L_DATA + SUM 1.0XFF: for a frame start data for judgment; 2.H_DATA: the upper 8 bits of the data; 3.L_DATA: the lower 8 bits of the data; 4.SUM: Data and, for the effect of its 0XFF + H_DATA + L_DATA = SUM (only lower 8) Note: H_DATA and L_DATA synthesis of 16-bit data, that is, the distance in millimeters, for example: product response FF 07 A1 A7 which check 0xA1 is the distance of the low order data; distance value is 0x07A1; converted to decimal for 1953; unit is: millimeter (mm07 + 0xA1 + 0Xff) & 0x00ff 0x07 for the distance of the high order data; Description: The module outputs the nearest distance value in the dead zone, and outputs 0 if the module does not measure the data or it is out of range.


Mode 3: R27 = 120K is the welding 120K resistance. In the serial port mode, the module enters the standby state after the module is powered on. The serial output format is TTL level and the serial port baud rate is 9600, n, 8,1. When the RX port receives the 0X55 instruction, the module starts a ranging and outputs one frame from the pin TX with four 8-bit data. The frame format is: 0XFF + H_DATA + L_DATA + SUM 1.0XFF: Data, used to determine; 2.H_DATA: the upper 8 bits of the distance data; 3.L_DATA: the lower 8 bits of the distance data; 4.SUM: data and, for the effect of its 0XFF + H_DATA + L_DATA = SUM 8 bits) Note: H_DATA and L_DATA synthesize 16-bit data, that is, the distance value in millimeters. Description: The module outputs the nearest distance value in the blind area. If the module does not measure the data or outputs it out of the range.


Note: 1, this module should not be charged connection, to live connection, then let the module first GND connected, otherwise it will affect the normal work of the module.

2, distance measurement, the measured object area of not less than 0.5 square meters and the plane as required to smooth, otherwise the results of the measurement

Has anyone found a solution for JSN-SR04t-2.0. I'm still lost

Received a couple of the version 2.0 and was a bit taken back when i discovered that they were not backwards compatible with the original.
In my case i’m using a 3v ProMini with the JSN-SR04T-2.0 @ 5v. Rather than using an external 4.7k pull up resistor (Echo to 5v) I enabled the internal pullup resistor “pinMode(echoPIN,INPUT_PULLUP);” and that worked. Originally i had a voltage divider but now Echo Out is dropped through only a 1k resistor to the Arduino. My guess is echo signal is now somewhat less than on the original so it may not be needed at all but it will stay until i get more info.
Both of the new versions test the same and are giving quite reliable soundings.
I cant speak for the libraries that are out there for these devices but if your coding it yourself you should be able to get to work with these little tweaks. I attached a very basic example as a starting point.
When i get a bit of time the serial open looks interesting to explore.

SR04_V2.ino (1.24 KB)

I have gotten a very stable operation … I just configured the echo as “INPUT_PULLUP” … thats all.

int Trig=8;
int echo=7;

void setup() {
pinMode(Trig,OUTPUT);
pinMode(echo,INPUT_PULLUP);

digitalWrite(Trig,LOW);

Serial.begin(9600);
}

void loop() {
  int distancia=0;
  digitalWrite(Trig, HIGH);
  delayMicroseconds(20);    //Retardo necesario para la inicializacion
  digitalWrite(Trig, LOW);
    
//  distancia=pulseIn(Pin, HIGH);
//  distancia=(int)distancia*0.017;

  while(digitalRead(Pin)==0);
  while(digitalRead(Pin)==1){// && distancia<=500){
    distancia++;
    delayMicroseconds(58);  // Tiempo que tarda la honda en recorrer 2cm a la velocidad del sonido
  }                         // 1cm de ida y 1cm de vuelta
  delay(50);
  
  Serial.println(distancia);
  delay(1000);
}

The sample code here works for both V1.0 and V2.0 https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207

Hi, I want to place the module inside a box and I want the connector that is on top of the board not to be exposed in the outside.

So I am looking for extra connectors to place on the box.

Does anyone know the connector model?

Thanks.

sebaspz Thanks for Code, its worked.

Thanks

Hi guys, I bought a couple of these (JSN-SR04T-2.0), i plugged them and then the problems started. Unstable readings. I tried all the things mentioned in every possible threat here but nothing worked. I was ready to give up, BUT! I disconnected the serial cable (usb) and connected through a bluetooth module I had, and an external battery pack. I uploaded the code and the readings were great (1 out of 10 readings was wrong). Does anyone has an idea what is going on? 30 mA is not gonna drain my laptops usb energy ( i think usb provides up to 500mA), and when i plug the battery and connected through serial-usb cable it's not working. Please let's solve the riddle with this thing.

Ping!

Anyone resolve this issue? I spent the entire day trying to get this 2.0 sensor to work. I had readings at one point. The data was coming through fine and i was so excited. Then the readings went erratic, then they stopped coming entirely. I have no idea why. Input_pullup has no effect. No matter which version of the sketch i used, pullup or no-pillup, i got no readings.

Is anyone having luck with adding a resistor?

I have a water storage tank and really need to be able to monitor the level. Any alternative sensors or solutions?

If anyone has this working please post explicit details on how you did so. Also, an example of a very basic sketch would be appreciated.

Thanks in advance.

-Tom

tomlu2000: Ping!

Anyone resolve this issue? I spent the entire day trying to get this 2.0 sensor to work. I had readings at one point. The data was coming through fine and i was so excited. Then the readings went erratic, then they stopped coming entirely. I have no idea why. Input_pullup has no effect. No matter which version of the sketch i used, pullup or no-pillup, i got no readings.

Is anyone having luck with adding a resistor?

I have a water storage tank and really need to be able to monitor the level. Any alternative sensors or solutions?

If anyone has this working please post explicit details on how you did so. Also, an example of a very basic sketch would be appreciated.

Thanks in advance.

-Tom

You can always use a float switch or a water level meter. The float switch would give you a variable resistance value, like a car fuel tank. They also make then where they close a switch at a certain height. Not sure if you need a distance feedback or just a If thus Then do this when water reaches a level

Dear All, I think I may have a solution for many of you. I too was really disappointed to receive my JSN SR04T sensors this morning and discover that they were the Version 2. About one reading in every 10-20 came back as zero. However, thanks to pityuka I could see that the datasheet for this version states that a MINIMUM of 10microseconds is needed for each trigger pulse. I can also also see that most Arduino libraries suggest a trigger pulse of 10microseconds. All I did was MAKE THE TRIGGER PULSE 20MICROSECONDS, not 10microseconds and the problem was immediately fixed.

I’m using the same pin on a LOLIN D32 to provide a 3.3V trigger pulse and then listen for an echo. I’m getting the same accurate and consistent results whether I use a 5V supply for the sensor or the board’s own 3.3V output. If I use a 5V supply then I am stepping the echo voltage down through a resistor pair voltage divider. Setting pinMode as PULLUP or not makes no difference at all. Code is pasted below for anyone who needs it. Hope it helps this frustrating problem.

pinMode(sensor1Pin, OUTPUT);
digitalWrite(sensor1Pin, LOW);
delayMicroseconds(2);
digitalWrite(sensor1Pin, HIGH);
delayMicroseconds(20);
digitalWrite(sensor1Pin, LOW);
pinMode(sensor1Pin, INPUT);
duration = pulseIn(sensor1Pin, HIGH, timeout);
distance1 = duration*0.0343/2;
pinMode(sensor1Pin, OUTPUT);

Serial.print(“Sensor1”);
Serial.print(" = ");
Serial.print(distance1);
Serial.print("cm. ");
Serial.println();

delay(100);

Thanks for the responses. I have mine working now. I'm not sure what made the difference but here's the code I use. The information I'm getting tells me how far above or below my optimum sump tank level. The goal is to prevent the tank from getting so low the submersible pump can't pump water to keep the fish alive and circulate water through the grow beds and towers. The calculated value is not the actual distance but a differential from 35cm. I multiply it times -1 so a shorter distance is positive (fuller tank) and a negative distance is bad (empty tank). This information gets published to my mqtt server. I have rules in openhab that text and e-mail me when the levels go negative. And, I'm not using PULLUP. Works like a charm.

void getSumpDepth() { Serial.println(" "); Serial.println("Reading Tank Depth"); digitalWrite(TRIGPIN, LOW); // Set the trigger pin low for 2us delayMicroseconds(2); digitalWrite(TRIGPIN, HIGH); // Send a 10us high to trigger ranging delayMicroseconds(20); digitalWrite(TRIGPIN, LOW); // Send Pin low again sump_distance = pulseIn(ECHOPIN, HIGH,26000); // Read in times pulse sump_distance = ((sump_distance/58) - 35) * -1; Serial.print(sump_distance); Serial.println(" cm"); }

Shuai: The sample code here works for both V1.0 and V2.0 https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207

I have used this code and i am okay with the reading. But only issue is getting ZERO after every few correct readings. How to deal with this?

Thanks in Advance, Ram

560242: Dear All, I think I may have a solution for many of you. I too was really disappointed to receive my JSN SR04T sensors this morning and discover that they were the Version 2. About one reading in every 10-20 came back as zero. However, thanks to pityuka I could see that the datasheet for this version states that a MINIMUM of 10microseconds is needed for each trigger pulse. I can also also see that most Arduino libraries suggest a trigger pulse of 10microseconds. All I did was MAKE THE TRIGGER PULSE 20MICROSECONDS, not 10microseconds and the problem was immediately fixed.

I brought these sensors from china alibaba. I did same as you and problem has been resolved thank you. I did changed only the delay to 20 microseconds. It is very useful