HWT101 Protocol

HWT101 Protocol

Instructions for use:

The serial port sending command must be completed within 10S, otherwise it will be automatically locked. To avoid automatic locking, the following steps can be performed.

1. Enter the unlock command

2. Enter the command that needs to modify or read the data

3. Save the command

Register

ADDR

(Hex)

ADDR

(Dec)

REGISTER NAME

FUNCTION

SERIAL

I/F

Bit15

Bit14

Bit13

Bit12

Bit11

Bit10

Bit9

Bit8

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

00

00

SAVE

save/rebbot/reset

R/W

SAVE[15:0]

03

03

RRATE

output rate

R/W

RRATE[3:0]

04

04

BAUD

Serial port baud rate

R/W

BAUD[3:0]

1A

26

IICADDR

device address

R/W

IICADDR[7:0]

1B

27

LEDOFF

turn off LED light

R/W

LEDOFF

27

39

READADDR

Read registers

R/W

READADDR[7:0]

2E

46

VERSION

version number

R

VERSION[15:0]

30

48

YYMM

year/mouth

R/W

MOUTH[15:8]

YEAR[7:0]

31

49

DDHH

day/hour

R/W

HOUR[15:8]

DAY[7:0]

32

50

MMSS

minute/seconds

R/W

SECONDS[15:8]

MINUTE[7:0]

33

51

MS

millisecond

R/W

MS[15:0]

38

56

GY

Angular velocityY

R

GY[15:0]

39

57

GZ

Angular velocityZ

R

GZ[15:0]

3F

63

Yaw

Heading angle

R

Yaw[15:0]

41

65

AUTOPTP

Automatically obtain zero bias peak-to-peak

R/W

AUTOPTP[15:0]

43

67

AUTOT

Automatically obtain zero bias time

R/W

AUTOT[15:0]

44

68

AUTOTH

Automatically obtain zero bias threshold

R/W

AUTOTH[15:0]

48

72

WORKMODE

working mode

R/W

WORKMODE[2:0]

4A

74

GYROPTP

Z-axis static peak-to-peak

R/W

GYROPTP[15:0]

4B

75

GPTPTIME

Z-axis peak-to-peak acquisition time

R/W

GPTPTIME[15:0]

4C

76

GYROBAIS

Z-axis zero bias value

R/W

GYROBAIS[15:0]

4D

77

GBAISTIME

Z-axis zero bias acquisition time

R/W

GYROBAIS[15:0]

4E

78

GSTATICTHRE

Z-axis static threshold

R/W

GSTATICTHRE[15:0]

4F

79

GSTATICTIME

Z-axis stabilization time

R/W

GSTATICTIME[15:0]

50

80

PGSCALE

Z-axis calibration factor P

R/W

PGSCALE[15:0]

52

82

GSCALERANGE

Z-axis calibration angle

R/W

GSCALERANGE[15:0]

61

97

GYROCALITHR

Static detection threshold

R/W

GYROCALITHR[15:0]

63

99

GYROCALTIME

Gyro auto calibration time

R/W

GYROCALTIME[15:0]

6A

106

WERROR

Gyroscope change value

R/W

GYROPTP[15:0]

6E

110

WZTIME

Angular velocity continuous rest time

R/W

WZTIME[15:0]

6F

111

WZSTATIC

Angular velocity integral threshold

R/W

WZSTATIC[15:0]

74

116

MODDELAY

485 data response delay

R/W

MODDELAY[15:0]

76

118

CALIYAW

Z axis angle to zero

R/W

CALIYAW[15:0]

Read format

  • Data is sent in hexadecimal, not ASCII.

  • Each data is transmitted in sequence by low byte and high byte, and the two are combined into a signed short type of data. For example, for data DATA1, DATA1L is the low byte and DATA1H is the high byte. The conversion method is as follows:

Assuming that DATA1 is the actual data, DATA1H is the high byte part, and DATA1L is the low byte part, then: DATA1=(short)((short)DATA1H<<8|DATA1L). It must be noted here that DATA1H needs to be coerced into a signed short type of data before shifting, and the data type of DATA1 is also a signed short type, so that negative numbers can be represented.

protocol head

Data content

Data lower 8 bits

Data high 8 bits

Data lower 8 bits

Data high 8 bits

Data lower 8 bits

Data high 8 bits

Data lower 8 bits

Data high 8 bits

SUMCRC

0x55

TYPE【1】

DATA1L[7:0]

DATA1H[15:8]

DATA2L[7:0]

DATA2H[15:8]

DATA3L[7:0]

