Model Railroad Turntable control
Topic: Model Railroad Turntable control
(Read 5 times)
Location: Calgary, AB
Model Railroad Turntable control
Jan 28, 2011, 05:05 pm
This was becoming a discussion on my thread about learning about SPI using the MCP23S17
By logging the nudge(s) required, the next time that location is moved to, the nudges will occur automatically. Count would be kept in EPROM, so information would not be lost when powering down.
This concept is good, however I'd be inclined to have a "learn" button that allows the Arduono to remember the current absolute location. When the system is first used you rotate the turn table by whatever means until it's is aligned with a track, press the button. Repeat until all done. Then sort and store the values in EEPROM.
Then a simple toggle or PB switch can be used to move to the next position or a more sophisticated interface can be used to go to position N.
it makes sense to increase the resolution right from the beginning
It sure does, if your maths is correct then maybe even a better encoder.
One problem with using a DC motor will be inertia, when you reach position X and turn off the motor it will keep going for a while and I think this "while" will vary according to the load, ie train on turntable or no train, and possibly other factors like varying friction in a home-made gadget.
I wanted to be able to anticipate approaching the final destination, and start to slow the drive motor speed down in steps before reaching the destination.
That probably covers what I just said, but the varying loads on the motor will still cause a few headaches I think and I'm not sure how slow you can go with a DC motor. High gearing would help here.
Hi Rob, problem of posting in snipets, and not giving the full picture. Your suggestions are great, and so far I have anticipated your concerns.
I do have a learn button as part of the setup that will make it easy to set the encoder position required. For track selection, a DPDT momentary switch will be used for each track, to pull the appropriate bits low for the 10 bit word required to set the postion to one of 1024 possible destinations. I am using one bus to create the 10 bit address, using a diode matrix to keep the switches isolated from each other. The reason for the the DPDT is to handle 180 degree rotation of the table. If I want to rotate which end lines up, I use a 11th bit, Exclusive ORed with 10th bit. The second pole of switch only has to handle the 11th bit, and I can reuse the same diode matrix to enter the rest of the code. Sounds complex, but I have determined this is the simplest way to set it up.
The 10th bit is actully interesting (assuming I go with 1024 steps). I will be treating it as unsigned binary. If I want to turn the turntable 180 degrees, all I have to do is flip the 10th bit from its current setting. e.g. if the entrance track was positioned at the index step, the count (in binary) is 00 0000 0000 which we will call 0 degrees. The table has 2 ends, for lack of a better description, an A and B end. The call for A end to go to 0 degrees, 000 0000 0000 will be entered on the Entrance Switch by toggling to A side which requires one side of the DP switch. The engine runs in, and you just want to turn it around, and then run it out again. Toggle same switch to B side, code entered is now 100 00000 0000, process the 11 and 10th bit with Excluse OR, to create code 10 0000 0000, whcih represent 180 degrees. Because I am using binary count, to flip the table 180 degrees, I only need ot flip the 10 bit from its current setting. To determine shortest way to align an end, I do 1 of 2 compares depending on whether the destination is a higher or lower number from the current setting, and then set CW or CCW rotation of the motor.
As for the encoder, I suspect using 1024 steps is overkill. Until I try it on several pre-existing installations, I will not know.
As for inertia, I have anticpated this as well, since a friend's turntable has considerable inertia.
1) as part of setup procedure, there will be a way to determine the slowest speed you can run at. You will also be able to set the highest speed to run at. The ramp up/down routines will smooth step between the two values. Again we are using different motors in our respective layouts, so this handles the variances in operation.
2) I know that one turntable has some momentum. I have not received the L293 H motor dirver yet to experiment with the Hard Stop setup. Worse case, I count the overshoot, log it, and next time I go to that track position, I subtract the numer of steps of overshoot as part of the calculations. The only concern whichyou noted, a loaded turntable may behave differently from an unloaded turntable. Engine weights in the scale we are using can vary from several ounces, to about 8 pounds. Turntable diameters are 10" to 15".
Rob, thanks again for your insight and comments on pssible design concerns that I will need to handle. I do appreciate the response.
Don't you just hate ONE D 10 T problems?
Location: nr Bundaberg, Australia
Scattered showers my arse -- Noah, 2348BC.
Re: Model Railroad Turntable control
Jan 28, 2011, 05:48 pm
No problems, I've always been a model railway wannabe, I made some scenary but that's about as far as I ever got.
BTW, it MRs that got me into electronics. I was a photogorapher during the 70s and while working in London got interested in how to control the boom gates at a crossing after seeing some great stuff at the model engineering exhibition at Wembly.
Originally I was thinking magnets and switches but on my return to Aus I started teaching myself about CMOS logic. I got a job in electronics and spent 20 years dicking around with building control systems.
I still haven't built an MR layout, probably never will now. =(
Rob Gray aka the GRAYnomad