hello,
in the past i've created small butterflies with the arduino and servo motors but i'm still new to using arduino and i am looking into creating an even smaller butterfly mechanism that is much more light-weight. i did some research and came upon an artist that is possibly using small pager motors and mini boards of some sort to make an installation. here's a picture:
would this be something that could be created with the arduino - controlling two small pager motors to move back and forth 90 degrees or less. i haven't been able to find any reference codes for controlling these motors with the arduino so i was curious if it was possible and how i would get started.
thanks for the reply,
i have used servos like that in the past but i've noticed that they are quite loud and was hoping for something smoother. I do have these small stepper motors: http://www.goldmine-elec-products.com/prodinfo.asp?number=G14197
and i have been doing a lot of research about the easy driver with the arduino and it seems like it might be a good path to take. i'm assuming that i would need two easy drivers in order to run two motors using one arduino. the only problem is, like i said i'm still quite a newbie to this, and i find that the schematic for this stepper is more difficult to read compared to the schematic given for the stepper that sparkfun sells, which is much larger and 10 times heavier.
forgive me for being so indecisive!
based on adam's blog, i was able to come up with this code:
int blue = 0;
int black = 1;
int red = 2;
int yellow = 3;
void setup()
{
pinMode(blue, OUTPUT);
pinMode(black, OUTPUT);
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
}
void loop()
{
// Forward polarize winding A
digitalWrite(blue, HIGH);
digitalWrite(red, LOW);
delay(5);
// Forward polarize winding B
digitalWrite(black, HIGH);
digitalWrite(yellow, LOW);
delay(5);
// Reverse polarize winding A
digitalWrite(blue, LOW);
digitalWrite(red, HIGH);
delay(5);
// Reverse polarize winding B
digitalWrite(black, LOW);
digitalWrite(yellow, HIGH);
delay(5);
}
the problem is that it only moves in one direction, so i tried to mess with it a bit myself to get it to move back and forth and this is what i came up with:
#include <Stepper.h>
#define motorSteps 200
int blue = 0;
int black = 1;
int red = 2;
int yellow = 3;
// initialize of the Stepper library:
Stepper myStepper(motorSteps, blue, black, red, yellow);
void setup()
{
pinMode(blue, OUTPUT);
pinMode(black, OUTPUT);
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
myStepper.setSpeed(660);
Serial.begin(9600);
}
void loop() {
// Step forward 100 steps:
Serial.println("Forward");
myStepper.step(100);
delay(500);
// Step backward 100 steps:
Serial.println("Backward");
myStepper.step(-100);
delay(500);
}
i fear that i have completely hacked up this code because the now the motor seems to be fixed and not moving at all - maybe a slight jerk as if it's trying but can't.
the whole point is to get the motor moving about 90 degrees and then moving back the other way about 90 degrees.
any suggestions?
You could use the pager motors with two circuits onboard, one supplying voltage one way and another do the oposit, aslong as you dont run boath at the same time, all should be well