28BYJ-48 5-Volt Stepper

Thanks for your compliments and posting my old code on Gist. I can update that site now? Will do it with a few different versions. It has branched off to a few since 2011. One for a bigger motor without gears. One for multiple steppers and servos together non-blocking with scripts. One using PWM. One to detect higher loads when the motor reaches travel limits. I could try to put them all together, or keep them separate. I also have a simple version for beginners which includes running cool and acceleration. This might be a great introduction for new users to understand first before it gets complicated.

sbright33:
Thanks for your compliments and posting my old code on Gist. I can update that site now? Will do it with a few different versions.

Would love to see your new versions! You can't edit my pasted code there, but creating a new account takes less than a minute and is free. You can either "fork" my copy of the code into your account, or just start again. If you want me to now remove my copy of the code I'm happy to delete it and replace it with a link to your new code.

Viewed 6900 times exactly!

sbright33:
Viewed 6900 times exactly!

Indeed. Which shows how popular your library is and how many people would appreciate the updates being made available!

If you have many versions, the other thing you could do would be to create a repository over at github. Then you have versioning and code commenting and people can suggest changes or improvements or bugfixes, they can follow the project and be notified of changes etc.

In fact, Arduino itself lives right there! GitHub - arduino/Arduino: Arduino IDE 1.x

It might look scary to start with, but you'll soon see how easy it is. Quickstart for repositories - GitHub Docs

If there's anything I can do to help, please let me know.

According to your link, Step 1 and 2 are on my local machine? But I don't have Linux. How do I do this with windows?
Should I just start with Gist? I get it!

sbright33:
According to your link, Step 1 and 2 are on my local machine? But I don't have Linux. How do I do this with windows?
Should I just start with Gist? I get it!

Yes, you could certainly do everything you wanted with Gist. There's some more setup info and Windows apps at https://github.com/ if you DID want to make a full repository of it, but a Gist (a sort of "github-lite"!) will do perfectly for this.

Edit: Looks like you've already got an account there! sbright33 · GitHub - if there's anything I can do to help get the new versions of the library up, please let me know.

Here it is at last! With new features. Will update Gist from now on.

Please...
Questions? Comments? Requests for new features? Improvements?
Thanks for looking at my code!
Steve

As a learning exercise or tutorial feel free to check out the older version, which is now obsolete.
https://gist.github.com/4149982

Hey, Steve! Great work! Going to bust out some breadboard and have a go later!

Might be an idea to let people know where to get the narcoleptic.h library from: Google Code Archive - Long-term storage for Google Code Project Hosting.

Incidentally, I've just added a note to the top of my old copy to point people to your version of the library.

Thanks again, keep up the good work!

Here's a demonstration of related code I've been working on. It allows the same script format to control both a stepper and servo simultaneously and independently. The script allows you to do motion easing and mechanical animation with Arduino and cheap servos/steppers. It's a work in progress.

Last summer I got a new Stepper motor! It's big and does 1 degree / step. It's faster 300RPM because there are no gears like the 28BYJ. I wrote more code to do PWM to make it smoother at slow speeds. It has no gears so you can't just turn off the power when you stop. When stepping slowly you need to keep the coils on, at least at a lower voltage. If you use 12v it will overheat within minutes. It's all here, view at your own risk? The 2nd file is smaller and much easier to understand first.

Is there Anybody out there... there... there...

I guess you're the only one lardconcepts!

sbright33:
Is there Anybody out there... there... there...

I guess you're the only one lardconcepts!

I'm still following the discussion; if I have anything more to add, I will...

:slight_smile:

sbright33:
Is there Anybody out there... there... there...

I guess you're the only one lardconcepts!

I would say that judging by the fact that your post is the 6th most viewed in this forum that there are probably LOADS of people out there appreciating your work. I know I certainly do.

Here's a way to know how many people are out there - shorten the link via somethin like goo.gl or bit.ly that gives you click stats, then stick "s28BYJ-48 5-Volt Stepper library" in your signature and link to either the forum post, or the github gist where the code is, and I think you'll be pleasantly surprised!

