For the actual operation of the turntable I originally wanted to use an Arduino Uno with a motor control board driving a stepper motor (if you're not familiar with Arduino here's a quick explanation). Three good sources for Arduino stuff are Arduino, Adafruit and Sparkfun. This is probably the cheapest way to go but I'm new to the programming so there's a learning curve involved. I waffled on just using manual control with a gear or belt and pulley driven by a hand crank. Still pretty cheap but the operation of the turntable will be from 2.5' away and I'm concerned about getting the tracks lined up properly. So now I'm back to the Arduino control because you can program it to do very accurate indexing and with a stepper motor it would be repeatable.
I ended up going to the Yahoo group "Arduino for Model Railroading" (click here) to ask for help. Several folks there were very helpful and stuck with the project for a few weeks to develop a working sketch (program). This required a lot of going back and forth because they had the programming knowledge but I had the gear to run it on. Suggestions would be made and then I would modify the sketch and run the program. In the end we came up with a very cool control system for the turntable.
The system consists of an Arduino microprocessor, the Mega 2560, running a 4x4 matrix keypad, a Nokia LCD display and an EasyDriver board running a NEMA 17 stepper motor. This is a stand-alone system and won't need to be connected to a computer to run. The Mega and the EasyDriver both run on 5VDC and the stepper motor runs on 12VDC through the EasyDriver. The Mega provides power for the Keypad and the LCD.
If you're not familiar with some of this stuff I'll give a quick explanation. The Arduino Mega ($17 - $25) is a larger version of the Uno, mentioned earlier. It's a small microprocessor that can be programmed through a USB connection to your computer. Once it's programmed it can run independently on power from a wall-wart style power supply or even a battery. The board has numerous pins around its perimeter for input and output connections. The EasyDriver ($8) is a stepper motor control board that uses a "library" of commands to provide custom control of the motor. The 4x4 matrix keypad (5 for $7.50) has 16 keys set up in 4 rows and 4 columns. The keys are 0 - 9 and A,B, C and D. The keys can be programmed to be anything you want; symbols, numbers, letters, anything. The LCD ($5) is actually a display from an older style cell phone. It doesn't do color but can display low resolution images. You can use Photoshop to make your display as a GIF file and then use an app to change it into code that the display understands. The NEMA 17 stepper motor ($17) is a medium size (NEMA 17 is the size) motor that has a bunch of coils mounted around the output shaft that causes it to rotate in steps. This one uses 400 steps to make a full rotation. I'm mounting a 20 tooth pulley on the motor and a 60 tooth pulley on the turntable shaft to give me a 3:1 ratio so it takes 1200 steps to make one full rotation. The EasyDriver can operate in 1/8 steps so I'll be running 9600 steps per revolution to give very smooth operation. The total investment for this control system is about $75 and that includes everything mentioned above.
Prototype turntables were used to position locomotives, to turn them so they'd be headed in the right direction for whatever job they had next. Sometimes an engine would come onto the turntable so it could be swung around 180 degrees and head back out. To simulate this I can enter the track number on the keypad and then enter "A" and the program knows to add 600 full steps or 4800 1/8 steps to the track value. If an engine comes onto the turntable bridge at track # 15 I can enter 15A on the keypad and the engine will be turned 180 degrees and it can go back out track #15 in the opposite direction. Using the * key you can erase an entry for a track number if you make a mistake. There are still 3 other keys not used yet; B, C and D. I'm planning to use a thumbstick (small joystick) to manually drive the turntable and one of those keys will be used to initiate that.
The LCD screen is set up to display current track #, next track # and it also displays "mvng" (moving) when the bridge is in motion.
Anyone interested in using the turntable sketch for their own project can find it at the Yahoo group mentioned before, "Arduino for Model Railroading". It's located in the "Files" section in a folder called "Turntable Indexing". Here's a link to the folder (click here).
Augy: the Yahoo group "Arduino for Model Railroading" doesn't seem to be accepting new members. This makes access to your Arduino turntable control sketch(es) unavailable. Is there another source for your sketch(es)? Perhaps a direct email? Thanks in advance for sharing and congratulations on such a clever and useful project! jk
ReplyDeleteJK - Look for "Turntable Pt 5 - Arduino Sketch" for the complete sketch and explanation.
ReplyDelete