DATA3H[15:8]

DATA4L[7:0]

DATA4H[15:8]

SUMCRC【2】

【1】TYPE(Data content):

TYPE

Remark

0x52

Angular velocity

0x53

Angle

【2】SUMCRC(data and checksum):

SUMCRC=0x55+TYPE+DATA1L+DATA1H+DATA2L+DATA2H+DATA3L+DATA3H+DATA4L+DATA4H

SUMCRC is a char type, taking the lower 8 bits of the checksum

Angular velocity

0x55

0x52

0x00

0x00

WyL

WyH

WzL

WzH

0x00

0x00

SUM

Name

Description

Remark

0x00

meaningless

0x00

meaningless

WzL

Angular velocity Z low 8 bits

Angular velocity Z=((WzH<<8)|WzL)/32768*2000°/s【1】

WzH

Angular velocity Z high 8 bits

WzL

Angular velocity Z low 8 bits

Angular velocity Z=((WzH<<8)|WzL)/32768*2000°/s【2】

WzH

Angular velocity Z high 8 bits

0x00

meaningless

0x00

meaningless

SUM

Checksum

SUM=0x55+0x52+WyL+WyH+WzL+WzH

【1】Raw data of angular velocity Z

【2】 The angular velocity Z obtained after the original data of the angular velocity Z is calibrated

Angle output

0x55

0x53

RollL

RollH

PitchL

PitchH

0x00

0x00

VL

VH

SUM

Name

Description

Remark

0x00

Meaningless

0x00

Meaningless

0x00

Meaningless

0x00

Meaningless

YawL

Yaw angle Z low 8 bits

yaw angle Z=((YawH<<8)|YawL)/32768*180(°)

YawH

Yaw angle Z high 8 bits

VL

Version number lower 8 bits

Version number calculation formula: version number=(VH<<8)|VL

VH

Version number high 8 bits

SUM

checksum

SUM=0x55+0x53+YawH+YawL+VL+VH

Read format

  • The following data, all using Hex code in hexadecimal

  • All settings need to operate the unlock register (KEY) first

protocol header

protocol header

register

Data lower 8 bits

Data high 8 bits

0xFF

0xAA

ADDR

DATAL[7:0]

DATAH[15:8]

  • Data is sent in hexadecimal, not ASCII.

  • Each data is transmitted in sequence by low byte and high byte, and the two are combined into a signed short type of data. For example, data DATA, where DATAL is the low byte and DATAH is the high byte. The conversion method is as follows:

Assuming that DATA is the actual data, DATAH is its high-byte part, and DATAL is its low-byte part, then: DATA=(short)((short)DATAH<<8|DATAL). It must be noted here that DATAH needs to be coerced into a signed short type of data before shifting, and the data type of DATA is also a signed short type, so that negative numbers can be represented.

SAVE (save/reboot/reset)

Register Name: SAVE

Register Address: 0 (0x00)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:0

SAVE[15:0]

Save: 0x0000

Reboot: 0x00FF

Factory reset: 0x0001

Example: FF AA 00 FF 00 (reboot)

RRATE(output rate)

Register Name: RRATE

Register Address: 3 (0x03)

Read and write direction: R/W

Default: 0x0006

Bit

NAME

FUNCTION

15:4

3:0

RRATE[3:0]

set output rate:

0001(0x01): 0.2Hz

0010(0x02): 0.5Hz

0011(0x03): 1Hz

0100(0x04): 2Hz

0101(0x05): 5Hz

0110(0x06): 10Hz

0111(0x07): 20Hz

1000(0x08): 50Hz

1001(0x09): 100Hz

1011(0x0B): 200Hz

1011(0x0C): 500Hz

Example: FF AA 03 03 00 (set 1Hz output)

BAUD RATE(Serial port baud rate)

Register Name: BAUD

Register Address: 4 (0x04)

Read and write direction: R/W

Default: 0x0002

Bit

NAME

FUNCTION

15:4

3:0

BAUD[3:0]

Set serial port baud rate:

0001(0x01): 4800bps

0010(0x02): 9600bps

0011(0x03): 19200bps

0100(0x04): 38400bps

0101(0x05): 57600bps

0110(0x06): 115200bps

0111(0x07): 230400bps

Example: FF AA 04 06 00 (set serial port baud rate 115200)

IIC ADDRESS(Device address)

Register Name: IICADDR

Register Address: 26 (0x1A)

Read and write direction: R/W

Default: 0x0050

Bit

NAME

FUNCTION

15:8

7:0

IICADDR[7:0]

Set the device address for I2C use

