μSharp 360 Data Format

The current data format of μSharp 360 is simple, one packet of data consists of 4 Bytes. The first Byte can be considered as the header, which is the hexadecimal value 0xFE.

If any specific data format is required, please contact Aerotenna for more assistance.

Communication Procotol

The communication protocol is:

  • Standard UART
  • Baud rate is 115200 b/s
  • Data length is 8 bits, plus one start bit and one stop bit, and no parity bit
  • I/O standard is 3.3V LVTTL

Data Format for Serial Transmission Interface

The Byte structure is explained below. Note that an 'x' refers to a variable bit containing dynamic data.

Byte 10xFEPacket Header
Byte 20b00000xxxDirection
Byte 30bxxxxxxxxDistance (Least Significant 8 Bits)
Byte 40bxxxxxxxxDistance (Most Significant 8 Bits)
694

Direction Map

Explanation

Direction

Totally uSharp 360 has 8 directions, direction Byte represents the direction information that is scanning.

Distance

The distance bytes can be combined (total 16 bits) to represent the distance information in centimeters. The structure would be: 0x[MSB][LSB], where MSB and LSB are each two hexadecminal numbers (8 bits).

Note: When distance returns 0, it to mean 'no target detected' or 'infinity'.

Sample code in Python

from serial import Serial
import struct

serial = Serial('COM7', 115200, 8, 'N',1) # This sentence might be different in different machine
serial.flushInput()
serial.flushOutput()


while(1):
  byte0 = struct.unpack('B', serial.read(1))[0]  ## Receive Header

  if(byte0 == 0xFE ): ## Header = 0xFE
    dir_dist_data = serial.read(3) ## Rest data Bytes
    Data_Packet = []
    for i in range (0,3):
      bytes = struct.unpack('B', dir_dist_data[i])[0]
      Data_Packet.append(bytes)
    Data_Packet = [byte0, Data_Packet[0], Data_Packet[1], Data_Packet[2]] ## One full data packet, including the header

    print str(Data_Packet[0]) + ', ' + str(Data_Packet[1]) + ', ' + str(Data_Packet[2]) + ', ' + str(Data_Packet[3])  ## Print out one data packet

  else:
    continue