**The Electric Bike Conversion Project: Creating a Sensored ESC**
As warm seasons approach, it's time to free my bicycle from dust and oil its chain. And, as you can see, its mechanical drive system still works without a problem. But for an electronics enthusiast like me, it's kind of boring... That is why I ordered an E-bike conversion kit for around 200 euros ($246.95 US), which is not a bad deal if you compare the price to commercial E-bikes.
Once I received the kit, I unpacked all the delivered goods and found the front wheel with integrated hub motor, a throttle, brakes, and electric speed controller, and a couple of complementary components. So, I simply removed my old front wheel, as well as my front disc brake, and secured the new electric front wheel in place. The whole process barely took around 10 minutes.
Next, I wanted to test the new wheel at home, and thus connected the three motor wires... Along with the motor sensor connector, and the throttle connector to the electric speed controller, according to how the manual describes it. Then, I connected the battery connector to my lab bench power supply, which was set to its maximum voltage of 30 volts.
By powering up the system, and turning the throttle control, the motor tried to start spinning, but never succeeded. The problem is that the 30 volts are, apparently, not high enough voltage for the electric speed controller... which is something that bothered me quite a lot. So in this video, we will create our own sensored electric speed controller, which does work with low voltages and thus allows me to test my new electric front wheel extensively.
**The Theory Behind BLDC Motors**
Let's get started! This video is sponsored by JLCPCB. One fact about them: JLCPCB produces 200,000 square meters (656,000 feet) of single, double, or multiple layer PCBs monthly. Upload your Gerber files to order ten professional PCBs for only $2.00!
To create a suitable sensored ESC, let's firstly have a closer look at the hub motor. After removing its metal cover, we can see that it consists of a dozen of coils on the inside, which do not move when the wheel is rotating.
Simplified, the coil arrangement would look something like this: with the wires A, B, and C being leads through the outside. The rotating parts of the hub motor consist of neodymium magnets with alternating polarity... which according to how current flows through the coil arrangement aligned in a certain way due to the magnetic forces.
That means what we're dealing here with is a so-called BLDC motor, aka a brushless direct current motor. I already talked about how you can make them rotate by creating your own ESC in a previous project, so definitely have a look at that if you want to know more about the theory behind it.
**Creating the Sensored ESC**
What the code basically does is firstly waiting for state change of one of the Hall effect sensors? If one happens, the Arduino determines which step needs to be activated. Then timer one says okay, let's activate the corresponding MOSFETs of the step.
After a certain amount of time, which is determined by the potentiometer, timer one then says let's connect all phases to one another and take a quick break before we power the phases once again. This creates a PWM signal which basically lowers the average voltage and thus lowers the current.
Which lowers the magnetic forces and thus the rotation speed. This process continues until there's an another Hall effect sensor state change, which then activates the next step. So in theory, the code should work fine...
**Testing the Sensored ESC**
Which means it was time to upload it connect the motor wires as well as the Hall effect sensor wires to the boards and power it all up... and as you can see the wheel starts rotating and the speeds can be adjusted by the potentiometer.
But as expected, the wheel rotates rather slowly with a 15-volt supply voltage. But it is still a lot of fun to play around with! I hope you enjoyed watching this video and are looking forward to the next episode of the electric bike conversion project.
As always, don't forget to Like share and subscribe. Stay creative, and I will see you next time!