IMG_20180324_175544 - Copy

Electric Bike

This was my first "serious" electronics project.

I started building it in 2017, when I was still in school. Especially the controller on the handle underwent many revisions - I learned new stuff and kept adding new features.

Overview

A good friend of mine started building an electric skateboard. This inspired me to build myself an electric means of transportation too!*

I used a pre-made electric speed controller (VESC) since all of the high-power electronics were much too complex for me to design back then.

The part most of the work went into was the control box. It controlled the ESC by sending it a PWM-Signal. In addition to that it also measured the speed and many other parameters. Over the course of about two years I added new features and even re-designed the controller from ground up.

*a regular bicycle was often more convenient, but it was all about the fun ๐Ÿ˜€

IMG_20180209_204216

Hardware

IMG_20180130_120322

Most of my development efforts went into the hard- and software of the controller unit. It's mounted on the bike's handle bar, right in the middle. For this special purpose I designed 3D-printable mounts which allowed sliding on the case and then securely holding it in place.

The first image shows the second revision of the controller. This one already had many of the important features like:

  • Speedometer
  • Throttle level display
  • Clock
  • Battery charge status
  • Speed and distance statistics
  • Outside temperature measurement
  • RFID identification for unlocking
IMG_20211113_205626
IMG_20211113_205609

The third and final revision improved many things, especially visually. The screen now had touch and a higher resolution.

Here's a list of the new features

  • Touchscreen
  • Better RFID
  • Compass
  • Humidity sensor
  • Lux sensor
  • Air pressure sensor
  • UI improvements

An air pressure sensor was used to calculate the relative altitude change over a trip, which could be displayed in the stats window in the lower right corner.

 

The insides were not exactly the most organized by any measure - but already much better than the previous revisions.

IMG_20211113_205918
IMG_20211113_205938
IMG_20180128_124752

The bike has a front hub motor (3 phases, brushless, with sensors) that can get up to 30km/h with a fully charged 12S LiPo battery. A VESC controls the motor.

IMG_20180213_133450
IMG_20210801_161316

I built the battery pack myself. Starting with a 10S 5Ah battery, I later decided to upgrade to a 12S 5Ah battery, mostly for the added speed.

A water tight food container was used as a case for the cells.

LiPo batteries are pretty scary since they have such a high energy density and have pretty reactive chemistry. That's why I integrated a BMS into the battery pack to protect it during charging and balance the cells.

To charge the pack, I used a dedicated 200W charger.

Unfortunately the (peak) discharge currents, during acceleration for example, were too high for basically any BMS. To avoid over-discharging the battery, the VESC monitors the battery voltage and switches off if it drops too low.

 

Update on the batteries (2021): I haven't used or charged them in over a year. The batteries became very puffy and I had to discard them to avoid any sort of hazard.

 

IMG_20180225_144129

 

Lights - very important to be seen, especially if you are much smaller a car!

Both the front and back light were modified. The original case was used but the internals were exchanged for LEDs.

Firmware

The firmware was written in the Arduino IDE.

Back when I wrote it, I had no idea how to write good code. That's why I won't publish it.

Surprisingly, even to me, I never had any issues with my messy code though. ๐Ÿ‘

Images

Here are some additional images of the project.

Here is me riding the bike for the fist time with the motor working

IMG_20180210_140013

Luckily none of the components were stolen ๐Ÿ˜

IMG_20180406_094350
IMG_20180304_171634
IMG_20180408_150638 - Copy
Translate ยป