Welcome to Project Dalek

You need to be a member in order to access our content.

 

Click Here To Join!

 

For instant access to the plans and all Forum features, choose Active Membership.

flexitron

Stepper Motor Powered Eyestalk - From Laser Printer

11 posts in this topic

Hi Im currently trying to use a stepper motor power my  eyestalk. from laser printer motor.

the motor has 5 wires that go out to a molex , the molex has three wires that are brushless.

 

iI cut the 3 wire off the molex. to give me five wires to run to the adafruit motor shield.

Which in turn goes to an Uno board.

 

Can anyone offer advice on what code to power the stepper like a 180 degree servo.

james.

0

Share this post


Link to post
Share on other sites

// Include the Stepper library<br>#include
// Declare the used pins
int dirA = 12;
int dirB = 13;
int pwmA = 3;
int pwmB = 11;
// Declare a Stepper motor with 200 steps
Stepper stepper1(200, dirA, dirB);
void setup() {
  // PWM pins require declaration when used as Digital
  pinMode(pwmA, OUTPUT);
  pinMode(pwmB, OUTPUT);
 
  // Set PWM pins as always HIGH
  digitalWrite(pwmA, HIGH);
  digitalWrite(pwmB, HIGH);
 
  // Set stepper motor speed
  stepper1.setSpeed(60);
}
void loop(){
  // Turn the stepper 100 steps which means 180 degrees
  stepper1.step(100);
  // Wait half second
  delay(500);

0

Share this post


Link to post
Share on other sites

Hello flexitron,

 

Unfortunately there are a wide variety of stepper motors.  Some operate at as low as 2V, yours is more likely 5V or 12V.  It would be easier to help if you could include an image of the motor and/or a part number if it has one printed on it.  Also, is your Adafruit motor shield version 1 or version 2?  The two versions are actually very different.  I have a version 2, and a few different kinds of stepper motors, if they are anything like yours I might be able to help.

 

Mike

0

Share this post


Link to post
Share on other sites

Posted (edited)

Mike it's a version 2 I ended up purchasing  this a MCM Electronics Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA at my local  microcenter .  now that radioshack is gone . Could you suggest some code.

 

 

Edited by flexitron
0

Share this post


Link to post
Share on other sites

Is this the one?

 

http://www.mcmelectronics.com/product/28-17453

 

It matches your description except that it is 4-wire, not 5.  I'll dig through my parts bin and see if I have one like it...

 

Mike

0

Share this post


Link to post
Share on other sites

yes mike that is the same stepper  that i have.

 

im using an inland uno board r3.

 

can you sugest some code.

0

Share this post


Link to post
Share on other sites

It looks like mcm gets that motor from Adafruit, just like the shield.  You will need the motor shield library from Adafruit to make it work.  This tutorial uses that shield with the same motor.  You should be able to follow that and get the motor moving.  Once it is moving I can help with the code specific to your implementation.

 

https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/using-stepper-motors

 

Mike

1

Share this post


Link to post
Share on other sites

 

this is the script.

I am using to test.

I need to stop reverse pause forward etc.

it is rotating constantly receiving constant pwm modulation.

 

 

 

// ConstantSpeed.pde
// -*- mode: C++ -*-
//
// Shows how to run AccelStepper in the simplest,
// fixed speed mode with no accelerations
// Requires the Adafruit_Motorshield v2 library
//   https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library
// And AccelStepper with AFMotor support
//   https://github.com/adafruit/AccelStepper

// This tutorial is for Adafruit Motorshield v2 only!
// Will not work with v1 shields

#include <AccelStepper.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myStepper1 = AFMS.getStepper(200, 2);

// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
void forwardstep1() {  
  myStepper1->onestep(FORWARD, SINGLE);
}
void backwardstep1() {  
  myStepper1->onestep(BACKWARD, SINGLE);
}

AccelStepper Astepper1(forwardstep1, backwardstep1); // use functions to step

void setup()
{  
   Serial.begin(9600);           // set up Serial library at 9600 bps
   Serial.println("Stepper test!");
 
  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz

  Astepper1.setSpeed(50);    
}

void loop()
{  
   Astepper1.runSpeed();
}

1

Share this post


Link to post
Share on other sites

You shouldn't need the AccelStepper library, and that example looks like it only starts the motor.  It doesn't try to make it go back and forth.  I suggest using the example code that comes with the Adafruit Motor Shield v2 library which you must already have as it is used by the AccelStepper library.  Try this:

 

591ba5ef35017_StepperMotorTest.thumb.jpg.16f944eb5823ecf5cba1f35a41a2b827.jpg

 

This example code goes forward and backward using several different modes.  I just tested it with the same motor and it worked fine for me.  Are you planning to manually control it with a potentiometer/joystick from inside, or remote control from outside?  Or do you want to program a specific animatronic sequence?  Also, what is your eyestalk made of?  How much does it weigh?  How well counterbalanced is it?  I'm not sure this motor will have enough torque, but it's worth a try.  Let me know if this code successfully makes it go back and forth at varying speeds, and more details on what you want the code to make it do.

 

Mike

1

Share this post


Link to post
Share on other sites

code seems to work. proably pvc.

 

I was thinking rc. but my controller is the bronze futaba. 

 

i think it's all analog in  75 or 77 something mhz.

 

is there a way to output the signals back to analog.

and use an ada what kind of joystick could work maybe a wired remote.

0

Share this post


Link to post
Share on other sites

Sorry, I don't know much about radio control.  If you post some pics of your system, or model numbers, someone here might know how it works and offer assistance.  I'm building my system to control from inside, so just use a potentiometer wired direct to the Arduino to control the position.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now