That Darn Second Law of Thermodynamics

If you can rig it so that it only kicks in when the driver needs to slow the car down and would ordinarily use the brake, that’s a reasonable idea, if you’re a hobbyist.
This is how the “brake mode” works in a Toyota Prius; it converts some of the kinetic energy in the car to electrical energy to charge the battery, rather than turning it into waste heat via the brakes.
