New 28BYJ-48 library

sbright33:
Does anyone want this?
Will you test it more?
How about a single function to detect extra torque and slow down keeping speed to a maximum without stalling?
If I was purely offering it for others I should put it in a different category?

You have provided no more than a series of vague statements. Nothing there to test. :roll_eyes:

Well of course. I'm working on some new functions and testing myself. I wasn't sure if anyone was interested. I've posted most of the code before, but here are a few enhancements. I wanted to organize it (above) so it's easier to understand without looking inside the functions themselves. There is no need to unless you're curious like me. There are only 1 or 2 global variables you might need, and no additional functions to call to setup. Can you think of any additional functionality I've missed?

I'm interested in this, I have 2 of these little motors. Can't believe they have enough power to spin a DSLR. Please make a video of it :smiley:

Please test it and tell me what you think? You can spin something as heavy!
Just uncomment some of my lines in loop().

stepper2.pde (17 KB)

Did anyone try it yet?

Could please post an example sketch using the code # button? I can't figure out the code in the first post.

Download the zip file (attached above). It's not a library yet. Compile the entire file in IDE. Uncomment one of the lines in loop() to test it with your motor.

Hi Sbright

I have tried it, works very well so far.
This is good work, there is often questions about this motor in the forum.
And once again i am surprised how smooth this motor runs. And for the torgue, I cant hold it with my fingers.

Finally some feedback! Thank you. I tried to make it simple. The 4 nowait functions might confuse someone. All the functions are calibrated to be accurate according to RPM. The torque is inverse to the RPM past the startup speed. At slow speeds the Hot functions have more torque than the cold ones, especially with a 5v supply. This is at the expense of power consumption. Please ask if you want to know why I did something in the code. Did you try the halt when there's too much load subroutine? You can change it to print the load instead. Did you see you can turn 1.00 deg 360x and it works! Or 1.50 deg 240x. 3.00 deg 30x is 90. Without microstepping. You get the picture.

You can easily remove the floats to make the code size much smaller. You only lose movedeg and err functionality. Only the functions that you use are included in the executable. Some of my sketches are 1.2K in size. I think this will work on ATTINY85 with a few changes.

I was thinking of adding sleep between steps when you're going slow. Anyone want it?

I just tried it out, had not seen that you posted the .pde file :blush: It does work very well. I've thought about buying a cheap tripod and add a stepper motor to it to make 360 pano's. Might be possible with this little motor? That's quite a bit of code you have written, hats off to you!

This is much better in the real world with big lenses making a GigaPan, it's sturdy.
I wrote a simple library for it. You just need a screwdriver to modify it.
I removed the internal stops and made a simple one on the outside.
You could design a bearing to use with our tiny motors.
But I just mounted my T2i on the shaft! Made a wooden base for the motor.
It works fine so long as you have a level table or rock to set it on.
The Bescor goes 7deg/sec max.
Our stepper 30RPM which works out to 180deg/sec or 25x as fast.
Too fast to stop blur with a 200mm lens spinning on it.
That's why I wrote unramp() to stop and start.
With the Bescor I can take a panorama or Gigapan without stopping @300mm.
With the stepper I can capture 360 deg in 2 seconds.
I've been making endless panoramas, they just keep going and going, round and round...
Faster than this, 1/8th the price:
http://gigapan.org/cms/shop/epic-pro

Haha, many times I have almost ordered a Gigapan. But the local camera shop over here wants 1000€ for the pro version. Which I need for my Nikon D300/700. Never heard of the Bescor, looks like a nice cheap solution. It's on my wanted list, thanks for the info.

Thanks for posting this library. It is working great for me at 5 volts. I am now going to do some 12 volt testing and I am going to add the line for the a-d to detect torque issues and I will post back any questions or information I have. Thanks for helping my out on Skype yesterday!

Jeff

Please let me know if you'd like any improvements. Or if there are bugs or problems. Any part of the code confusing? Not sure of the purpose? I'll explain.

I've written a new library with servo easing for animation. It runs simple scripts in the background allowing the processor to continue with other tasks. It works with Servos or Steppers. 4+2=6 at once together.

I've expanded it to include bigger steppers without a 64:1 gearbox. You think I just multiplied everything by 64? Nope.

It allows you to output a variable voltage to hold in place or slowly step the motor using PWM. I've got a 2V motor running on 12v when it needs to move fast than 1v to hold it keeping it cool, without a gearbox like before to keep it in position. PWM increases the maximum speed and allows you to slowly step without jerking as much. It also runs smoother at middle speeds. None of this was needed for our tiny 28BYj's. Got a big stepper? This is for you.

You've pointed out 2 of the coolest features of my library! I don't know why anyone would limit themselves to a 5v supply with a 5v 28BYj stepper. How about 24v with the 12v motor? All you need is those functions I wrote to prevent it from getting warm, while you gain the enhanced performance. The only limitation is that you can't keep running at full speed for long. The torque detection is cool. I've been told it's not possible, but I use it every day!

The library is really good. Why not turn it into a "real" library and put it on github? These little steppers seem to be very popular, I think a lot of people could benefit from it :slight_smile:

Thanks! Will do it when it's finished. What are the advantages of Github? Tracking changes? Any other advantages?

Can anyone suggest any improvements? Additional functionality?

Write some documentation on how to use it. For a newbie like me it was a bit difficult to understand the different things :blush:

So far all we have is at the top of this post listing the functions and a brief description. Some more documentation would be nice eh? The easiest way is to dive right in. To get started you only need to define which pins you have connected the motor IC to. For many of the functions I provided, no setup or initialization is needed. Just call them with the parameters they require. One line of new code. Experiment. Try it. It won't cause any harm until your motor gets very hot over an extended period. There are many examples commented out in loop() in stepper2.pde. Just un-comment one line at a time. Ask me specific questions here or PM. I'm willing to help anyone getting started.

Start by calling this function in your loop():
void degrpmEZ (boolean bcw, long deg100, int rpm100)
Does it work for you?