Go Down

Topic: 28BYJ-48 5-Volt Stepper (Read 87 times) previous topic - next topic

sbright33

What he said.  Seriously.  My code does support acceleration in many of the functions so you can achieve the results in AccelStepper library without any effort.  Even using 5v.  12v is capable of going much faster with the only difficulty that celem mentioned.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

celem

sbright33 - re "What he said.  Seriously." No offence intended - your library and the empirical research behind it are commendable and it is just that your RPMs exceed the factory specifications and my personal experience. I have never tried running that stepper on 12V nor the resistors and capacitors. Maybe I'll try it when the time is available (if I can dig up a suitable 12V PS). I do have copies of your step1a.pde and step1p1dps.pde. Is there another version that I should try instead?

sbright33

Here is the newest version for 28BYJ-48.

https://gist.github.com/sbright33/4178431

12v is reliable, you just have to mind the heat.  This means you cannot run at full speed for 20 minutes.  You can go slow forever using the "cool" functions.  Or go full speed then stop to let it cool down.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

harriscreekcentral

Quote
Reply #74 on: March 13, 2013, 06:13:49 AM


Thanks very much for the information.  I have a very big learning process ahead of me.  I have bookmarked serveral of your suggestions so I can come back to them as required.
Harvey
in Kelowna, BC

izanette

Hello,

  I've been doing some tests with this motor and I found that it misses some steps in two situations:

1. If you use speeds higher than 14 RPM;
2. If you change the direction frequently.

Case 1 seems normal. It must have a limit when the motor can't rotate fast enough to follow the signals.

Case 2 is something more strange. I created a small sketch where the motor turns an angle based in the value of a potentiometer. The noise in the readings of the potentiometer makes the motor go forward/backward often. When I turn the potentiometer to the limit, it doesn't come back to the initial position. I could get some good precision only if I reduce the speed down to 8 RPM.

Have you noticed this?

celem

izanette - I have never tested for precision.  However, I would prefer to see programmatic tests without using a potentiometer. For example, running a securely fastened  stepper via test software to a set-point position, mechanically marking the position, then pseudo-randomly run the stepper back and forth and finally return to the set-point position and verify its position to the previous mark.

izanette


izanette - I have never tested for precision.  However, I would prefer to see programmatic tests without using a potentiometer. For example, running a securely fastened  stepper via test software to a set-point position, mechanically marking the position, then pseudo-randomly run the stepper back and forth and finally return to the set-point position and verify its position to the previous mark.


Hi celem,

Yes, I agree that it is better to have some random movements to make it easier for anyone to reproduce the experiment. So, I created this simple sketch:

Code: [Select]

/*
* Brownian motion
*
* A stepper motor moves forward by randomically chosen steps.
*
*/

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 2038

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 10, 9, 11);

// the position of the motor
int pos = 0;

// end of the brownian movement
boolean finish = false;

void setup()
{
  // set the speed of the motor to 7 RPMs
  // values higher than this leads to lose of steps
  stepper.setSpeed(7);
}

void loop()
{
  if (!finish)
  {
    // choose a value from -5 to 10
    // statistically, it will move forward.
    int movement = random(-5, 10);
   
    stepper.step(movement);

    // saves the position of the motor
    pos += movement;
   
    // finishes when it completes 2 turns
    if (pos > 2 * STEPS)
    {
      finish = true;
     
      // returns to the initial position
      stepper.step(-pos);
    }
  }
}


  Using it, I found out that the speed limit is even lower: 7 RPM. I'm using 4 NiMh batteries to power the motor, they supply about 4.8V. Maybe with a higher voltage it is possible to achieve higher speeds without loosing steps.

sbright33

That makes sense to me.  You can only go 7RPM when you change directions without a delay.  You can go 14RPM in one direction.  The solution is simple.  Go 14RPM, then stop for a short delay before changing directions.  It's easy to calculate the delay using 7RPM.  It's just twice the delay between steps at 14RPM.

