JSN-SR04T Waterproof Ultrasonic Sensor

T221-L2D25

Baru

Ready Foto Pertama, NEW VERSION! Lebih Stabil

20 item

Rp. 53.000


JSN-SR04T Waterproof  Ultrasonic Sensor

Features

  • Operating Voltage: 5V DC
  • Static Operating Current: <8mA
  • Operating Current: 30mA
  • Acoustic Emission Frequency: 40kHz
  • Maximum range: 600cm
  • Minimum range: 20cm
  • Connection pins: +5V, Trig, Echo, GND
  • Module Dimensions: 41mm * 28.5mm
  • Sensitivity: ~1cm
  • Sight Angle: 75°
  • Operating Temperature: -10 ~ 70 ℃
  • Storage Temperature: -20 ~ 80 ℃

Bisa menggunakan library NewPing, tinggal pilih NewPingExample


//progam jsn/aj-sr04

#define ECHOPIN 12 //D2
#define TRIGPIN 11 //D3

void setup() {
Serial.begin(9600);
pinMode(ECHOPIN,INPUT_PULLUP);
pinMode(TRIGPIN, OUTPUT);
digitalWrite(ECHOPIN, HIGH);
}

void loop() {
digitalWrite(TRIGPIN, LOW);
delayMicroseconds(2); //2
digitalWrite(TRIGPIN, HIGH);
delayMicroseconds(15); //15
digitalWrite(TRIGPIN, LOW);
int distance = pulseIn(ECHOPIN, HIGH, 26000);
distance=distance/52; //58 ini untuk penyeuasian jika jarak salah


Serial.print(distance);
Serial.println(" cm");
delay(50);

}

UNTUK PENGGUNAAN MODE LAIN KAMI BELUM PERNAH TEST, BISA DIBACA DIBAWAH INI 

RCWL-9631(RCWL1655) JSN-SR04T Ultrasonic Distance Measurement Module
interface mode: GPIO / UART/ I2C/ 1-WIRE
 
JSN-SR04T is a wide voltage working ultrasonic range module. The module dimensions and software are fully compatible with the older version of the JSN-SR04T; it can be switched seamlessly with the older version JSN-SR04T. As low as 3V minimum operating voltage, so that with the 3.3V power supply MCU can be directly connected.
Product Features:
  • Wide voltage operation: 3V-5.5V
  • Fully compatible with JSN-SR04T software and hardware dimensions
  • Detection distance:
  • 5V: 20cm - 600cm 
  • 3.3V: 20cm - 400cm 
  • Detection of the angle:
  • The use of industrial-grade MCU,  operating temperature : -40 ℃ - 90 ℃
 
There are 4 pins on the module: VCC , Trig, Echo, and GND . To use the sensor: pull the Trig pin to high level for more than 10us to trigger an impulse. The module will begin sending ultrasonic pulses. If an object is detected in front of the sensor the Echo pin will rise to a logic high level. The distance between the sensor and the object can then be calculated using the equation below. 
 
Distance = ((Duration)*(Sonic :340m/s))/2

RCWL-9631

Parameter NameRemarkminimum valuetypical valuemaximum valueunit
Operating 2.8 5.5V
Voltage Operating  3.54mA
Current Maximumflat wall 500800cm
working frequency  40 KHz
blind spotRandom value in blind zone 2021cm
Detection accuracysame temperature Â± 2 %
resolutiontheory 1 mm
detection angleMaximum Direction Angle Â± 20± 30 
Measuring cycle timeGPIO / 1-WIRE 70 mS
Measuring cycle timeUART / I2C 120 mS
Output interface mode GPIO / UART/ I2C/ 1-WIRE 
storage temperature -50 100℃
Operating temperature -40 90℃
package size SOP16 
 
*
R7Mode 
NCGPIOTrig, Echo
R7(100K)I2CSCL , SDA
R7(10K)UARTTX , RX
R7(0)1-WireTrig(I/O)


