View Single Post
Old 01-28-2019, 10:11 PM   #45
martinbogo
Junior Member
martinbogo is on a distinguished road
 
Join Date: Mar 2007
Posts: 53
5 yr Member
Default

The Segway battery exposes interesting data on the following registers on i2c when read in the same way as the battery voltage values ( 3 bytes read, discard first byte, data encoded on 2nd and 3rd byte )

Register 12 ( 0xC ) reads 31 triplets. Byte 0 ( unknown ) , Byte 2 counts from Hex 0 -> 1E, Byte 3 ( unknown )
Register 204 ( 0xCC ) reads 31 triplets. Byte 0 ( unknown ), Bute 2 counts from Hex 0 -> 1E, Byte 3 ( unknown )
1st and 3rd values repeat after 31 reads, both registers show the same data

Register 198 ( 0xC6 ) reads 37 triplets. Byte 0 ( unknown ), Byte 2 counts from Hex 0 -> 25, Byte 3 ( unknown )
1st and 3rd values repeat after 37 reads

Example of the data - register number in <>, values in hex

<12> [C3:0:B0] [F1:1:1] [BE:2:33] [3F:3:31] [37:4:38] [3A:5:34] [C:6:61] [34:7:38] [A8:8:43] [27:9:43] [A6:A:43] [25:B:43] [37:C:30] [33:33] [A3:E:42] [A2:F:42] [21:10:42] [20:11:42] [31:12:30] [2D:13:33] [3F:14:20] [3E:15:20] [3D:16:20] [3C:17:20] [BB:18:20] [BA:19:20] [B9:1A:20] [83:1B:55] [82:1C:55] [D5:1D:81] [DC:1E:F9]
<204> [C:6:61] [34:7:38] [A8:8:43] [27:9:43] [A6:A:43] [25:B:43] [37:C:30] [33:33] [A3:E:42] [A2:F:42] [21:10:42] [20:11:42] [31:12:30] [2D:13:33] [3F:14:20] [3E:15:20] [3D:16:20] [3C:17:20] [BB:18:20] [BA:19:20] [B9:1A:20] [83:1B:55] [82:1C:55] [D5:1D:81] [DC:1E:F9] [C3:0:B0] [F1:1:1] [BE:2:33] [3F:3:31] [37:4:38] [3A:5:34]

<198> [AA:0:4F] [F7:1:1] [45:2:32] [46:3:30] [3C:4:39] [3E:5:36] [3C:6:37] [42:7:30] [41:8:30] [40:9:30] [BF:A:30] [3D:B:31] [2C:C:41] [24:48] [BA:E:31] [BA:F:30] [38:10:31] [38:11:30] [AE:12:39] [32:13:34] [2E:14:37] [A1:15:43] [33:16:30] [B1:17:31] [31:18:30] [AA:19:36] [AE:1A:31] [AA:1B:34] [2D:1C:30] [2C:1D:30] [AB:1E:30] [21:1F:39] [A1:20:38] [83:21:55] [2:22:55] [5E:23:F8] [27:24:AE] [D4:25:0]


Register 23 ( 0x17 ) reads 4 triplets. Byte 0 ( unknown ), Byte 2 increments 0x1,0x11,0x21,0x31, byte 3 ( unknown )
Register 215 ( 0xD7 ) reads 4 triplets. Byte 0 ( unknown ), Byte 2 increments 0x1,0x11,0x21,0x31, byte 3 ( unknown )
1st and 3rd values repeat after four reads - these are likely the temperature readings on two registers

<23> [7F:1:68] [F3:11:64] [4E:21:79] [4A:31:6D]
<215> [7F:1:68] [F3:11:64] [4D:21:7A] [4A:31:6D]

This data parses to the following binary:

Code:
0001 0001 0110 0100
0010 0001 0111 1010
0011 0001 0110 1101
---- Measurement index nibble
     -------------- Possible A/D conversion of the temperature ( 12 bit, or 10 bit? )
If this is the case, this looks similar to a Texas Instrument 12 bit ADC converter, and you take the 12-bit value and multiply it by 0.0625 to get the temperature in Centigrade.

Taking the example data :

0b000101101101 = 365
365*0.0625 = 22.81 centigrade -- which is plausible for the temp in my lab

And of course, registers 150 (0x96) and 86 (0x56) contain the battery voltage data encoded as:

Byte 0 (checksum) : Byte 1, Byte 2 are the MSB and LSB of a 16 bit integer. Top 3 bits are the battery index. Lower 10 bits are A/D converted battery voltage data, where each tick represents 8 volts / 1023 steps.

Last edited by martinbogo; 01-28-2019 at 11:03 PM.. Reason: Adding example data
martinbogo is offline   Reply With Quote