User Tools

Site Tools


projects:a4sim:servos:x27168

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
projects:a4sim:servos:x27168 [2019/08/21 01:00]
dwheele created
projects:a4sim:servos:x27168 [2020/02/22 17:07] (current)
admin ↷ Links adapted because of a move operation
Line 4: Line 4:
  
 These specs are from [[https://www.adafruit.com/product/2424|Adafruit]], who show the part as out-of-stock. These specs are from [[https://www.adafruit.com/product/2424|Adafruit]], who show the part as out-of-stock.
 +
 +Adafruit info: 
 +
 +//This stepper motor is a little different than the large NEMA-17 types you may be used to. These are often used in gauges for motorcycles and cars to replace the old-style fully-analog type. They have extremely fine step precision of about 1/2 a degree per step, 600 steps for single stepping, fast response for quick movements, and a range of  ~315° degrees. Their smooth motion makes good for small projects that need a dial indicator, and more precision motion than you may get with a needle gauge.//
 +
 +//Since this is a bi-polar stepper motor you do need to have some sort of H-Bridge to drive it. A L293D or TB6612 will do the job nicely. If you have a microcontroller that can drive 200 ohm loads you might be able to use the direct pins without extra MOSFETs, just remember to include kickback/flyback protection diodes!//
 +
 +//Note that the motor is quite 'weak', not good for moving anything but a light indicator. We include a red-line dial that fits nicely on top by pushing onto the needle shaft.//
  
 ==== Specs ==== ==== Specs ====
Line 24: Line 32:
     Motor Thickness (w/o pins): 9mm / 0.35"     Motor Thickness (w/o pins): 9mm / 0.35"
  
 +{{ a4sim:servos:2424.pdf |Data sheet for similar item}}
 +
 +==== Working example ====
 +
 +<code c>
 +/* 
 + Stepper Motor Control - one step at a time
 + 
 + This program drives a unipolar or bipolar stepper motor. 
 + The motor is attached to digital pins 8 - 11 of the Arduino.
 + 
 + The motor will step one step at a time, very slowly.  You can use this to
 + test that you've got the four wires of your stepper wired to the correct
 + pins. If wired correctly, all steps should be in the same direction.
 + 
 + Use this also to count the number of steps per revolution of your motor,
 + if you don't know it.  Then plug that number into the oneRevolution
 + example to see if you got it right.
 + 
 + Created 30 Nov. 2009
 + by Tom Igoe
 + 
 + */
 +
 +#include <Stepper.h>
 +
 +const int stepsPerRevolution = 600;  // change this to fit the number of steps per revolution
 +                                     // for your motor
 +
 +// initialize the stepper library on pins 8 through 11:
 +Stepper myStepper(stepsPerRevolution, 2,4,6,7);            
 +
 +int stepPosition = 0;         // number of steps the motor has taken
 +int stepPoints[] = {100, 300, 200, 250, 50};
 +int sPtr = 0;
 +
 +void setup() {
 +  // initialize the serial port:
 +  // Serial.begin(19200);
 +  // myStepper.step(-600);
 +
 +  // Deleted Serial writing, it might be interfering.
 +  // setSpeed of 10 seems to work. Trying 30.
 +  // 8/21/2019
 +  myStepper.setSpeed(60);
 +  stepPosition = 0;
 +  
 +  int i;
 +  for (i = 0;i < 600;i += 10) {
 +    myStepper.step(-10);
 +    delay(40);
 +  }
 +  delay(500);
 +}
 +
 +void loop() {
 +  int newLoc = stepPoints[sPtr];
 +  sPtr++;
 +  if (sPtr >= 5) {
 +    sPtr = 0;
 +  }
 +  int stepAmount = newLoc - stepPosition;
 +    myStepper.step(stepAmount);
 +    stepPosition = newLoc;
 +    delay(10);
 +}
 +</code>
  
projects/a4sim/servos/x27168.1566349235.txt.gz · Last modified: 2019/08/21 01:00 by dwheele