28BYJ-48 5-Volt Stepper

sbright33:
There must be an easy algorithm? I don't know it. Anyone?

Fairly simple for 2D stuff (there are tons of implementations out there - it is used for line drawing in 2D graphics); not sure what it would take to add a 3rd stepper (or more). You might also look into the few g-code interpreter implementations for the Arduino that are out there...

Found this; the links still work:

http://www.gamedev.net/topic/536735-bresenham-2d-3d-4d-6d/

BTW - that 6D one looks like it could be easily generalized to N-degrees...

Your first link looks really simple! I like simple.
Only 10 lines of code in the loop. Thanks!
2D is enough.

did that algorithm work for pointing at x,y?

Yes, in my simple experiments. Only 10 lines of code it is easy to follow. I've been sidetracked by a few other projects hope to get back to this. The whole point of Bresenham is to make a straight line while moving to arbitrary x,y.

sbright33:
My newer library is on another thread here. Many improvements. More coming. PWM to make it smoother. Non-blocking to free up the processor for other tasks. Higher voltage to increase performance without getting hot...

Hi sbright33, many thanks for your library. But I cannot find this newer version. Would you mind sharing the link?

I'm glad I found this, because with the standard library 28BYJ was getting very hot an not really behaving well!

I had trouble cobbling the code together from the various bits in this thread. Is there any particular reason to be pasting inline rather than just use a standard code-bin like pastebin or gist? If it helps anyone else, I put the latest version I could find on https://gist.github.com/4149982

The advantage of using something like Gist is that you can update the one file whenever you like and the forum link will always be up to date then.

Please don't take this as any criticism of your excellent library - it's just a newbie asking a newbie question!

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. Create a repo - 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: