- Electrical Division
- Electrical Division Home
- Telemetry Group
- Monitoring
[ Electrical Division : Battery Monitoring ]
Created by [ Rohan Kumar], last modified on Apr 29, 2020
[Overview ]
We have had to have the 12V auxiliary battery replaced in the bolty
because it was drained after the rugged was left on overnight. To tackle
this issue a discord bot has been created to notify the team if the
battery is at critical levels (fluctuates 0.5V from the nominal
voltage).
Background Research
We contacted a member of GM about the car's 12V battery and how the CAN
signals were outputted, what to read, etc. The following is a brief
overview of what was said, and the basics on the battery.
- Unique CAN ID for the battery signal: 0x12A
- The byte to read is the 3rd byte in the sequence of outputs (there
should be 7 bytes total, therefore this byte is 3rd from the left)
- Read only the 7 rightmost digits of the 3rd byte to get your value
- The byte is not entirely accurate, to get a proper reading, divide
the number by 10 and add an offset of +3
Implementation
Due to the nature of the problem and discords minimum requirement of
python 3.5.3 for development we are running a docker container in which
the bot is running on the Rugged. The bot is placed on the rugged for
physical access to the CAN interface. The general idea is that the bot
reads realtime battery data from the bus, computes a rolling average of
the battery data from the last "X" seconds and compares it against the
nominal voltage. The script only sends a message if the battery
fluctuates more than 0.5V from its nominal voltage. The current code can
be
found here
TODO
- Rolling average (partially complete)
- Need to get nominal battery voltage reading, estimated around 12V?
- Stream serial CAN data into the Docker Container look
at: https://forums.docker.com/t/creating-and-sharing-virtualcan-network-interface-between-docker-containers/61596
- Test the whole project
- The channel id must be changed in Battery_Bot.py to the id of the
channel that should be notified in the Wato server. In order to add
the Battery Bot to the Wato server, the person adding the bot must
have the "Manage Server" permission to do so. Follow all of the
steps listed
here
to add the bot. The bot_token in Battery_Bot.py should also be
replaced with the token found by going to the Bot page in the
Developer
Portal.
Useful Resources
\
Document generated by Confluence on Nov 28, 2021 22:40
Atlassian