Skip to content

Commit e8851b2

Browse files
committed
CAN dump and test script added, small changes in thingset library
1 parent 09c997d commit e8851b2

File tree

5 files changed

+3344
-3
lines changed

5 files changed

+3344
-3
lines changed

test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# use test/candump.txt for testing with real CAN data
2+
#
3+
4+
from thingset.cansocket import CANsocket
5+
sock = CANsocket('can0') # or other interface
6+
7+
while(True):
8+
frame = sock.receive()
9+
if isinstance(frame.cbor, float):
10+
print("device: 0x%x data id: 0x%x value: %.2f" % (frame.source, frame.dataobjectID, frame.cbor))
11+
else:
12+
print("device:", hex(frame.source), " data id:", hex(frame.dataobjectID), " value:", frame.cbor)
13+

test/Readme.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# CAN device information
2+
3+
In the final implementation of the protocol, the name of each data ID can be read from the device. For now use the tables below to associate data to measurement value:
4+
5+
Use test.py in root folder to dump data from the CAN bus.
6+
7+
## BMS
8+
9+
Device ID: 0x00
10+
11+
| Data Object ID | Data Name |
12+
|--------|------|
13+
| 0x4001 | vBat |
14+
| 0x4002 | vLoad |
15+
| 0x4003 | vCell1 |
16+
| 0x4004 | vCell2 |
17+
| 0x4005 | vCell3 |
18+
| 0x4006 | vCell4 |
19+
| 0x4007 | vCell5 |
20+
| 0x4008 | iBat |
21+
| 0x4009 | tempBat |
22+
| 0x400A | SOC |
23+
24+
25+
## MPPT
26+
27+
Device ID: 0x0A
28+
| Data Object ID | Data Name |
29+
|--------|-------|
30+
| 0x4001 | vBat |
31+
| 0x4002 | vSolar |
32+
| 0x4003 | iBat |
33+
| 0x4004 | iLoad |
34+
| 0x4005 | tempExt |
35+
| 0x4006 | tempInt |
36+
| 0x4007 | loadEn |
37+
| 0x4008 | eInputDay_Wh |
38+
| 0x4009 | eOutputDay_Wh |
39+
| 0x400A | eInputTotal_Wh |
40+
| 0x400B | eOutputTotal_Wh |

0 commit comments

Comments
 (0)