The project I'm working on is an electrically powered vehicle. I have found this fairly simple circuit to control my motor's speed.
What I understand is that when the transistor is closed the battery is feeding energy into the motor which moves the vehicle. When the transistor is open the motor is freewheeling and the diode is there to protect the transistor from some kind of voltage that builds up when the motor is rapidly being powered on and off such as is the case with PWM speed control. Here raises question #1: as the motor is spinning and the transistor is open the magnetic fields of the permanent magnets are still inducing voltage in its coils and thus current, which is energy. Where does that energy go? This question is more of curiosity.
The real question I would like to ask is how I can implement regenerative braking with this setup, which is perfectly explained in this question but I appear to be retarded in some way and I would be really grateful if a simpler explanation can be given.
My understanding is that I would need something similar to this:
Where I will have to first close the upper transistor effectively shorting the motor then when it starts building up voltage I will have to open that and close the lower transistor allowing that voltage to go into the battery and it goes back and forth. The author mentions though that if I'm using PWM then I probably already have regenerative brаking and from what I understand I would need to implement some serious driver logic which is completely in contrast to what the author is saying. Additionally what happened with the diode, what is protecting the transistors now? I tried adding 2 diodes but I get a short no matter what I tried... Obviously I need some help.
Note: It's a brushed permanent magnet motor.