Hi everybody,
I'm trying to simulate this movement simulation rotation - YouTube
As you can see it's quite slow but sometimes there is acceleration.
I manage the movement with the position given by Processing (positionX) to
Arduino thanks to the function stepper.moveTo(positionX).
It works rather well but at low speed.
I have also read a manner to drive the stepper motor 28BYJ H48 faster with L298D
But with the code given, I won't be able to manage positions as I do with accelStepper
I have seen that we can convert this stepper motor from unipolar to biipolar by cutting the central wire (the red one) and replugging the others wire, but I think, It rise up the couple and not the speed. Am I right?
Thanks for your lights!
Here 's the program to control the position (if we can speed it up..)
// ProportionalControl.pde
// -*- mode: C++ -*-
//
// Make a single stepper follow the analog value read from a pot or whatever
// The stepper will move at a constant speed to each newly set posiiton,
// depending on the value of the pot.
//
// Copyright (C) 2012 Mike McCauley
// $Id: ProportionalControl.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
#include <AccelStepper.h>
#define HALFSTEP 4 //--> 2048 step. if Halfstep 8 --> 4096 pas
#define HALFSTEP 2 //--> it doesn't work
#define motorPin1 A8 // IN1 on the ULN2003 driver 1
#define motorPin2 A9 // IN2 on the ULN2003 driver 1
#define motorPin3 A10 // IN3 on the ULN2003 driver 1
#define motorPin4 A11 // IN4 on the ULN2003 driver 1
#define ANALOG_IN A7
int analog_in, positionX;
// the previous reading from the analog input
int previous = 0;
void setup()
{
Serial.begin (115200);
stepper.setMaxSpeed(3000);// 15 rpm/ max?
stepper.setAcceleration(100);
}
void loop()
{
// Read new position
analog_in = analogRead(ANALOG_IN);
// positionX= map ( analog_in, 0, 1027, 0, 4096); // hafp step 8 slow
positionX= map ( analog_in, 0, 1027, 0, 2048); // haph step 4 faster
}
stepper.setAcceleration(100);
stepper.moveTo(positionX);
stepper.setSpeed(1000);
stepper.runSpeedToPosition();
// remember the previous value of the sensor
previous = positionX;
Serial.print ( "A0: " ) , Serial.println ( analog_in );
Serial.print ( "posX: " ) , Serial.println ( positionX );
Serial.print ( "prevoius: " ) , Serial.println ( previous );
}