Sinusoidal linear motion using a DC motor

PeterH:
I think you'll really struggle to achieve that if the only position feedback you've got is a couple of limit switches.

It would be possible to achieve this using a constant motor speed and a mechanical crank system to give a sinusoidal speed output if you want, but if you really want the motor itself to have a sinusoidal variation in speed then to do it accurately and reliably you need position feedback from the motor throughout the movement. You could just play with the PWM duty cycle versus time and get the motor to do roughly the right thing, but there'd be no compensation for anything that caused the motor to move faster or slower to a given PWM duty cycle, and there are plenty of factors that could cause it to move faster or slower.

The mechanical method is out (scotch yoke provides rotational to linear sinusoidal motion). This will be in use for a number of years and the wear on a mechanical system is too great. (btw this will be running for 25000 cycles per test, ~40 tests per year, should last about 3 yrs w/o too many expensive replacements)

If more feedback sensors were added, say a total of 5, could the system be more reliable? two near each end and one in the middle?