E-Bike system – Part 1 – Introduction

I’m currently working on replacing the complete electric system on my E-bike. The new system will be completely DIY and consist of several parts connected by a CAN-bus. I will post about the progress here continuously.

The system will be divided into several parts, all of them controlled by a STM32-series ARM Cortex-M processor running ChibiOS RTOS. The image below shows a system overview.

Overview of E-Bike system
Overview of E-Bike system

Handlebar Control Unit [HCU]

The main node controlling the rest of the bike will be mounted on the handlebars. Later on I’m thinking about something with a ~4.3″ TFT screen. To begin with it’ll probably be something much simpler. The main tasks would be to sample the acceleration and braking request and forward to the motor controller. It will also controll and display status from the BMS

Motor controller [DCAC]

I will probably start with a VESC with a redesigned PCB more suitable for e-bike use with heftier power transistors. Perhaps I’ll develop my own software to this later on since I find motor control software very interesting.

Battery Management System [BMS]

The battery will be built of 12 cells long series of 18650 cells. To monitor, balance and protect these I will build a BMS around the Maxim MAX14920 chip. This is an analog front end for voltage level conversion and balance discharge of 12 cell batteries. A STM32F373 processor will handle the sampling, control SoC estimation and communication with the rest of the system. The BMS will be able to continue running after the rest of the bike is shut down to handle charging and balancing after a ride.

Voltage Stepdeown [DCDC]

To generate 12 V from the main battery for driving the other nodes and things like lights. To begin with this will probably be designed around an off-the-shelf switching regulator controlled with a hard wire from the BMS which should have its own power supply.

CAN interface [CAN2USB]

This will be the first part I develop, the first prototype is already built up and somewhat tested. I will write a longer post about this later on. The CAN interface will be used to be able to download software, parameters and to read diagnostics using a computer. There are comersialy available alternatives but how fun is that. I manage to get the BoM down to the $10-$15 range as well. The can interface is based on a STM32F042 processor with built-in crystal-less USB and a CAN transceiver chip. This will talk with a Windows application over a virtual com port. The Windows application is written in C# using the community edition of Visual Studio.


A “dumb” standard Lithium battery charger like the one I have for my previous E-bike could be used as a start, but it would be nice if the charger was connected to the CAN-bus and let the BMS handle the charge and current control.


The mechanics will be the same ase described in for example [these] posts. The difference is that the bike will be touched up quite a lot with both paint and parts.

Leave a Reply

Your email address will not be published. Required fields are marked *