Go Down

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

celem

The nano's supply is inadequate for the stepper. I used a separate 5v supply and just tied the grounds.

joogaa

@sbright33:
Hi! Do you have a new version of your code? Can you explain better your idea about the angle for motors x, y?

J

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

I'd like to move 2 motors called x,y at the same time.  Pointing a laser for example.  While the laser is on when you go from 0,0 to 10,10 it should move at a 45 degree angle.  That's simple just move 1x,1y,1x,1y... until you get to 10.  Or move them simultaneously.  Not so simple when you're going to 75,80 or an arbitrary x,y.  There must be an easy algorithm?  I don't know it.  Anyone?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

cr0sh


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


http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

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...
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

cr0sh

Found this; the links still work:

http://www.gamedev.net/topic/536735-bresenham-2d-3d-4d-6d/
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

cr0sh

BTW - that 6D one looks like it could be easily generalized to N-degrees...
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

sbright33

Your first link looks really simple!  I like simple.
Only 10 lines of code in the loop.  Thanks!
2D is enough.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

joogaa

did that algorithm work for pointing at x,y?

sbright33

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.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

lardconcepts


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!

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.  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.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

lardconcepts


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.


sbright33

Viewed 6900 times exactly!
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

lardconcepts


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! https://github.com/arduino/Arduino

It might look scary to start with, but you'll soon see how easy it is. https://help.github.com/articles/create-a-repo

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

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!
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Go Up