0x01~0x7F

Example: FF AA 1A 02 00 (set the device address to 0x02)

LEDOFF(turn off LED light)

Register Name: LEDOFF

Register Address: 27 (0x1B)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:1

0

LEDOFF

1: turn off LED light

0: open up LED light

Example: FF AA 1B 01 00 (turn off the LED light)

READADDR(Read registers)

Register Name: READADDR

Register Address: 39 (0x27)

Read and write direction: R/W

Default: 0x00FF

Bit

NAME

FUNCTION

15:8

7:0

READADDR[7:0]

Read register range: Please refer to "Register Table"

Example:

Send: FF AA 27 34 00 (read acceleration X-axis 0x34)

Return: 55 5F AXL AXH AYL AYH AZL AZH GXL GXH SUM

For details, please refer to "Read Register Return Value" in the "Read Format" chapter

VERSION(version number)

Register Name: VERSION

Register Address: 46 (0x2E)

Read and write direction: R

Default: none

Bit

NAME

FUNCTION

15:0

VERSION[15:0]

Different products, different version numbers

Example:

Send: FF AA 27 2E 00 (read version number, 0x27 means read, 0x2E is version number register)

Return: 55 5F VL VH XX XX XX XX XX XX SUM

VERSION[15:0]=(short)(((short)VH<<8)|VL)

YYMM~MS(on-chip time)

Register Name: YYMM~MS

Register address: 48~51 (0x30~0x33)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:8

YYMM[15:8]

mouth

7:0

YYMM[7:0]

year

15:8

DDHH[15:8]

hour

7:0

DDHH[7:0]

day

15:8

MMSS[15:8]

seconds

7:0

MMSS[7:0]

minute

15:0

MS[15:0]

millisecond

Example:

FF AA 30 16 03 (set year 22-03)

FF AA 31 0C 09 (set date 12-09)

FF AA 32 1E 3A (set minute seconds 30:58)

FF AA 33 F4 01 (set ms 500)

Example:

Send: FF AA 27 30 00 (read version number, 0x27 means read, 0x30 is year month register)

Returns: 55 5F YYMM[7:0] YYMM[15:8] DDHH[7:0] DDHH[15:8] MMSS[7:0] MMSS[15:8] MS[7:0] MS[15: 8] SUM

GY~GZ(Angular velocity)

Register Name: GY~GZ

Register address: 56~57 (0x38~0x39)

Read and write direction: R

Default: 0x0000

Bit

NAME

FUNCTION

15:0

GY[15:0]

Angular velocity Y=GY[15:0]/32768*2000°/s【1】

15:0

GZ[15:0]

Angular velocity Z=GZ[15:0]/32768*2000°/s【2】

[1] Raw data of angular velocity Z

[2] The angular velocity Z obtained after the original data of the angular velocity Z is calibrated

Yaw(yaw angle)

Register Name: Yaw

Register Address: 63 (0x3F)

Read and write direction: R

Default: 0x0000

Bit

NAME

FUNCTION

15:0

Yaw[15:0]

yaw angle Z=Yaw[15:0]/32768*180°

WORKMODE(Z-axis operation mode)

Register Name: WORKMODE

Register Address: 72 (0x48)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:4

3:0

WORKMODE[3:0]

Set the Z-axis operation mode:

0000(0x00): normal data mode

0001(0x01): peak-to-peak mode

0010(0x02): seek zero offset mode

0011 (0x03): find scale factor mode

Example: Send: FF AA 48 01 00 (Automatically obtain zero bias)

GYROPTP(Z-axis static peak-to-peak)

Register Name: GYROPTP

Register Address: 74 (0x4A)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:0

GYROPTP[15:0]

Parameters used in calculating zero bias, no need to set for sensor automatic acquisition

Write 0x01 to the "WORKMODE" register to enter the "peak-to-peak mode", in this mode the sensor automatically calculates the maximum and minimum values of the Z-axis angular velocity within the time set by "GPTPTIME" and records them in "GYROPTP". In "Zero Offset Mode", this data will be used to calculate and filter the zero offset.

Z-axis static peak-to-peak value = GYROPTP/1000 (°/s)

Example:

Send: FF AA 27 4A 00 (read Z-axis static peak-to-peak value)

Return: 55 5F 64 00 XX XX XX XX XX XX SUM

0x0064=100, Z-axis static peak-to-peak value = 100/1000=0.1 (°/s)

GPTPTIME(Z-axis peak-to-peak acquisition time)

Register Name: GPTPTIME

Register Address: 75 (0x4B)

Read and write direction: R/W

