# Positioning a stepper motor using DC supply

Hi all. I am new to arduino. I have a basic understanding of programming, but never applied it to microcontrollers.

Basically, what I want to achieve is to use a DC power supply to control the position of a stepper motor. So for example the PSU will have a range of 0-10V. The stepper motor will have set start and finish positions and applying voltages from 0-10V will increment the stepper motor between the start position and the end position.

Imagine if you will an old piece of kit with dials such as potentiometers etc. I want a device that can automate the position of these pots, basically being able to use a programmable DC PSU receiving commands from a PC to automate and old analogue piece of kit.

And before you ask, no the old kit cannot be replaced. Due to various reasons we have to 'bodge' and old test rig to make it programmable. That's all I can say I'm afraid.

I'm guessing the PSU will go to the analogue in to control the digital out?

Any suggestion? Any other solutions people can think of? Any sources for code which may relate? Even multiple sources. I may not be good at coding from scratch but I'm pretty good at interpreting and combining other chunks of code.

Cheers

Probably easier to use a servo than a stepper - with a stepper you'd need some mechanism to find out what position the pot is when you turn it on.

AnalogRead sounds right, but do you have to use the PSU as the input device? Could the PC just send the directions to the Arduino directly? I assume there's some kind of protocol being used that you don't want to emulate?

A range of 0-5V would be easier to work with on the Arduino but 0-10V can be run through a voltage divider to get the same effect.

When V=0 I'd run the stepper a few extra steps in the counter-clockwise direction to make sure you hit the physical stops. That way if something goes wrong with synchronization you can re-sync.

The code would:
Calculate the position corresponding to that input.
If the position has changed:
Calculate how many steps (and in which direction) to get to the new position.
Step that number of steps.
If the new position is 0:
Step -5 to make sure you hit the stop.
Repeat.

If you are planning to use steppers then you may be interested in stepper motor basics.

However I think I would use servos as suggested by @wildbill

...R

Thank you very much for the responses so far

wildbill:
Probably easier to use a servo than a stepper - with a stepper you'd need some mechanism to find out what position the pot is when you turn it on.

AnalogRead sounds right, but do you have to use the PSU as the input device? Could the PC just send the directions to the Arduino directly? I assume there's some kind of protocol being used that you don't want to emulate?

Yeah the reason I thought of using a PSU was purely for the fact of it having an IEEE488 (GPIB) bus. I don't know if you are familiar with the calibration software Met/Cal by Fluke, but it would be a serious ball-ache to try and get that to talk to an arduino, thus the use of GPIB as a 'middle man'.

I will look into using a servo though, good suggestion

Thanks