Response to Austrains' announcement of a C30 tank and C30T
An Announcement from Austrains - SDS acquisition
Connecting loco and tender - Hornby Top Tips
Trainorama 830 class 847 review
Under the Portuguese Sun - Tree planting
Bachmann new GWR Earl Class review
Reconnecting with a childhood hobby
James May urges nation to 'save Hornby' as shares plunge 62%
Hornby boss quits after third profit warning in five months
Statement from Ixion Model Railways Ltd
A while back, I came across this video on YouTube:
Then I thought, why not use this to control a model railway?!
I got the PS/2 keyboard library for Arduino from here. Since I still didn't had any PS/2 keyboard, I went out and bought a used one from a computer repair shop.
After a few minutes of fiddling with wires and tinkering with the Arduino code, I got it working.
Controlling a model railroad
For communicating with a PS/2 keyboard, I used an Arduino UNO microcontroller and used the Arduino IDE to program it. For driving the locomotive and the solenoid-based turnouts, I used an Adafruit Motor Shield V2. It used only two digital I/O pins of an Arduino board which leaves plenty of room to connect other modules and devices to the board, including a PS/2 keyboard.
For controlling the track power for the locomotive, I used a variable in the code for storing the speed of the locomotive, ranging from -255 to 255 where -ve numbers make the locomotive move backward. I mapped the up and down arrow keys to increase and decrease the value of the variable in the range(-255 to 255).
I've used two turnouts whose controls had been mapped to the number keys. 1&2 for first turnout and 3&4 for the second one.
You can find full documentation and the source code for this project here.
I hope you will enjoy making this project. Try tinkering with the code and add more features.
This article first appeared on model-railroad-hobbyist.com
About this website
Railpage version 3.10.0.0037
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest is © 2003-2020 Interactive Omnimedia Pty Ltd.
You can syndicate our news using one of the RSS feeds.