Reference

Output Format

SEN0301 Water-proof Ultrasonic Sensor (ULA) Output Format
Num Pin Description
1 VCC 5V~12V Power input
2 RX Receive serial data under RS232 mode
3 TX Output serial data under RS232 mode
4 Vout Output Voltage under voltage analog mode
5 GND Ground

RS232 Output

If currently it is not in the RS232 output mode, you can switch to this mode by short-pressing. when successfully switched, the LED flashes blue three times, stop 1 second and flashes three times again.

Every time the controller is powered on, it will automatically start detecting with 500ms working period, and "3.TX" will output one frame serial data.

If the input pin "2.RX" receives the correct serial command, the controller will output data under the control of the command. When receiving commands once, the controller will be triggerred once and output one frame serial data. But the trigger period must be over 60ms.

To distinguish between different controllers, users can change the addresses of different controllers through the corresponding instruction code. It won't be lost when powered down.

Command frame format of serial communication

Interface Type Start byte Data byte Stop byte Parity check Band rate
Full duplex 1 8 1 None 9600

Output frame format

Frame Header ID Controller Address(0x01 default) Distance Data High Distance Data Low Temperature Data High Temperature Data Low Checksum
0xFF Add Data_H Data_L Temp_H Temp_L SUM

Distance Calculation

Distance=Data_H*256+Data_L

Temperature Calculation

When the highest bit of Temp_H is 0, the temperature value is positive; when it is 1, the temperature value is negative.

If Temp_H=0x01=0b0000 0001, the most highest bit is 0, which means the temperature value is positive.

Temperature=Temp _H*256+ Temp _L

Checksum Calculation

Just reserve the eight lower bits of the accumulated value of checksum.

SUM=(frame header+ Data_H+ Data_L+ Temp_H+ Temp_L)&0x00FF

Example for Auto-output

SEN0301 Water-proof Ultrasonic Sensor (ULA) Output Format

T1=T2=T3=500ms

Example for Controlled Output

SEN0301 Water-proof Ultrasonic Sensor (ULA) Output Format

T1=1~55ms

Example 1

Read the distance and temperature of the controller whose address is 0x01.

Frame Header Add Control Command SUM
Host sends 0xFF 0x01 0x01 0x01
Frame Header ID Controller Address(0x01 default) Distance Data High Distance Data Low Temperature Data High Temperature Data Low Checksum
Slave sends back 0xFF Add Data_H Data_L Temp_H Temp_L SUM

Example 2

Change the controller address to 0x05

Frame Header Add Control Command SUM
Host sends 0xFF 0x05 0x03 0x07
Frame Header Add Control Command SUM
Slave sends back 0xFF 0x05 0x03 0x07

After the above instruction done, the controller address will be changed into: Add=0x05. The control command is 0x03, which is used to change address.

Principle

The sensor, like many other ultrasonic sensors, based on the principle of ultrasonic echo ranging, determines the distance to a target by measuring time lapses between the sending of a pulse and receiving of the echo without contacting.

Voltage Analog Output

Switch to Voltage analog output mode

Switch to the voltage analog output mode by short-pressing. When successfully switched, the LED flashes blue once, stop 1 second, and flashed once again.

The controller will automatically detect distance with 500ms period and output voltage in proportion to the detected distance.

Voltage vs Distance

SEN0301 Water-proof Ultrasonic Sensor (ULA) Voltage vs Distance

Calculation

Under voltage analog output mode, read the output voltage from the pin "4.Vout", then we can calculate the related distance. The controller's voltage from 0.0V to 3.30V corresponds with the distance from 0-330cm, which also means 0.01V is equal to 1cm. When the detected distance is larger than 330cm or no object is detected, it outputs 3.30V voltage.

Was this article helpful?

TOP