Giter Site home page Giter Site logo

fes-battery-control's Introduction

fes-battery-control

Battery Controller for FES

Environment Setup

Install

Clone Git Repo

  • git clone https://github.com/esanya/fes-battery-control.git

Setup Python VEenv

  • python3 -mvenv fes-battery-control (the same folder as the checked out repository)

Install Dependencies

  • ./bin/pip3 install crccheck
  • ./bin/pip3 install telemetrix
  • ./bin/pip3 install paho-mqtt

Learning Python

PCB

Decoding the Protocol

The messages are defined as Kaitai Struct (https://kaitai.io/) in the protocol_fes.ksy file. Most of the messages are text. The LCD1 messages is binary.

Start the SW without HW

  • socat -d -d pty,raw,echo=0 tcp-listen:8083
  • ./bin/python3 ./dummybattery.py -p 8083 -lo=25
  • socat -d -d pty,raw,echo=0 tcp-listen:8084
  • ./bin/python3 ./dummybattery.py -p 8084 -lo=25
  • mkfifo /tmp/bttrymngr_ctrl.fifo
  • ./bin/python3 ./battery_ctrl.py -mt True -bu1 /dev/pts/X -bu2 /dev/pts/Y (/dev/pts/X,Y from the socat command output)

Read the logs

  • tail -f /tmp/bttrymngr_report.log

Controll the SW

  • echo "bat=all target_soc=70" > /tmp/bttrymngr_ctrl.fifo
  • echo "bat=all charge" > /tmp/bttrymngr_ctrl.fifo
  • echo "bat=all shutdown" > /tmp/bttrymngr_ctrl.fifo
  • echo "bat=all target_soc=60" > /tmp/bttrymngr_ctrl.fifo
  • echo "bat=all discharge" > /tmp/bttrymngr_ctrl.fifo
  • echo "bat=all shutdown" > /tmp/bttrymngr_ctrl.fifo

fes-battery-control's People

Contributors

esanya avatar

Watchers

 avatar

fes-battery-control's Issues

Decode the complete LCD1 message

Decode the LCD1 message. Currently only the SOC is decoded from it, but there should be other valuable data in it...

This could be done/tried by:

  • start the Windows management SW in a VM
  • send emulated battery messages to the VM changing different bytes in LCD1
  • check the management SW for changes

Autodetect USB devices

USB devices like:

  • FES battery 1
  • FES battery 2
  • arduino

should be detected automatically somewhere in

This could be done by checking the output for the command dmesg | grep "attached now"

As the USB devices are attached they produce some specific output in dmesg....

Add buttons / potenciometer to manually interact with the device

Integrate MQTT client

The SW should

  • provide status / notifications via MQTT (publish to a topic).
  • be controlled via MQTT (subscribe to a topic).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.