This post shows how I built the electronics for an electrical Go-Kart
Imagine your dad rescued an old mobility scooter from the trash to build his grandsons a Go-Kart. Sounds a bit crazy but that is what my dad is doing right now 🙂 The scooter had disfunctional electronics but the mechanics worked fine. He tossed away everything except for the chassis (seat gone, steering motor gone, handle bars gone). Afterwards he attached a steering wheel to the front wheels so that it felt more like a kart. You can see a picture of the finished mechanics here:
But there was still a big problem left: How to control the DC-motor of the kart? Connecting it via a switch directly to the 24V battery was out of the question. Too fast and too dangerous for the children. That’s where I joined the project: To build a motor controller for the kart.
I looked at the original electronics of the scooter and found the H-bridge on a separate PCB. Nice!
But I did not have schematics for the PCB. So the only way was to reverse engineer the unit. It turned out to be quite an interesting journey. By following the traces on the PCB i was able to draw the most interesting parts of the PCB:
Here you see the H bridge with the MOSFET drivers. The bridge used NMOS transistors for both high side and low side. So I was curios: How did they manage to switch the high side? The source of the transistor was connected to the motor, the drain connected to +24V. To switch that transistor it would be necessary to have a gate voltage above 24V volts. But there is only a single 24V supply. Hmmm. So I continued to reverse engineer the PCB and found a cascade. That cascade is used to double the 24V to around 40V, which is enough to switch the high side. You can see the schematic of the cascade here:
The rest was easy: I grabbed an AVR and used a timer to generate the needed square wave (20KHz) for the cascade. Another timer is used to generate two PWM signals for the high sides of the H-bridge. The low sides are just switched on statically via GPIO lines.
Additionally, I connected the old joystick of the scooter to the AVR. This was also very simple since it had a potentiometer that I could easily read out with an analog input. With it the scooter is able to go forward and backward (half speed only), I also added an electrical brake. Driving around with it is actually quite fun. Maybe I should also look for a tossed away scooter 🙂
You can find a video of it driving here:
Its a bit shaky because the moving kart is changing the throttle on the joystick. But if you sit on it it’s quite smooth.
The source code is available here: https://bitbucket.org/befi/gokart