Using lasers for precision alignment

Hi all,

I'm looking at using Arduino boards for automation and animation of my model railroad layout. One thing I'm looking to automate is a locomotive turntable.

To align the turntable bridge with the track rails, I'm planning to have a pair of laser pointers, 180° apart, mounted to the underside of the bridge driveshaft, pointing outwards. Around the circumference of the turntable will be 8 LDRs, one for each track. Each LDR will have a 'mask' over it, with a slot cut so that the LDR will only be activated when the laser is fully facing it.

I cannot use a stepper motor, as the track spacing is uneven around the perimeter. I was wondering if anyone has tried something similar, or if this approach sounds feasible at all?

Also, there is just one simple piece of information I can't seem to find. Legislation here in Australia means that the strongest laser pointers available are 1mW. I've googled about a dozen variations of queries about laser pointers and LDRs, and found several projects about laser tripwires. But none of these ever mention the strength of the laser pointer, so I don't know if 1mW would actually be strong enough to trigger an LDR.

Cheers,
Tbdanny

you can get all sorts of lazers at a store called dealextreme, they ship free worldwide, and they got the best prizes. try to take a look at dx.com.

as for the main project, i think you can solve it with a hall sensor and a pair of magnets on the places you wanted to mount the LDR's, but maybe a few less?

am i correct that you want to check in what position your turntable is?

I cannot use a stepper motor, as the track spacing is uneven around the perimeter. I was wondering if anyone has tried something similar, or if this approach sounds feasible at all?

How much total rotation does the turntable require? I'd suspect a servo might be useable for the rotation.

Hi,

Thank-you for your replies.

The turntable is an existing model, driven by a conventional DC motor via a gearbox. I did consider a servo, but continuous 360° rotation is required. I'm also not sure if the servo would be accurate enough. The track alignment tolerance is 1mm - any more and the trains would derail. I'm looking to automate the existing mechanism.

I'm intrigued by the idea of using a hall sensor. How accurate would this be? Also, would this provide a means to identify each track? There are 8 train tracks coming off the turntable, and so my plan was to have each LDR correspond to one track, which would be fed through a resistance ladder to the analogue input of the Arduino. The voltage in would identify the track.

I'm aiming for a system where I can push the button for a specific track (loco 1-7 or the exit track), and have the Arduino line the turntable up to that track.

Cheers,
Tbdanny

I did consider a servo, but the 360°/continuous rotation servos I could find either don't have positional alignment (just forward, reverse and center), or are incredibly expensive.

There's already a working mechanism for the turntable, and I'm looking to add to this to align it.

tolerance is 1mm - any more and the trains would derail.

What is the circumference of the turn table? 1mm precision probably won't be cheap or easy. Below is a sail winch servo that rotates ~1.5 turns, but your precision probably isn't there.

assuming your turn table is 200mm from middle poin to the end of the "bridge", and asuming a servo is used with 2 degrees presicion, you will have steps of ~7mm.

Based on what I've read, the ability for a servo to turn more than 180° with positional feedback comes at the cost of accuracy.

I am considering using hall effect sensors. I could put the magnets where I had originally planned to put the laser pointers, and hall effect sensors in place of the LDRs. The hall sensors would be connected through a resistance ladder.

The Arduino would then be programmed to stop when it sensed the voltage for the required track to be strongest - I.e. when the magnet is closest to the sensor.

but how will you solve the 1mm precision?

i thought of maybe after positioning the table into the (just confirmed by hall sensor) right direction, you could add a electromagnatic coil, wich can be activated and deactivated to align the rial 100% precisoin (based on how well the magnets are placed) towards static magnatic field from the magnets..?

How about a snap-action switch at each stop? It will take some time to get the initial alignment for each location just right, but on the whole it's a much simpler solution.

What if you used a solenoid that pushed a plunger into a detent. You could use your existing DC motor, use hall effect sensor to detect when it is close to the correct position to ramp down the motor then activate the solenoid which would push into the detent and lock it into alignment. This would also lock the rotation of the turn table to eliminate any mechanical slop.

I can imagine the front wheels getting onto or off of the table then it rotating slightly and the rear wheel s derailing if the table wasn't securely locked.

Why can't you use a stepper motor? Is a rotational movemnent, isn't it? There no problem moving a stepper motor any number of degrees with good precision. You just need to get a reference once and keep track of the number of steps. Referencing can be done with a micro switch.

