ptvoinfo / zigbee-configurable-firmware

PTVO firmware for CC2530, CC2531, and CC2652 Zigbee chips
https://ptvo.info/zigbee-configurable-firmware-features/
MIT License
192 stars 22 forks source link

Ultrasonic UART sensor (JSN-sr04t-v3-0) #267

Closed ptvoinfo closed 3 months ago

ptvoinfo commented 3 months ago

Serial mode operates at 9600 baud and works similar to serial mode on the US-100 module. The main difference is that it also returns a start byte and checksum byte. It also can be operated in an automatic mode of operation where the module is automatically triggered every 100mS.

The way Serial mode works is as follows:

The module is normally idle. A command bye of 0x55 on the RX pin initiates a detection cycle. The module responds with 4 bytes of information Start bye of 0xFF Most Significant Byte (MSB) Least Significant Byte (LSB) Checksum Byte

The returned value can be calculated using the formula (MSB * 256) + LSB.

The checksum byte is calculated using 0xFF + MSB + LSB. It returns the least significant byte of the calculation only.

It seems, that ptvo uses just the first two bytes, that is 255 and MSB and does not read the rest.