*
//--------------------- GPIO (Trig Echo) --------------------
/*
Module:       RCWL-9610,RCWL-9631,RCWL-9620 16MM  Ultrasonic Ranging Module
Version:      V2.0
Date:         20220710 
Master chip:  RCWL-9631
Function:     In GPIO mode, RCWL-9631 ultrasonic ranging module measures distance and displays it on the serial port
Notice:       Module default GPIO mode
Write:        Wuxi Richen IoT Technology Co., Ltd.
Test board:   RCWL-3310
Program customization:  13915288564
Connection :
   -VCC               = 3.3V/5.5V
   -Trig_RX_SCL_I/O   = A5
   -Echo_TX_SDA       = A4
   -GND               = GND
*/
 
float       distance;
const int   echo=A4;                         // echo to A4 pin
const int   trig=A5;                         // trig connected to pin A5
 
void setup()
{
  Serial.begin(9600);                        //Baud rate 9600
  pinMode(echo,INPUT);                       //Set echo as input pin
  pinMode(trig,OUTPUT);                      //Set trig as output pin
  Serial.println("RCWL-9610-GPIO Ranging start:");
}
 
void loop()
{
  
 digitalWrite(trig,HIGH);
 delayMicroseconds(500);
 digitalWrite(trig,LOW);              // Trig pin outputs 10US high level pulse trigger signal 
 
 distance  = pulseIn(echo,HIGH);      // Count the received high time
 distance  = distance*340/2/10000;    // Calculation distance 
                                      // 1: speed of sound: 340M/S 
                                      // 2: actual distance is 1/2 speed of sound distance 
                                      // 3: counting clock is 1uS
                                      // temperature compensation formula: 
                                      // c=(331.45+0.61t/℃)ms-1 (where 331.45 is at 0 Spend)
 Serial.print("distance: ");
 Serial.print(distance);              // Serial port output distance signal
 Serial.print("CM");                        
 Serial.println("");                 // new line
 delay(20);                          // After a single measurement is completed, 
                                     // add a 30mS delay before the next measurement. 
                                     // To prevent the aftermath of the last measurement 
                                     // When measuring at close range, resulting in inaccurate measurement.
 delay(100);                         // Delay 200mS to measure again, delay is not necessary

*

*
//-------------------------- UART (TX RX) -----------------------
/*
module:           RCWL-9610,RCWL-9631,RCWL-9620  Ultrasonic Ranging Module
Version:           V2.0
date:               20220710
Master chip:     RCWL-9631
Function:         RCWL-9631 ultrasonic distance measuring module distance measurement and serial port display in UART mode
Notice:           Need to set the module in UART mode
test board:      RCWL-3310
write:             Wuxi Richen IoT Technology Co., Ltd.
Program customization:  13915288564
I2C data format:        The IIC of RCWL-9631 outputs three 8BIT data, and the distance MM 
                         value = 24-bit data is converted into decimal/10000.
connection :
   -VCC               = 3.3V/5.5V
   -Trig_RX_SCL_I/O   = A5
   -Echo_TX_SDA       = A4
   -GND               = GND
*/
 
#include "SoftwareSerial.h"
SoftwareSerial mySerial(A4, A5);                      // A4 is RX, A5 is TX; A4 is connected to module TX, A5 is connected to module RX

float     Data_h = 0;                                 // 16-23bit
float     Data_m = 0;                                 // 8-15bit
float     Data_l = 0;                                 // 0-7 bits
float     distance = 0;                               // Distance data decimal value
 
void setup()
  Serial.begin(9600);                                 //Define serial port baud rate 9600 Factory default baud rate 9600
  mySerial.begin(9600);                               //Define the analog serial port baud rate
  Serial.println("RCWL-9631-UART Ranging start:"); 
}
 