Default: 0x000A

Bit

NAME

FUNCTION

15:0

GPTPTIME[15:0]

Calculate the peak-to-peak time, the default is 10S

Example:

Send: FF AA 4B 0A 00 (set the Z-axis peak-to-peak acquisition time to 10S)

After entering the "Peak-to-Peak Mode", obtain the difference between the maximum value and the minimum value of the Z-axis angular velocity within the "GPTPTIME" time, store it in "GYROPTP", and use this data for zero bias in the "Zero Bias Mode". calculation filter.

GYROBAIS(Z axis zero bias value)

Register Name: GYROBAIS

Register Address: 76 (0x4C)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:0

GYROBAIS[15:0]

The zero bias value of the horizontal gyroscope, which can be obtained through the "Zero Bias Mode"

The Z-axis horizontal gyroscope has a certain zero bias value when placed at rest, and the angular velocity at rest can be eliminated by this zero bias value. The zero offset value can be automatically calculated by automatically obtaining the zero offset. Enter the "Zero Offset Mode" to automatically calculate the zero offset value according to the peak-to-peak value of "GYROPTP" and the "GBAISTIME" offset acquisition time.

Z axis zero bias value = GYROBAIS/1000 (°/s)

Example:

Send: FF AA 27 4C 00 (read Z-axis static peak-to-peak value)

Return: 55 5F 64 00 XX XX XX XX XX XX SUM

0x0064=100, Z-axis static peak-to-peak value = 100/1000=0.1 (°/s)

GBAISTIME(Z axis zero offset acquisition time)

Register Name: GBAISTIME

Register Address: 77 (0x4D)

Read and write direction: R/W

Default: 0x000A

Bit

NAME

FUNCTION

15:0

GBAISTIME[15:0]

Time required to calculate the zero bias value of the horizontal gyroscope

Example: Send: FF AA 4D 0A 00 (set the Z-axis zero bias acquisition time to 10S)

The time required to obtain the Z-axis zero bias, and the zero bias value is obtained according to this time when the zero bias is obtained.

GSTATICTHRE(Z-axis stillness threshold)

Register Name: GSTATICTHRE

Register Address: 78 (0x4E)

Read and write direction: R/W

Default: 0x0032

Bit

NAME

FUNCTION

15:0

GSTATICTHRE[15:0]

The larger the GSTATICTHRE[15:0], the weaker the seismic performance and the smaller the error

The smaller the GSTATICTHRE[15:0], the better the seismic performance and the larger the error.

Default value 50

The Z-axis horizontal gyroscope has slight data jitter when it is placed at rest. This parameter can filter out these slight jitters. When the angular velocity is less than the "GSTATICTHRE" setting value and lasts for the time set by "GSTATICTIME", it is regarded as stationary, and the Z-axis angular velocity is zero. This parameter can be appropriately increased when it is used in scenes with jitter and the Z-axis is accumulated due to jitter, and this parameter can be appropriately decreased in scenes with very slow and uniform rotation.

Z axis zero bias value = GSTATICTHRE/1000 (°/s)

Example:

Send: FF AA 4E 64 00 ((set the Z axis static threshold 0.1g), 0x0064=100, 100/10000=0.1(°))

GSTATICTIME(Z-axis settling time)

Register Name: GSTATICTIME

Register Address: 79 (0x4F)

Read and write direction: R/W

Default: 0x0064

Bit

NAME

FUNCTION

15:0

GSTATICTIME[15:0]

Z-axis judges the still time

Z-axis static judgment time threshold. It is considered stationary when the angular velocity is less than the value set by "GSTATICTHRE" for the time set by "GSTATICTIME". If the stabilization time is required to be higher, this parameter can be adjusted appropriately. Lowering this parameter can speed up settling time but may also increase error.

Z-axis stabilization time = GSTATICTIME/1000 (s)

Example:

Send: FF AA 4F 32 00 ((set the Z axis stabilization time to 0.05s), 0x0032=50, 50/10000=0.05(°))

PGSCALE(Z-axis calibration factor P)

Register Name: PGSCALE

Register Address: 80 (0x50)

Read and write direction: R/W

Default: 0x2710

Bit

NAME

FUNCTION

15:0

PGSCALE[15:0]

Range:0~20000

This parameter is written in the factory using a high-precision turntable, please do not modify it

There is an error in the measurement of the Z-axis gyroscope, and a high-precision turntable will be used to measure this error when leaving the factory, and this parameter will be written into the sensor. Do not modify this parameter unless necessary. This parameter can be automatically calculated in the "scale factor mode". After entering the "scale factor mode", rotate the sensor by the angle set by "GSCALERANGE" to calculate the calibration factor.