Anyway, I thoroughly appreciate the fact that you helped bring my stepper to life without smoke or burning smell :slight_smile:

Thanks it is great to feel appreciated! But I'm still in doubt about the number of users. I know my code is not perfect. I know it is confusing at times. Doesn't anyone have suggestions for improvements? Bugs? I'm really not that good. It's been a year now. Maybe there are many users who used my simple functions, and have not advanced to detecting torque or non-blocking code. Don't be scared to try them!

I'm making a list of enhancements to my code. I'd like to prioritize them before I start coding.
Any ideas for improvements this week?

Hey sbright33,

I've been following your tracks and posts for the last 3 hours and think that your work will help me like....a LOT. :slight_smile:

I'm trying to build an old school split-flap display, like the ones that we used to see in train stations...

I bought five 28BYJ-48 12 Volt from adafruit (those : Small Reduction Stepper Motor - 12VDC 32-Step 1/16 Gearing : ID 918 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits) and ULN2003 cards to control them (ULN2003 Stepper Motor Driver Board – ElectroDragon) and trying to control all of these with an arduino mega.

Got lot's of problem wiring everything since specs on both of those equipements sucks (inversed wired, no further explanation to use the 5V/12V jumper on the board...etc) but I think everything is ok now regarding hardware...

I tried the "classic" stepper library but I'm getting serious issues with it :

  • my stepper doesn't seem to respond the same way clockwise and counterclockwise with the same "step" entered...
  • my steppers are getting hot very fast
  • the specs of my motor give me 768 steps but it seems to approximately correspond to 1,5 rotation, can't understand why...etc etc

I also tried the AccelStepper library but as your hardware is closer to mine (except my motors are 12V) I'll jump in your code and see where it leads me...

If someone already got back to you on modifications needed on your code with the 12V model of the 28BY J-48 I'll be happy to have their comments... XD

Anyway, I'll get back to you in few days with questions (many, many questions...) and maybe the biggest THANKS that you ever had for this code !!

Welcome! You don't need to modify my code to use it with 12v motors. If your power supply is 12v then the temperature will be the same as running a 5v motor with 5v PS. A 12v motor will of course have more torque and speed. With my "cool" functions you can use your 12v motor with a 18-24v power supply. Otherwise you will not need the "cool" functions. They are designed for running a 5v motor at 12v or a 12v motor at 24v.

sbright33:
Thanks it is great to feel appreciated! But I'm still in doubt about the number of users. I know my code is not perfect. I know it is confusing at times. Doesn't anyone have suggestions for improvements? Bugs? I'm really not that good. It's been a year now. Maybe there are many users who used my simple functions, and have not advanced to detecting torque or non-blocking code. Don't be scared to try them!

OK, now that the stress of Christmas is almost over, I'm going to get back to this! So, are you saying that you are happy with the functional state of your library, but you'd just like someone to suggest ways of making it more clean and readable for newbies (like me!)

For example, you have:

const int mp4a = 13;	// 13 is not PWM should use 6 todo later

Is that actually OK to go ahead on rely on?

No, it's a horrible idea to use pin 13 for PWM, since it's not supported. You should use pin 6 instead?
It works with pin 13 as written in my code. I used it because it's convenient to connect the wires.
I deserve to be shot for keeping that in the code... But it works! It was originally a mistake.
Thanks for pointing it out, and reminding me. That's what comments are for in my code.
It was a test to see if you're paying attention? Somebody is actually using that function?

Hi Sbright33

I am trying to use your code to experiment with a 28BYJ-48 and uln driver board
and a arduino mega 2560
I compile your sketch and upload it successfully (ts rx lights flash)

then nothing happens

Probably a dumb Question, what digital pins are you using ( 4. 5. 6. 7. ) ?

Is the anything i have to do with the sketch for it to run

Be patient I am new at this.

cheer Owen