There is a huge amount of stuff about turntables on the RMweb site - for example Don't be put off by the DCC stuff - most of the mechanicals can apply with any control system.

If you don't want to use a stepper motor I suggest you arrange a small protruding tab (on the rotating table) at each position where you want the turntable to stop and use a small servo mounted on the fixed part. The servo lifts its arm into position so the tab will stop when it hits the servo arm. When you want the table to move on just lower the servo arm out of the way.

If the protruding tabs are attached with a screw they can be adjusted a little for exact alignment.

...R

Tbdanny:
Based on what I've read, the ability for a servo to turn more than 180° with positional feedback comes at the cost of accuracy.

I am considering using hall effect sensors. I could put the magnets where I had originally planned to put the laser pointers, and hall effect sensors in place of the LDRs. The hall sensors would be connected through a resistance ladder.

The Arduino would then be programmed to stop when it sensed the voltage for the required track to be strongest - I.e. when the magnet is closest to the sensor.

You do not describe the mechanical arrangement well enough.

Method i have seen uses hall sensor to detect position of the crest of the cogs on the turntable drive ring

Edit

BTW if you use an accurate lockink pin for each position the precision of the drive is largely immaterial.

Theses devices were around before electronics was invented.

Hi all,

Firstly, I think I should explain the arrangement of the turntable a bit more clearly. Here's a photo of the topside:

The bridge in the middle is driven by a drive shaft running up the middle. It's about 1mm in diameter. This is driven from underneath by a gearbox, which is driven by a small DC motor:

The shaft with the large (double-stacked) gear, closest to the camera, is connected up to the turntable bridge. Currently, the mechanism is controlled by the two switches in the fascia below the turntable. The rocker switch is DPDT momentary contact, and controls the 9V DC to the motor - one side for each direction. The rotary switch next to it controls power to the tracks. All my locomotives are DCC sound equipped, and so I don't want to have them all making noise at once.

I'm planning to replace both of these with 8 pushbuttons, one for each of the tracks leading off the turntable. Push the button for a specific track, and the Arduino will align the turntable for the requested track, then turn the track power on via a relay.

At the moment, it seems I have two options for the turntable alignment, along with queries/uncertainties for each. I should probably mention that my background is mostly in I.T. (for a living), with dabbling in electronics. I've built timers, etc. before, but this is my first usage of microcontrollers. However, when it comes to mechanical systems (i.e. drive systems), I'm more or less a complete novice.

One option is to replace the existing drive mechanism with a stepper motor, such as this one: CNC Nema17 Hybrid Stepper Motor Dc12v 2-phase 4000g.cm 4-lead 1.8 Degree for sale online | eBay. I've not used stepper motors before, and I'm not sure if it would work with one reference point. I mean, if the turntable needs to go from one track to another track on the same side of the turntable, it would just need to swing that end of the turntable bridge around. So how would it know where the end of the turntable bridge is? I could use the stepper motor in conjunction with a hall effect sensor for each track, which would give a guaranteed indication as to when the nearest end of the turntable bridge reaches the track. The other disadvantage of this is that I'd need to take the turntable out and completely rebuild the drive mechanism - i.e. stick the turntable bridge directly on top of the stepper motor, somehow. I'm also not sure how much torque I'd need, as the engines can weigh up to 1kg (2.2lb) - I'm modeling in On30 scale.

The other option is to use the hall effect sensors with a solenoid, as suggested by
Charles_Creations. I'm not entirely sure how I'd create the actual slot for the solenoid to go in. There is a bit of slack in the mechanism, which could be used for the 'final alignment' with some sort of guide to lock the solenoid shaft in position under each track. I'd go along with my original plan, of having a rotating blade attached to the turntable underneath, with the solenoids at each end. I'm not sure how the permanent magnets would interfere with the solenoid, or the solenoid with the hall sensors. One option would be to use 'pull' type solenoids, which need to be energised to retract the shaft. Then, the electromagnet of the solenoid would act as the trigger magnet for the hall sensor.

I'm leaning towards the stepper motor option, as that would be mechanically simpler. It's just a question of attaching the original drive shaft to the stepper motor shaft, centered. I'd prefer to keep the original shaft to the bridge, as it's perfectly smooth and centered.

Cheers,
Tbdanny

the mechanical pin into a slot would be one of the ways to go.

the stepper would be far more accurate than you can imagine.