void loop() 
{
    Data_h = 0;
    Data_m = 0;   
    Data_l = 0;
    distance=0;                                        //Initialize three 8BIT distance data and the distance value is 0
    
    mySerial.flush();                                  //Clear analog serial port cache data
    mySerial.write(0XA0);                              //Send the start ranging command 0XA0, 0XA0 is the start test command data
    
   delay(150);                                         //Measurement cycle delay, one cycle is 120mS, set 150MS, leave a margin  
     
   if (mySerial.available()>0)                         //Wait for 3 data to be received
   {
    Data_h= mySerial.read();                           //read cached data
    Data_m= mySerial.read(); 
    Data_l= mySerial.read(); 
   }
  else
   {
    Data_h= 0;                                         //The cache data cannot be read, and the data is cleared to 0
    Data_m= 0; 
    Data_l= 0;     
    }
    
   distance=(Data_h*65536+Data_m*256+Data_l)/10000;    //Calculated as CM value
       
   Serial.print("Distance:");                          //Remove the "Distance:" and "CM" to draw on the serial port
   
   if ((1<=distance)&&(900>=distance))                 //Numerical display between 1CM-9M
    {
   Serial.print(distance);
   Serial.print("CM");                                 //The serial port outputs the distance data, remove the "distance:" and "CM" to draw the serial port
    } 
   else 
    {
     Serial.println();    
     Serial.print(Data_h);
     Serial.println();    
     Serial.print(Data_m);
     Serial.println();    
     Serial.print(Data_l);    
     Serial.println();      
     Serial.print(" - - - - ");                          //Invalid value Numerical display - - - -
    }
    Serial.println();              //new line
    delay(20);                     // After a single measurement is completed, 
                                   // add a 30mS delay before the next measurement. 
                                   // To prevent the aftermath of the last measurement 
                                   // when measuring at close range, resulting in inaccurate measurement.
    delay(100);                    // Delay 200mS to measure again, delay is not necessary
}
*
 
*
*
//-------------------------- I2C (SDA, SCL) -------------------------------------
/*
module:           RCWL-9610,RCWL-9631,RCWL-9620 16MM Split Type Open Type Ultrasonic Ranging Module
Version:          V2.0
date:             20220710
Master chip:      RCWL-9631
Function:         RCWL-9631 ultrasonic distance measuring module distance measurement and serial port display in IIC mode
Notice:           Need to set the module in IIC mode
test board:       RCWL-3310
write:            Wuxi Richen IoT Technology Co., Ltd.
Program customization:  13915288564
I2C data format:        The IIC of RCWL-9610 outputs three 8BIT data, and the distance MM 
                         value = 24-bit data is converted into decimal/10000.
connection :
   -VCC               = 3.3V/5.5V
   -Trig_RX_SCL_I/O   = A5
   -Echo_TX_SDA       = A4
   -GND               = GND
*/
 
#include "SoftwareSerial.h"
#include "Wire.h" 
float    distance = 0;           // Distance data decimal value
float    ds[3];                  // [3] 8BIT distance data
 
void setup()
{
  Serial.begin(9600);           //Define serial port baud rate 9600 Factory default baud rate 9600
  Wire.begin();
  Serial.println("RCWL-9631 ranging start:"); 
}
 
