Hi everyone,
I am working on a graduation project which is a motorized rotation stage. I need to write a code in arduino which makes the stepper motor rotates and a dialog box from visual basic which controls my stepper motor. A value and the direction should be entered from the dialog box and the stepper motor should rotate accordingly. Does anyone have any idea on how to write the code?
Thank you
Not VB, but C++ yes...
Break it down into steps:
- get a stepper working
- get a dialog box working (printing the input value to screen for instance)
- set up serial comms from PC to arduino
Each of these things should have lots of info online already - your task is to integrate them.
the stepper will rotate in X number of steps per final device rotation.
if you have a larger final device, you probably will need to use a gear or belt to drive it.
once you know how many steps it takes to move a full rotation, you have a value to use for your coding.
1:1 is spot on. once you get a stepper running, and have the control pulses needed to make your stage rotate one full revolution, you only need to have it X number of steps to make it rotate Y degrees
I would offer that a home switch would be wise. you WILL loose track of steps when the power is lost or the Arduino is re-set. have it move to home and you are set.
a opto-interupter such as used on a mouse would be easy to use.
or an opto=reflector such as a IR emitter and receiver and somthing shiny on the part to reflect.
You may find some useful stuff in stepper motor basics
If your stage does not have to rotate continuously - for exampl if, say, 1 or 2 revolutions in the same direction would be sufficient before it must rotate in the other direction a sail winch servo might be a better option - much easier to control.
...R
Thank you so much,
I will keep working on it and let you know if i have any problem. Thank you all for your advices.