Why not use 12V as in my code?  You can change the duty cycle while moving so it never gets warm.  Increase it back to 100% for 1 step before and after you change directions.  This will give you 30RPM without any delay, even when changing directions.  That's 4x faster.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

vm5ita


Here is the newest version for 28BYJ-48.

https://gist.github.com/sbright33/4178431

12v is reliable, you just have to mind the heat.  This means you cannot run at full speed for 20 minutes.  You can go slow forever using the "cool" functions.  Or go full speed then stop to let it cool down.

For sure there's something that I didn't understood but, after using, with success, the first sketch on this post, I'm trying the last one without obtaining nothing of good. The four red leds on the PCB stay fixed without blinking.
In the setup there's no declaration of potentiometer to drive the motor. Is there something, due to my ignorance, that I miss? Thank You!

harriscreekcentral

I am having trouble.   I found one code that I actually got to work, giving me the 1 RPM.  I have to admit I did not save it and cannot find it again for love nor money.. For some of my previous postings you can refer to # 70 area.  I Have had several other projects that needed my attention thus the delay in getting back to Stepper Motors.

I am wanting to start out fresh, and see if starting with a clean slate gets me on the right track.

I have some (5 sets) new motors and the 2003 drivers that should be on my door step in the next few days.  I also have two of the A4983 driver boards.

My first objective is to load a fresh sketch with code that I know has been proven.  I see several within these pages but am confused as I know zero about reading the codes.  Your direction again to the correct code for the basic forward reverse operation would be greatly appreciated.

Once I get the new motors and boards, I will try to keep my nose to the grind stone until I get this mastered. Thanks so much for your help.


Harvey
in Kelowna, BC

sbright33

I don't think my code is compatible with A4983.  Try it with ULN2003.

Just download my code from Gist.  Try one function call at a time in Loop() until you get the hang of it.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

econjack

HarrisCreekCentral:

I have a copy of Jack Purdum's Beginning C for the Arduino and would be happy to send it to you. (I pretty much know what's in it now.) I have a junk email account at h656775@yahoo.com if you want to send me your mailing address. On the email subject line write something like "Arduino C Book" so I don't just delete it!

jmbillings

#87
Jun 08, 2013, 01:29 pm Last Edit: Jun 08, 2013, 04:28 pm by jmbillings Reason: 1
Thanks for your work on this!
I'm new to Arduino, but your code makes sense so far apart from a few things...

My current Loop (test) code is:

Code: [Select]
 
 ramp(false, 1200);
 dw(13,HIGH);  
 degrpmslowCool4(false, 3.6, 1200);


I'd expect this to ramp up, then when the LED comes on to do one rotation - I assumed "deg100" is the number of degrees divided by 100. But it spins round more than that (around 2 times ish).

Can you clarify how the values work? My eventual goal for my project is to get the motor rotating at a known speed (doesn't need to be fast, a few RPM is enough, but I do need to know the speed is reasonably accurate; i.e. whatever function to run at a consistent 6rpm would be fine)


**EDIT**
Actually, just having this command in my loop:

Code: [Select]
degrpmEZ(false,90,1200); 

Will leave the motor just spinning forever- so I guess the "deg100" is not what I think it is. And if my loop only has degrpmslowCool4(false, 3.6, 1200); in it, the motor never even moves..?

sbright33

Off the top of my head while traveling I don't recognize ramp().
36000 is 360 degrees in my function call.
1200 is 12 RPM.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Bajdi

I wrote some non blocking code (not using the delay function) for these stepper motors a little while ago: http://www.bajdi.com/non-blocking-code-for-the-28byj-48-stepper-motor/

I have just written some code that controls 4 of these little stepper motors using 2 74HC595 shift registers. So I'm controlling the 4 motors with only 3 pins. Will post it later on my blog.
www.bajdi.com

Go Up