void loop() 
{
   char i = 0;
    ds[0]=0;
    ds[1]=0;
    ds[2]=0;                       // Initialize three 8BIT distance data as 0
    
   Wire.beginTransmission(0x57);   // The address is 0X57, write 8-bit data as AE, and read 8-bit data as AF
   Wire.write(1);                  // Write command 0X01, 0X01 is the start measurement command
   Wire.endTransmission();         // I2C end command
           
   delay(150);                     //Measurement cycle delay, one cycle is 120mS, set 150MS, leave a margin   
   
   Wire.requestFrom(0x57,3);       //The address is 0X57 to read three 8-bit distance data     
    while (Wire.available())
    {
     ds[i++] = Wire.read();
    }        
    
   distance=(ds[0]*65536+ds[1]*256+ds[2])/10000;  //Calculated as CM value  
   Serial.print("distance:"); 
   
   if ((1<=distance)&&(distance<=900))  // Numerical display between 1CM-9M
    {
     #if 0
     Serial.println();    
     Serial.print(ds[0]);
     Serial.println();    
     Serial.print(ds[1]);
     Serial.println();    
     Serial.print(ds[2]);    
     Serial.println();      
     #endif                                      //#if 1, output 3 distance data of I2C
     
    Serial.print(distance);
    Serial.print(" CM ");  
    }
   else 
    {
     Serial.println();    
     Serial.print(ds[0]);
     Serial.println();    
     Serial.print(ds[1]);
     Serial.println();    
     Serial.print(ds[2]);    
     Serial.println();  
      
    Serial.print(" - - - - ");     //Invalid value Numerical display - - - -
    }
  
    Serial.println();              //new line
    delay(20);                     // After a single measurement is completed, 
                                   // add a 30mS delay before the next measurement. 
                                   // To prevent the aftermath of the last measurement 
                                   // when measuring at close range, resulting in inaccurate measurement.
    delay(100);                    // Delay 200mS to measure again, delay is not necessary
}
*
*
*
*
//-------------------------- 1 Wire (Trig I/O) ------------------------------

/*
Module:       RCWL-9610,RCWL-9631,RCWL-9620 16MM Split Type Open Type Ultrasonic Ranging Module
Version:      V2.0
Date:         20220710 
Master chip:  RCWL-9631
Function:     RCWL-9631 ultrasonic distance measuring module distance measurement and serial port display in single bus mode
Notice:       Need to set the module in 1-WIRE mode (R7 R8 = 10K)
Write:        Wuxi Richen IoT Technology Co., Ltd.
Test board:   RCWL-3310
Program customization:  13915288564
Connection :
   -VCC               = 3.3V/5.5V
   -Trig_RX_SCL_I/O   = A5
   -Echo_TX_SDA       NC (not connect)
   -GND               = GND
*/
 
float       distance;
const int   trig_echo=A5;               //Trig_RX_SCL_I/O connected to A5 pin
 
void setup()
{
  Serial.begin(9600);                   //Define serial port baud rate 9600 Factory default baud rate 9600
  pinMode(trig_echo,OUTPUT);            //Set Trig_RX_SCL_I/O as output
  Serial.println("RCWL-9631-1-WIRE Ranging start:");
}
 
void loop()
{
 pinMode(trig_echo,OUTPUT);              //Set Trig_RX_SCL_I/O as output
 
 digitalWrite(trig_echo,HIGH);
 delayMicroseconds(10);
 digitalWrite(trig_echo,LOW);           //Trig_RX_SCL_I/O pin outputs 10US high level pulse trigger signal 
 
 pinMode(trig_echo,INPUT);              //Set Trig_RX_SCL_I/O as the input to receive the distance signal fed back by the module
  
 distance  = pulseIn(trig_echo,HIGH);   //Count the received high time
 //Serial.print("Original value: ");
 //Serial.print(distance);
 distance  = distance*340/2/10000;      // Calculation distance 
                                        // 1: speed of sound: 340M/S 
                                        // 2: actual distance is 1/2 speed of sound distance 
                                        // 3: counting clock is 1US// temperature compensation formula: c=(331.45+0.61t/℃)ms-1 
                                        // (where 331.45 is at 0 degrees
 Serial.print("distance: ");
 Serial.print(distance);                          
 Serial.println("CM");                  //Serial port output distance signal
 //digitalWrite(trig_echo,LOW);   
 pinMode(trig_echo,OUTPUT);             // Set Trig_RX_SCL_I/O as output, ready for next measurement
 //Serial.println("");                  // new line
 delay(20);                             // After a single measurement is completed, 
                                        // add a 30mS delay before the next measurement. 
                                        // To prevent the aftermath of the last measurement 
                                        // When measuring at close range, resulting in inaccurate measurement.
 delay(100);                            // Delay 200mS to measure again, delay is not necessary
}

Blog

Related Products