Yet another new Bit ... (stepper motor)

Have a great trip, @chris101! :smile:

Thank you @JackANDJude! We are driving the family - 2 adults, 2 teens, and 2 (large) poodles - to Michigan from AZ. So far, it’s been quite the adventure!

1 Like

Hi @chris101,
You were fully right with your remark

My arduino was switched on “Analog” when I took the pictures.
When switched to PWM (Pulse Width Modulation) you can clearly see that the Arduino makes the lower pulses (value of 80 in the Arduino program file) with a few small 5V (255) pulses in a row…
A lower pulse value is “faked” by a few small pulses with the same amplitude of 5 Volt…
This is bad food for the stepper motor I think…
When the Arduino D5 output is switched to analog mode, a capacitor of 0.22 uF is switched in parallel on the pulse (signal) line. This capacitor will be charged and discharged by these small pulses and integrates them into one lower pulse as shown in the above pics.
The I31 Littlebit oscillator generated crisp and clear block pulses , ideal to be used with a stepper motor.
See the following picture showing all discussed pulses together.

.

@alexpikkert, you rock! While on the face it’s kinda discouraging, i now believe that the correct filter can make it work. Some reading on RC filtering is in order, which I’ll explore more when I get back. Today though ive got 1300 km to drive!

1 Like

Safe driving !

Thank you @alexpikkert! I survived the 3000 km drive and then the flight back to Arizona (flying ain’t like it used to be …) I’ll do it again in the other direction when the family comes home just in time for school. I’m hoping to take a “little bit” more time for the drive back though (I especially want to stop at the buried cars east of Amarillo, Texas. I saw them on way, but didn’t stop.)


Much of my trip was spent thinking about your data. When I got back, the first thing I did was to score an oscilloscope! I’ve never had one before, but I now I realize that it is an essential tool if I am to figure out what’s happening with my pulses!

I am creating a “work in progress” project to discuss what I’ve done so far, as well as the arduino pulse problem. I haven’t solved it yet, but I feel it is just a matter of time and effort (and community help!) until I do.

2 Likes

Hi @chris101,
Good to hear you survived !

Meanwhile I found some interesting data on the Internet…
The following project from @Ekeler uses a dedicated IC type L293D that can also be used for easy stepper motor control:

Also Adafruit (lots of interesting info) published a lesson about this IC, combined with control from an Arduino:

Mabe you can use parts of it for your stepper motor project…
An oscilloscope will definitely make your life much easier…
Good luck and keep us posted !

2 Likes

Amazing teamwork going on here! :smile:

2 Likes

Right you are @JackANDJude! Y’all keep me headed in the right direction with this project.

Thank you for those links and your thoughts @alexpikkert I do have an L293 H bridge chip. My motor (28-BYJ48) is a unipolar motor. My understanding is that unipolar motors require darlington transistors to drive them, while bipolar motors use the L293. My design uses the 2019 (instead of the more often mentioned 2003) darlington array. I think I have seen a circuit that used the 293 to drive a unipolar motor, I’m not sure that would help though.

The issue with my module is in how the on-board Tiny85 interprets the incoming pulses. As you saw with your scope, the Arduino pulse has sloping edges. I believe this is the cause of the Arduino control problem I’m experiencing. I posted a ‘work in progress’ project on the Projects page where I explore the pulse issue:


ps, for future reference, I came across this independent stepper motor library on the Arduino forum:

http://forum.arduino.cc/index.php?topic=89159.0

The code looks pretty hairy though, so I’ll leave this for further down the road. I will be re-visiting my Tiny85 code though.

2 Likes

Hi @chris101, I am getting more and more interested in the basic design of stepper motors thanks to your project !
If you get into troubles about using a bipolar or unipolar stepper motor, I found an easy instruction to change your stepper motor from unipolar into bipolar:


Recently I bought the same motor (because very cheap) so I can try things out also…:smiley:

1 Like

That’s a very interesting link @alexpikkert!

Jangeox’ blog post has very easy to follow instructions. If I get more of these motors, I’ll give it a try, but I have only the one motor, which I’m not gonna dig into until I get everything sorted!. However, it’s good to know it’s easy to convert for a future project.

I like the idea of more power, but wouldn’t current usage double since both (longer) coils are energized all the time? Power consumption is already pushing the limits for a single bit. Mine draws up to 250ma while single stepping:

NOTE: it averages around 190ma. My module always runs in single step mode, to provide versatility within the littleBits model (that is, a single, 5 volt, low frequency analog signal for the input.) This preserves control, but sacrifices speed and amperage.

