vedderb / bldc

The VESC motor control firmware
2.16k stars 1.35k forks source link

New feature: control psu flatpack2 over CAN bus with vesc #473

Open livello opened 2 years ago

livello commented 2 years ago

There is an electric bike with a 750 Wh battery. I use flatpack 2 48V for charging. I charge on the way several times every 40-60 kilometers. 35A is too much charging current for everyday use. screenshot_2022-04-17_20_20_40

It is required to control voltage and current, send commands via the CAN bus. It seems to me that the easiest way would be to use the engine power limit value as the charger power target.

There are a lot of such power supplies at a flea market at a price of 50 dollars.

The control protocol for flatpack is known. Here are a few projects that I would like to draw on. https://github.com/the6p4c/Flatpack2 https://github.com/tomvanklinken/Flatpack2

Tell me how best to implement such an improvement so that it can be included in the upstream.

Teslafly commented 2 years ago

Something that this brings up, in seperation from the specific protocol used. Is support for chargers in general. Now that the bms is integrated, having a charger page with charging current and max voltage would probably be reasonable. You could use profiles as well to quickly select what type of charging you want to do. (fast to 80%. Slow to 100%, etc)

livello commented 2 years ago

@Teslafly thank you! I did it in haste. The next step I plan to add is the charge control application and register the calback in the comm_can.c

https://user-images.githubusercontent.com/15374538/165636411-6e7b3e47-a9cd-43a7-812b-f316f111e7be.mp4

https://user-images.githubusercontent.com/15374538/165636433-a31408fe-5a37-47e2-a20a-3f6124c87c0c.mp4

https://user-images.githubusercontent.com/15374538/165636472-84a9ae6f-7cf4-432e-b7a6-07b6087feb74.mp4

https://github.com/livello/bldc/tree/dev_fw_5_03

vedderb commented 2 years ago

This sounds like something that can be done with lispbm and/or with QML scripting.

Very interesting charger! I just ordered one.