Problem with the speed of a stepper motor
hello making project allow me turn on , off light , change speed of stepper motor via bluetooth. can turn light on , off cannot operate stepper.
the motor have 3 fixed speeds sort of table fan.
the speeds this
if send 2 through bluetooth terminal stepper off
if send 3 stepper run slowly
if send 4 run faster.
i using arduino uno
this stepper motor , driver:
http://www.ebay.co.uk/itm/dc-5v-stepper-step-motor-driver-test-module-board-uln2003-5-line-4-phase-arduino-/310643134044?pt=uk_boi_electrical_components_supplies_et&hash=item4853c60e5c
and here code:
thank in advance , apologize english
the motor have 3 fixed speeds sort of table fan.
the speeds this
if send 2 through bluetooth terminal stepper off
if send 3 stepper run slowly
if send 4 run faster.
i using arduino uno
this stepper motor , driver:
http://www.ebay.co.uk/itm/dc-5v-stepper-step-motor-driver-test-module-board-uln2003-5-line-4-phase-arduino-/310643134044?pt=uk_boi_electrical_components_supplies_et&hash=item4853c60e5c
and here code:
code: [select]
#include <accelstepper.h>
accelstepper stepper; // defaults accelstepper::full4wire (4 pins) on 2, 3, 4, 5
char inbyte; //declare variable bluetooth com
const int ledpin = 13; // led connected pin 13
const int arraypin = 7; // array pin 7
void setup()
{
serial.begin(9600); // bletooth baud rate
pinmode(ledpin, output); // led pin output
pinmode(arraypin, output); // array output
stepper.setmaxspeed(1000);
stepper.setspeed(500);
stepper.runspeed();
}
void loop()
{
digitalwrite(ledpin, high);
while (!serial.available()); // wait input
inbyte = serial.read(); // read next available byte
stepper.runspeed();
if( inbyte == '0' ) digitalwrite(arraypin, high); // if it's 0 (zero) tun led off
if( inbyte == '1' ) digitalwrite(arraypin, low); // if it's 1 (one) turn led on
if( inbyte == '2' )
{
stepper.setmaxspeed(1000);
stepper.setspeed(0);
stepper.runspeed();
}
if( inbyte == '3' )
{
stepper.setmaxspeed(1000);
stepper.setspeed(200);
stepper.runspeed();
}
if( inbyte == '4' )
{
stepper.setmaxspeed(1000);
stepper.setspeed(500);
stepper.runspeed();
}
stepper.runspeed();
delay(50);
}
thank in advance , apologize english
how powering stepper motor? schematic diagram of wiring help.
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Problem with the speed of a stepper motor
arduino
Comments
Post a Comment