the exposed gear has something over 80 teeth (guessing as I can see 20)
a stepper with 200 steps per rotation with a 8x micro-stepper will have 1,600 steps per rotation
times 80 teeth, the final rotary unit will have 128,000 steps per rotation.

using my rule of thumb that you have to be 4 times more accurate than your desired drive accuracy, we can divide that by 4 to get 64,000 steps per rotation.

swapping mm for steps, and using the circumference of the device, 64,000 mm
using the formula of pi times the diameter, we divide 64,000 by pi to get just over 2,000 cm carrying that out to English units, I come up with a accuracy of alignment of 1/4 mm if the turntable were only 66 feet in diameter.

I am sure my math went off the rails as I have not had coffee yet, but even if it was off by an order of magnitude, your table does not look like it is 6 feet in diameter. ( I am blaming the lack off coffee for the huge divide by two and not by 4 error)

alas, for a stepper, you trade power and precision for speed. I will not venture to guess how many hours it will take for one revolution. just joking it will take a fraction of an hour. 2/3 is a fraction, right ?

also, you can easily buy a optical interrupter that is far more common, far easier to use and also more accurate than you need. your old mouse had two as did almost every scanner or copier I ever took apart.
one emitter with a slit and one receiver at the end of a tube with a slit will offer a high degree of alignment.

you can use an encoder wheel connected to the existing table. print it on copy paper and use some sensors. or use a stepper with an encoder for feedback or the existing motor. putting it on the drive wheel will offer accuracy in the realm as listed above.

someone once posted a link to a logic problem something like X-Y formula... said that we respond to posts using the logic of someone who has eliminated workable solutions for unknown reasons and then we try to use the logic that is left. the lack of diameter of the rotary? )coffee done brewing.. had a couple sips)

if it were me and I was really into this hobby, I would look at a sign that rotated. the rotation would lock in the turntable to the rail in some fashion. the sign could spin or raise up out of the ground to indicate to the engineer that the alignment is ready and the track is aligned. For that a tiny servo, a solenoid, pretty much any mechanical device could be used.

if it were me, I would make my own stepper belt drive. 1mm accuracy end result with 1/4mm positioning accuracy. Assuming the rotary table were 18 inches across, that is 460 mm in circumference. a stepper with a 4:1 belt ratio and 200 steps per rotation would be 200x4 or 800 steps per rotation. using a half step driver, would jump that to 1,600 steps per rotation. pretty close to the 4:1 ratio I would want. speed would be good, power would be good. may go to 5:1 belt ratio.

I would still use an optical interrupter. if only for a home position.

one note here is that steppers are really only accurate to 1/2 step. you can get krazy microstepping numbers, but when you loose power the motor moves to the closest half step. tying to use a high value microstepping driver may have the effect loosing steps by cycling power. microstepping is great for smooth operation and I use them without reservation. just also use a home switch for accuracy.

lastly, you can use 3 interupters, one center, one left, one right, for extreme accuracy. lots more work, but using the 2 outter ones increases the accuracy by an order of magnitude.

rambleMode=LOW;

are you using a laser to cut your parts ?

if so, you could make your own stepper gear.

MLT is the belt size you would want.
20 tooth drive and 100 tooth driven. 5:1 would offer speed and power.
if you use the listed stepper motor, you may need a larger drive if the shaft is too large.

https://sdp-si.com/eStore/CenterDistanceDesigner

this will help for your motor bracket.

I would want to keep your existing shaft alignment/plate, etc looks great. just swap out the gears.

Noone has mentioned holding force yet.

With a dc drive motor you are dependent on friction and lack of backlash to hold position in the absence of a locking mechanism.
A suitably geared stepper motor may take care of the problem.

Given the scale a simple cabinet ball catch and detent may be suitable.

Scale i know is 5 inch guage where locking mechanism is mandatory.

Tbdanny:
I've not used stepper motors before, and I'm not sure if it would work with one reference point.

The link I gave you earlier to the RMWeb article has all the info (including code) that you could possibly want for using a stepper motor.

...R

Hi folks,

Now I'm a bit confused. The replies seem to be suggesting that I use a stepper motor with a small gear to drive the existing turntable gear, rather than drive the bridge directly?

The tutorial linked to by Robin2 has the stepper motor directly connected to the turntable bridge, without any intermediate gearing.

Cheers,
Tbdanny