Driving an analog gauge with a small stepper directly from the Propeller
JohnR2010
Posts: 431
In yet another project I would like to drive this small stepper motor directly from my Propeller's pins. https://www.tindie.com/products/TheRengineer/analog-gauge-stepper-breakout-board/
I plan on making a custom analog gauge with it. The coils only require 20mA so this is doable. Anyone done this before? I see there are tons of stepper objects but they are all talking to a stepper controller. I want to go direct to the Propeller's pins. I don't think I need all the fancy ramp up and ramp down times a full blown controller would have.
Thought I would check before I created one.
Thanks.
I plan on making a custom analog gauge with it. The coils only require 20mA so this is doable. Anyone done this before? I see there are tons of stepper objects but they are all talking to a stepper controller. I want to go direct to the Propeller's pins. I don't think I need all the fancy ramp up and ramp down times a full blown controller would have.
Thought I would check before I created one.
Thanks.
Comments
No way would I ever drive a stepper straight from the Prop pins. Being old fashioned I would use a few little transistors to do the current drive. Or perhaps a chip that contains such driver transistors like the old faithful: http://www.ti.com/lit/ds/symlink/uln2803a.pdf
Since this thing is so small, only requires 20mA per coil, and I plan on using diodes to protect the pins from inductive kickback, I was thinking I would be okay. Can you technically share your concern? Or is it a best practice / gut feeling that's telling you to not do it?
This will be another battery powered ZigBee Home Automation project so I'm trying to keep energy usage and PCB real estate to a bare minimum.
If I was you I'd be testing if that motor actually moves as expected with a 3.3 volt supply. Checking what current it actually requires. And so on.
Kick back diodes is of course a good idea.
In general I like to keep high current circuits away from logic circuits, but if you can convince yourself it's OK then it might be.
If you want to go the transistor route, try combining a 74HC595 and a ULN2803.
If I am not mistaken, the code below was originally written by someone besides me, but I believe I modified it for two motor operation.
The motors have 4 separate connections to them so I am unsure how they are driven but they are very easy to get and very cheap. I would expect them to run off 12 volts but can't be 100% sure.
Well now, that brings up a very important point. Four wires definitely indicate a bipolar stepper motor, whereas more than four wires indicate a unipolar stepper motor. Bipolar motors are much more difficult to control than unipolar motors, because they require h-bridges, whereas the unipolars just require four transistors and perhaps four current limiting resistors.
That's the plan. I have seen discussion where people are driving it directly from the Arduino's 5v pins. I ordered one and will bread board it to my propeller and report back.
BUT, that breakout board is far too expensive. Those steppers can be had for a dollar or two from many places, or by a bunch of them here : http://www.wholesalesteppermotors.com/
I found a data sheet for those steppers here: http://www.jukenswisstech.com/JSTFiles/downloads/2011/06/X27_Flyer_v1.3.pdf
They suggest driving it with 5 to 9 volts. At 260 ohms coil resistance you will only draw 13ma from a Prop pins 3.3v. Might work.
Schematic
PCB for above Schematic
http://wenku.baidu.com/view/ba7fed6e4b73f242336c5f4c.html
Thanks Heater I was having trouble finding the spec sheet. Totally agree with you on the breakout board cost. I ordered one anyway so I can use it in my bread board. Heck the guy put his Dip Trace files up on his GitHub site so I don't have a problem giving him some business. If I get it working I will order several of the motors and incorporate it into my existing projects.
Just sticking this link here so I can find it down the road http://guy.carpenter.id.au/gaugette/blog/page/2/ They have some good test results on this stepper.
Another great document! They even say in the above document "The stepper motor has an accurate and repetitive movement and can operate directly with digital signals from a micro-controller or an ASIC." It looks like it has two coils and can be run with single 3.3v power or in micro steep mode by supplying +3.3 and -3.3 to the two coils.
idBruce any thoughts now, on an existing Spin object? I don't have experience in driving steppers other than helping my son drive one for his senior project. Based on the examples in Heater's last document I should be able to create an object if one doesn't exist. I like the way you use an array to sequence the coils in your above example. I will probable do the same thing, good stuff.
I have used the X27.168 stepper motor with a L293D and 5 volts. I tried using 3.3v early on but it didn't provide a very fast response. I'm not at home right now but I can tell you that I used "something" like this in a repeat loop:
where pins 1 through 4 are used for the stepper motor as outputs. I did not ever try to add acceleration.
This motor has 315 deg of rotation due to internal stops. I think each full step was one degree and each full step had three partial steps for a total of 945 steps (stop to stop) but I could be wrong here.
I can also say that I wanted something smoother at slow speeds. Not knowing where to being to program microstepping for the propeller, I purchased the AX1201728SG from ebay (available in small quantities) which will microstep this motor and only needs two propeller pins.
Hope this helps
AJ
Yes, looks like driving these little guys straigt from the Prop pins is probably going to work. With a bit less torque but it should move just not so fast perhaps.
About that +3.3 and -3.3. All you have to do is connect a coild to two pins on the Prop, call them P1 and P2. Now you can drive the pins like so:
So there you have your positive and negative drive for the coils and can get the thing moving.
Next up is micro-stepping. Use 4 PWM outputs and output modulated "levels" rather than the LOW and HIGH above.
Thanks. I have done that with several other circuits don't know why it didn't occur to me to use two pins here. I think I was looking at the breakout board schematic and they have VCC and VSS already tied to the diodes... I just wasn't thinking. Thanks.
Thanks AJ that is similar to what Bruce was doing. I think I will be fine with the code. I just wanted to check if there was an object for driving this stepper out there and I don't think there is. I would more than likely rewrite it anyway.
Rodney
-Phil
I do not believe the forementioned code listings will work for you, but I could be wrong. As is well known, I am not an electrical genius but I do believe that you will need a dual h-bridge to drive that stepper. AJM mentioned the L293D in an earlier post, but the specs would have to be reviewed. For such a small motor, I believe I would try constructing the h-bridges from several small transistors, but even then you may need a step translator.
I will get back to you.
The only question is do they have sufficient current drive capacity for the load.
In this case it looks like they might.
Phil is right but this stepper has internal stops. No additional mechanical pin is needed.
Can we upload datasheets to the forum or is that frowned upon?
AJ
-Phil
The Ardiuno library can be found in github under: https://github.com/clearwater/SwitecX25
The file I was using (attached) to drive the stepper was a slightly modified version of Johnny Mac's stepper code from an old article of his on stepper motors. All credit goes to him.
I haven't been on this forum in a long time but remember that it being a good community. If someone is interested in writing a proper object for this I would gladly ship a spare motor and a loose TSOP quad-driver chip.
Hope this helps,
AJ