Go Down

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


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!

Skype Brighteyes3333
(262) 696-9619



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!


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);
 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)

Actually, just having this command in my loop:

Code: [Select]

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..?


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!

Skype Brighteyes3333
(262) 696-9619


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.

Go Up