I am currently experimenting with some motor control circuitry for my garden train. I have spent several time trying to read up on the basics of motor control, and I have also done some prototyping. I have finally settled on a design, but I have a few different questions that I would appreciate if someone experienced could help me answer.
The question consists of two parts: (a) a system overview and (b) a few questions regarding the design. I am aware that this is a composite question, but I couldn't find a meaningful way of splitting them.
System Overview
The idea is to build a simple garden railway control system. The garden at hand is a small one, remotely placed. The only source of power will be the batteries that I bring. The layout is also to be automated over time, but for locomotives will be manually controlled, likely via a radio link.
Figure:
The track will be used as a power bus: a LiPo battery or two car batteries in series will be connected to the rail to provide power to all rolling stock, and in the future, lamps, switches and so on.
Locomotives will be picking up power from the track, but will receive motor commands via radio. In the future, the locomotives will hopefully be fully automated.
Loco Control
Each locomotive will be equipped with a small control circuit. The purpose is to both be able to drive the DC motor, as well as control the drive. The driver is centered around a H-bridge circuit (the L6202), and the control around an microcontroller (the ATmega328).
Figure:
As it is unknown how the locomotive has been placed on the track, a rectifier is first in line to give us a DC power line initially. This power is then fed into two different voltage regulators. One is to support the ATmega328 and whatever radio solution that will be chosen, and the other ons is to support the motor driver.
Questions
Now that I have explained the complete system, here are the questions:
The voltage regulator for the microcontroller (LM2937) will need to reduce the voltage from approx 20V DC to 5V DC. I am guessing most of it will be turned into heat. Is there any way to avoid this?
The microcontroller won't draw much current, but the motor will, and I guess there might be noise and transients from starting and stopping the motor. Do I need to protect the microcontroller (or its voltage regulator) from this? If so, how?
How can I protect a LiPo from short-circuits or other problems? I don't want any LiPo fires.
I guess those are the most important questions. I have lots of shorter questions, but I think the big questions. If you spot any other problems or improvements, please let me know.