Running a DC motor with PWM

Thank you for the input. I am going to try some stuff and see what happens. If your wondering this is for a little HO train. I am going to have a pro mini in the train with a motor driver. Its going to be controlled by infrared lights that tell it when to stop and when to go. getting the motor to ramp up and stay up is my only problem. I will try somethings today. Thank you for your help.