DIY E-Kart Motor Controller using ESP32 and IR2101 [Suggestions]

I am currently designing a DIY motor controller with an ESP32 as a microcontroller.

This is the initial design I came up with:

Since I’ll be using a 1000W or above BLDC with Hall Sensors running at 48V, current sense is a must for better torque control, right? I am currently interested in implementing Low-Side Current Sense with my design since it can operate with only 2 sensors but I am currently in a pinch.

My Questions:

  • Do you have any suggestions on my initial design based on the parameters I mentioned?
  • What type of current sense amplifier is the simplest and easiest to implement?


Why do you want to use simpleFOC for such a usecase?
FOC algorithm is much slower than traditional 6-step commutation, which means lower RPM/speed.
SimpleFOC doesn’t have regen braking, which might be nice_to_have in an e-kart.
The best feature of FOC is angle/position control, but that’s something you won’t need in an e-kart…

My choice would be an off the shelf 12- or 18 FET e-bike controller with regen braking and thumb-throttle input.

Just my 2 cents

1 Like

I’d like to make my own from scratch, so I’m considering to use SimpleFOC for its easy-to-implement features and remarkable control.

Regen braking is not a feature I’m considering for this one yet, but I’m going to take note of that for a future build. Thanks!

  • FOC is ideal for such use case, it provides better torque control and freewheeling
  • Regen braking is also possible with SimpleFOC, we just need to be able to limit the DC current to protect the battery from overcharging or overdischarging. This can be done by estimating the dc current with formulas(not implemented in SimpleFOC yet) we already mentioned in the forum, or measuring the dc current directly (no API in SimpleFOC for this).
  • I am not sure if analogread can be used to sample the throttle/brake inputs while using current sensing on ESP32 , to be confirmed
  • No field weakening support but that can be dangerous anyway

Thank you for your insights!

I won’t be using Regen Braking (for now), so I’ll just find a way to dissipate the extra power given by the motors on braking.

I will definitely look into this one. In case I can’t use my ADC due to current sensing, I think I’ll be using another microcontroller to sample and send driver inputs to the motor controller esp32 via serial, this will also be a way to send motor controller data for monitoring.

Feel free to comment on what I’ve just said if you think something’s wrong.

I can use a simple op-amp and a shunt resistor for the current sensing right? Considering the gain value and resistor value for SimpleFOC.

Right if you have mechanical brakes, you don’t need regen.
Scooters also use a separate board for display/configuration/throttle, you can do the same.

SimpleFOC doesn’t support FOC with a single phase current shunt, you need at least 2 phase currents for FOC, best being having 3 phase currents

Thanks again, I’ll be using Low-Side Sensing with 2 current shunts, sorry if I didn’t mention it before.

I’ll post an update as soon as there’s progress with my project.

Thank you!