Z-axis calibration factor P=PGSCALE/10000.0

Example:

Send: FF AA 27 50 00 (read Z-axis calibration factor P)

Return: 55 5F 74 27 XX XX XX XX XX XX SUM

0x2774 = 10100, read Z-axis calibration factor P = 10100/10000=1.01

GSCALERANGE(Z-axis angle calibration range)

Register Name: GSCALERANGE

Register Address: 82 (0x52)

Read and write direction: R/W

Default: 0x02D0

Bit

NAME

FUNCTION

15:0

GSCALERANGE[15:0]

When calibrating the factor, it needs to be calibrated according to this parameter

Example:

Send: FF AA 52 68 01 ((set Z-axis calibration angle 360), 0x0168=360)

The required rotation angle of the Z axis in the "scale factor mode" is generally set to an integer multiple of 360°.

GYROCALITHR(Gyro Rest Threshold)

Register Name: GYROCALITHR

Register Address: 97 (0x61)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:0

GYROCALITHR[15:0]

Set the gyroscope inactivity threshold:

Gyro Gyro Still Threshold=GYROCALITHR[15:0]/1000(°/s)

Example:

FF AA 61 32 00 (set the gyro static threshold to 0.05°/s,

0x0032=50, 50/1000=0.05(°/s))

When the angular velocity change is less than 0.05°/s and lasts for the time of "GYROCALTIME", the sensor recognizes it as stationary and automatically resets the angular velocity less than 0.05°/s to zero

The setting rule of the static threshold of the gyroscope can be determined by reading the value of the "WERROR" register. The general setting rule is: GYROCALITHR=WERROR*1.2, unit: °/s

This register needs to be used in conjunction with the GYROCALTIME register

GYROCALTIME(Gyro auto calibration time)

Register Name: GYROCALTIME

Register Address: 99 (0x63)

Read and write direction: R/W

Default: 0x03E8

Bit

NAME

FUNCTION

15:0

GYROCALTIME[15:0]

Set gyroscope auto-calibration time

Example: Set gyroscope auto-calibration time to 500ms

FF AA 63 F4 01

When the angular velocity change is less than "GYROCALITHR" and lasts for 500ms, the sensor recognizes that it is stationary and automatically resets the angular velocity less than 0.05°/s to zero

This register needs to be used in conjunction with the GYROCALITHR register

WERROR(Gyroscope change value)

Register Name: WERROR

Register Address: 106 (0x6A)

Read and write direction: R

Default: 0x0000

Bit

NAME

FUNCTION

15:0

WERROR[15:0]

Gyroscope change value=WERROR[15:0]/1000*180/3.1415926(°/s)

When the sensor is stationary, the "GYROCALITHR" register can be set by changing this register

WZTIME(Angular velocity continuous rest time)

Register Name: WZTIME

Register Address: 110 (0x6E)

Read and write direction: R/W

Default: 0x01F4

Bit

NAME

FUNCTION

15:0

WZTIME[15:0]

Angular velocity continuous rest time

Example: Set the angular velocity continuous static time to 500ms

FFAA 6E F4 01

When the angular velocity is less than "WZSTATIC" and lasts for 500ms, the angular velocity output is 0, and the Z-axis heading angle is not integrated

This register needs to be used in conjunction with the "WZSTATIC" register

WZSTATIC(Angular velocity integral threshold)

Register Name: WZSTATIC

Register Address: 111 (0x6F)

Read and write direction: R/W

Default: 0x012C

Bit

NAME

FUNCTION

15:0

WZSTATIC[15:0]

Angular velocity integral threshold=WZSTATIC[15:0]/1000(°/s)

Example: Set the angular velocity integration threshold to 0.5°/s

FF AA 6F F4 01

When the angular velocity is greater than 0.5°/s, the Z-axis heading angle starts to integrate the acceleration

When the angular velocity is less than 0.5°/s, and the duration set by the register "WZTIME", the angular velocity output is 0, and the Z-axis heading angle is not integrated

This register needs to be used in conjunction with the "WZTIME" register

CALIYAW(Z-axis angle to zero)

Register Name: CALIYAW

Register address: 118(0x76)

Read and write direction: R/W

Default: 0x0000

Bit

NAME

FUNCTION

15:0

CALIYAW[15:0]

Set the Z-axis to zero:

0 (0x00): Z-axis returns to zero

Example: FF AA 76 00 00 (Z-axis angle return to zero)

Last updated