12V DC Model Train Arduino controller simulating momentum

Having kids now I thought its time to dust off the old model train set - nothing fancy just plain old 12V DC model.
Having kids now I thought its time to dust off the old model train set - nothing fancy just plain old 12V DC model.
When I was about 16 I etched and build an analogue controller to replace the stock transformer and I was amazed at the result - no longer did I have to go push start a Locomotive on the other end of the room! With this unit I had a momentum, brake and emergency brake in addition to the throttle.
One day I still plan to reverse engineer (the wrong word here) since it will be more like PCB archeology in this case.
So back to today and being the wrong side of 40... So I got a free breadboard, Arduino, LM298 and display and got busy. I have a basic prototype but not ready for the tracks...
Aims
Hoping to make it easy to use - perhaps switching off momentum etc. else the kids will loose interest, and mum will cut subsequent funding for this project.
Safe so that if they flip the direction, the train should at least slow down first before speeding up in the other direction... even limiting top speed.
Simultate momentum, not true to scale but perhaps adustable depending user.
Brakes, Emergency brake, Direction and throttle.
Questions:
- I have searched for similar projects on the web / Elektor but no success. Is there something I missed? Since that might just put a brake on this proposal...
- Simulating momentum. Since I completed school before momentum was discovered I currently simulate this with a weighted average of a PWM output over a 5-second period. I found some research papers about real world train controller maths, but the maths would be too much for the Arduino I guess ;-)
- I have not yet hooked up an Oscilloscope but I have seen other clever clogs complaining the the H-Bridge LM298 output might not be the best for a 12V DC motor. This I need to investigate further. Any jump starters?
Updates van de auteur
jordaaaa 8 jaar geleden
The system:
A model train controller for 12DC trains simulating momentum, so that the train pulls away slowly or comes to a stop slowly depending on its load (set by a pot).
Both the throttle and Brakes are ALPS faders with the Throttle fader being motorised.
A Direction toggle switch sets the direction (forward or reverse)
Three LEDS for status or messages and an OLED display showing the simulated speed, direction, load, and other messages e.g Brakes On!
Pushing up the throttle, the train slowly speeds up. This depends on the Load pot that could represent the trains weight in tonnes ( or whatever)
Pushing the brakes will slow the train down again depending on the load. A heavier train will take longer to stop.
Pushing the brakes up further (more than about 2/3) activates the emergency brakes.
Its also not possible to change direction when the train is not standing still - a message will remind you on the OLED.
Hardware:
Current setup is a Arduino Micro plugging in on a PCB (Micro base) with suitable connectors to Motor driver board, PSU and components to drive an OLED display. To keep things simple and recycle as much as possible I opted to have a standard PSU using an external 12-14VDC 2A supply fed through the stock standard LM317 PSU boards, one for 5V and another for 12V regulation.
Instead of designing all on a single PCB, I preferred to split functions so as to ease future upgrades and reusability. Thus a PSU board, L298 driver, and Micro base. Scrapping this one day I hope to reuse all but perhaps the Micro base board.
The motor driver is currently a stock standard L298 board, commonly available.
Simulating momentum:
A pot on the Train controller is used to set the weight (load) of the train. This is defined in software and limited between 5 and 200 tonnes. Changing the load affects thr momentum and thus time to speed up or slow down.
The load is also feeding a PID algorithm and with the current throttle or brake position sets the current track voltage to simulate momentum.
Currently this sort of works but Im sure it can be simplified and made even more realistic.
Current issues:
A few known issues I still need to sort or fix....
PCB - better design to fit components.
Expand IO using AD5593?
Circuit design - verify or fix LED pins.
VTrack measure?
Touch sense on motorised fader.
An alternative for simulating momentum... Need Help!
Further ideas:
Perhaps a sort of fuel guage (steam/coal or diesel). Runs for a certain time and then needs a refill.
Set speed, direction etc via serial port for programmability e.g demos
Nothing new. One needed for 12V (Train) and one for 5V (Arduino) (86kb)
Where the Arduino Micro plugs in (160kb)
Stock standard as well (40kb)