ANOTHER NOTE: I still plan on incorporating sbright’s stepper code, but the bottleneck will still be processing each analog pulse independently. Perhaps I should have a mode switch for running at full bore. That might cut the consumption in half.

Hi @chris101,
My 1st impression (without testing it) is that the windings used in bipolar mode are twice as long, thus having twice the resistance. I think when using the same torque the current will be lower.
In the blog the guy overloaded the 5V motor with 12V to get the extra torque…

Would it be an idea to use the Littlebits 5V VCC power line only for the control and pulses, and design separate voltage input terminals for powering the motor?
Many motor driver IC’s I found have this option of using two VCC connections, one for control and one for real heavy power. This will limit the risk of damaging (blowing up…) the sensitive tiny little littlebits…
I will also try to brainstorm a little about “how to connect the stepper motor into the Littlebits environment” ( how to control, how to use pulses etc)…:thought_balloon:

1 Like

That’s the same IC I used for my dual direction DC motor module. Works fine with the ATTiny85…

1 Like

Hi @chris101,
The internet is full of interesting information…
The following wiki explains 100% clear the basics of unipolar and bipolar stepper motors including nice animations.
It has a lot of interesting Arduino coding also and a simple method with two additional transistors to control a unipolar motor with only two control wires from the Arduino or Attiny.
Happy reading (maybe)…:blush:

1 Like

Thanks for burning a few more neurons on this @alexpikkert.

I didn’t really analyze the circuit of the modified motor. I just used the ‘no free lunch’ rule. Increasing the voltage pays most of the tab.


[quote=“alexpikkert, post:32, topic:22098, full:true”]

Would it be an idea to use the Littlebits 5V VCC power line only for the control and pulses, and design separate voltage input terminals for powering the motor?
…[/quote]

The idea of separate power and control voltages within a littleBits environment was discussed in Bruce’s Robot Arm thread. I posted a simplified littleBits/Arduino circuit to run a servo motor at 12 volts here:


The chip I have is a L293-98 dual full bridge. It’s part of a ‘shield’ for an Arduino uno (here). Interestingly, they give an example of driving a unipolar motor (it looks just like the one that I have) I’ll give it a shot, but EVERYTHING else I have read says the center-tap common (red wire/middle trace on the circuit board) needs to be cut. Next week I’ll get a uno and find another motor to hack, or maybe rip apart an old printer - I think they have bipolar motors in them (which probably use 12 or 24 volts.)

Hi @matthiasmwolf,

I am getting closer to abandoning the idea of a single input, and utilize a second input to determine the direction of rotation. That would make everything easier!

On the other hand, a single input is SO simple from the user’s point of view.

1 Like

Thanks @alexpikkert! That was a fun site to browse through.

So I was intrigued by the idea of running a unipolar motor as a bipolar motor. I guess they call these hybrid motors. Turns out that you do not need to cut any traces or wires! According to the example on the bottom of this page, all you need to do, is hook up the motor like a bipolar motor to an L293 using the 4 coil wires, and just ignore the common power wire. Waaay easier than doing surgery on my motor!

Here’s a movie of it working:

2 Likes

Hi @chris101,
Indeed, you are right !
I managed to get my little stepper motor turning this way exactly !
I used an L293D, an Arduino Duemillenove (I think this Arduino could be transformed into an Attiny including the sketch later on).
Using a standard library from Arduino I managed to let it turn and control the speed with a potentiometer. (Later maybe replaced by a littlebits dimmer).
The direction depends on the sketch I used and the number of steps also.
Next challenge is “how to select direction and number of steps with Littlebits.”
I found out that turning this little stepper motor a full circle of 360 degrees is done with 513 steps…
This is very usefull when you program the motor to perform a dedicated sequence in a project.
I will send a video and draft sketch asap tomorrow, it is too late now. Brain stops thinking. Needs some sleep. :disappointed:

2 Likes

Yes, I found it interesting that it took (well, I counted 512 steps, but I may have been off) so few steps. My bit form of the motor takes 2048 steps for a full circle. I guess that makes sense, since my driver takes half steps, and there are four coils instead of two. It seems to run slightly faster in bipolar mode - about 12rpm vs 10 with my setup.

Oh, by the way, I am working on a project that uses the stepper bit: The Magic 8-Ball Turner. No idea when I’ll get it done though, cause I don’t have a laser cutter :wink:

LASER CUTTER?!! Join in the adventure with me and Alex!

2 Likes