Easy Driver Stepper - Worlds Smallest stepper Project. - Electronics Forums

Author Topic: Easy Driver Stepper - Worlds Smallest stepper Project.  (Read 12238 times)

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Easy Driver Stepper - Worlds Smallest stepper Project.
« on: February 20, 2013, 09:16:32 AM »
Success …. Well kinda!
DISCLAIMER: Although there are many many hobbyist and engineers out there very proficient in the art of programming and Arduino hardware I am NOT one of those people. What may seem blatantly obvious to someone else, I am thoroughly and completely ignorant to. I have always wanted to get into the interesting world of Arduino but never seemed to have the time or project for…. Until now.

Background:
I am a mechanical engineering looking for a simple, cheap, and quick way of indexing a rotary disk for a test fixture.  The stepper will give me that degree of precision (via micro-stepping) I need. Future plans involve adding an encoder for positive feedback on exact position.
This is why I’ve found my way here.

Setup:
I am using a 5V 1amp wall wart supply that was really intended to charge a phone as a power supply. I know those ratings are rather glorified and a far stretch at its best. Everything has been breadboarded but will become a more permanent fixture once design has been finalized.

Issues:
 I was able to get things up and running pretty quickly although I have encountered a few quirks. I am certain my power supply is a tad bit too low.
Intermittently, I will notice that the micro-stepper (3.8V 650ma rated) will do nothing but jitter a little when I ask it to step (does this have to do with debounce delay?). I will have to disconnect things and retry a few times to get the stepper to index properly under zero load. The test fixture was designed so that everything rides on ball bearings so there is very little torque requirements. This little stepper should be more than capable of turning the 3” disk. I suspect my input current is far too low. I will find a more suitable power supply today.
After taking the test fixture home with me and playing with the number of steps in the sketch, I noticed that the steps behave just like the momentary switch I have hooked up. I was under the impression all I needed to do was give it a single pulsed input to have the steps count down and then stop. When I increased the steps I needed to physically hold the switch down until all the steps were complete. This is undesirable due to our future plans to have the fixture fully (or at least partially) automated. If I can adjust the sketch to read just a single input pulse to trigger the countdown that would be great. The only issue is that I am NOT a programmer by any means. I can vaguely interpret what the sketch is doing but again I am NOT a programmer and really don’t have this skill. Any guidance would really help right now.
LED Direction indicator:
I am using a Pro-Micro that does not actually have a pin 13. I assume changing it to another pin in the sketch should solve this issue for a directional visual indicator. I will work on that today as well and update.

Moving forward:
It was decided today that because the fixture will not be visible when in use there will be a need for a visual indicator (LED) that the stepper has reached then end of its steps. I can only presume that is probably a simple few lines of code yet I have no clue on how to accomplish that.



Thanks for reading my case study. Anyone that can chime in and help will be greatly appreciated. Any tips pertaining to my setup would also be beneficial. I will try and upload some pictures and maybe a short video of my setup because everyone loves pictures and vids.
Thanks!
« Last Edit: February 20, 2013, 10:48:40 AM by Yellow »

Electronics Forums

Easy Driver Stepper - Worlds Smallest stepper Project.
« on: February 20, 2013, 09:16:32 AM »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #1 on: February 20, 2013, 11:06:47 AM »
Yellow, thanks for posting the details. I am still on a road today and will have to come back again tomorrow for a more detailed reply. Just a couple of comments for now: it's been a while since I wrote the sketch, but I've glanced at it and it appears that it should "latch" the button output, i.e. if you pressed it, it would have to count all steps (microsteps, actually, see more on that below)  to zero before it can respond to another button pres (in either direction). It would not be difficult to adjust it to work any which way you wanted regarding the button presses, I can do it in the next couple days, just need to know exactly which behavior you want.

Regarding the microsteps: do not count on microsteps (i.e. 1/2, 1/4, 1/8, 1/16 modes of operation of  Easydriver) for positioning! Some of them are so insignificant in terms of motive power that the rotor of the stepper will not even move. The main purpose of the microsteps is to smooth the otherwise very rough and vibratory characteristics of the rotor's rotation. it just lowers vibration and wear and tear on the stepper and the attached mechanical parts. But for positioning, you can only ever count of full steps. In other words, if your stepper has 200 SPR (steps per revolution) - that's all you will get in terms of positioning - 1.8° of resolution, not 200*16 = 3200 steps = 0.1125°.
I looked at my old post and I can see where I went overboard promising crazy accurate positioning of that micro stepper. It is still impressive, but I have since done a lot of testing and figured out that no microstep provides positional accuracy. So, your angular rotation with 160 steps (as in the sketch) will be 10 angular steps of 1.8° each, not 160 . Just keep that in mind.
I gotta go, will take another look at it tomorrow.
Cheers!

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #2 on: February 21, 2013, 09:05:57 AM »
Update:
The power supply has been upgraded to a 12V 300ma one and that solved the unresponsiveness. Yet, after setting to FULL steps, every third button push (step increment) the stepper starts to jitter and not keep up with the proper number of steps in the sketch. It is very erratic. Is there a time delay that I can adjust? I suspect it has to do with the comparator portion of the sketch to eliminate noise. At 1/8 step things seem to behave appropriately.

At startup I apply power and the stepper just seems to jitter for every push on the momentary switch. It will even switch directions for a little. I try double checking connections and re-uploading the sketch. Nothing seems to work right until the stepper warms up and then things sort-of start to work. I am not sure why things are so unpredictable. Im at a loss right now. I'm starting to think this homebrew stepper motor indexer was a bit over my head.

The pin13 led direction indicator is still part of the sketch although I don't physically have one on my pro-micro board. I wonder if this has any doing on my issues. I do still need to find a way to give a visual indicator that the stepper has reached the end of its countdown so the button can be released (non-latching method) or so that the button can be safely depressed again (latching method).

BTW I want to thank you once again for getting me introduced to the world Arduino and steppers. Thank you for making your sketch public and assisting me as much as you have.
« Last Edit: February 21, 2013, 09:53:06 AM by Yellow »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #3 on: February 21, 2013, 11:52:40 AM »
That initial jitter is a bit strange. It looks as if the pull-up resistors aren't there but since we've already discussed those, I assume they are in (with values anywhere between 1kΩ and 10kΩ).
How are you connecting the EasyDriver, btw? It needs its own 5V for the logic, and the "normal" board has a voltage regulator that takes the motor input power and converts it into 5V. I didn't catch that before when you were using 5V supply (it would be too low) but now you're using 12V, so that would not be an issue.

Are you using fully populated EasyDriver board (the Allegro chip and all of the resistors, caps and the pot are soldered in)? The only reason I ask is because I have done some "frugal" EasyDriver projects where I would buy  just the unpopulated board and solder the Allegro chip on it and nothing else (as the rest would come from outside circuitry).

Another important question: which exactly stepper are you using? Is it an actual bipolar stepper (4 wires) or is it a unipolar (6 or 8 wires) wired as a bipolar or perhaps even mis-wired?  Are you certain that you've found proper winding ends? The polarity does not matter much (although the direction of rotation will change if you swap ends within one winding) but you must connect windings A and B to their corresponding outputs on the EasyDriver properly.

The LED on digital I/O 13 is only an indicator of direction at the moment and you can easily move it to another digital I/O - line 16 in the sketch:

Code: [Select]
const int ledPin =  13;      // the number of the LED pinChange 13 onto whatever output is available.

It would be trivial to add another LED and light it up when the stepsPassed variable equals "0" - which means that all of the preset steps have been completed.

Also, the debounce delay variable is debounceDelay = 50 it may actually be better to increase is somewhat - a possibility of jitter will be less.

if you want to post a picture where the connections would be visible, I'll take a look, sometimes you need a fresh pair of eyes to spot some wiring issue. Use the "attachements" feature here and upload the picture.

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #4 on: February 21, 2013, 02:13:35 PM »
Cleaned up wiring.

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #5 on: February 21, 2013, 02:13:59 PM »
Close-up

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #6 on: February 21, 2013, 02:23:46 PM »
Nick, thanks for your reply once again. I cleaned up the wiring as I suspect a lot of my issues came from loose jumper wires. Things seem to run fine now with 1/8th stepping. I will leave it that way as the wheel indexes properly for now.

I will be also upgrading to a 12V 1A power supply and perhaps a Big Easy Driver board. The stepper is your generic NEMA8 4 wire stepper. There isn't anything special to it and is rated at 650ma per coil. I can only provide half of that with my current power supply.

I know it sounds trivial but the entire jig will be inserted in a test assembly. There will be no visual or audible indicator of when the wheel has completed its steps. I was initially asked to have a LCD display the information but I negotiated to utilize a simple LED to display when the steps = 0. The LED will be mounted next to the operator and will give a queue on when to hit the button. Would it be possible for you to assist me in writing that portion of the code?

The sketch appears to read as if the buttons are latching but in-fact they are not. They must be depressed the entire time while the countdown occurs. It is not necessary but if the sketch can be modified to have a latching output that would make operation a lot simpler with minimal user interface. This will also help with our second revision where we will be integrating with LabView. I will only be provided with a simple output pulse. It would be very difficult to keep the output high until the steps are completed.

I hope the pictures are able to help anyone following this post to understand what I'm trying to accomplish.
Thanks again!

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #7 on: February 22, 2013, 01:58:51 AM »
Just wanted to post a quick update: I did write a sketch that moves the stepper back/forth for preset amount of microsteps, has "UP" or "DOWN" buttons (my stepper is actually a linear slide) latches the button presses or makes continuous move if you don't let go of the button and has 3 LED indicators: direction, "ready" and "in motion". The last one is for the case when the movement is so slow, you can't easily see it. I have also added speed (RPM) control potentiometer (5kΩ - 10kΩ is fine, in fact any pot will do). Tested it on a linear stage with a bipolar stepper but it will work exactly the same for simple rotation like in your setup (mine's the same type stepper,  just coupled to a screw) .

I did not have a time tonight to put a schematic diagram together but I used copious amounts of comments in the text of the sketch, see if you can manage by that (digital I/O and one analog I/O assignments are all described) until I get around to it, hopefully tomorrow, impending snow storm permitting.

I have also added a feature to disable Allegro chip while not in use - my stepper was getting hot while holding position. Turning motors off when not in use saves power and overheating but may not work in your jig if you have to hold position (and have power to spare, which you do).  Simply don't connect the "Enable" contact of the EasyDriver and you'll be fine if you don't need power save.

See the Arduino sketch attached.
« Last Edit: February 22, 2013, 02:01:00 AM by ElectroNick »

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #8 on: February 22, 2013, 09:06:57 AM »
Thank you very much Sir! I actually was reading over the datasheet of the Allegro and noticed the nifty Enable and Sleep pins. It took a few passes for me to quite grasp the difference but I do believe the Sleep pin is better suited for me. It essentially shuts down the chip and makes it brain dead. From my reading, the Enable pin really only shuts down the motor drivers and for some reason on my chip it still maintains holding current. I pulled it both high and low and there was no change. When I pull the sleep pin down the stepper is free to rotate. I'm not sure if my theory is correct on the pins but my jig does not need any holding forces and the ability to cut power to stepper is great.

Thank you again for your amazing sketch! I will attempt to decipher it today at work.
Good luck with the storm.
Keep warm.

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #9 on: February 22, 2013, 11:20:39 AM »
The way I understand the difference - SLEEP shuts down the entire chip - logic as well as power circuits. ENABLE shuts down just the power to the motor - the logic is still ON (but it draws very little current)

Be careful with "SLEEP" - when you wake it up from SLEEP, the pointer of microsteps is reset to  zero again. This may or may not be your true position, depends on at what point is actually went to sleep. In other words, if you stopped at 6th microstep in 1/8 step mode, put it to SLEEP and then woke it up, you would have one step that was 2 microsteps short of a full cycle. 

In this particular sketch it would never stop in mid-cycle, so it is not really an issue, but just in case you'll modify it later - I  wanted to point out that, since positioning is important in your setup, you might as well only use ENABLE - safer all round.

Good luck and keep me posted!

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #10 on: February 22, 2013, 07:00:47 PM »
Yellow, I posted the circuit diagram, the marked-up Arduino sketch, description and a short video of its operation on my blog here: http://elabz.com/manually-controlling-bipolar-stepper-motor-with-arduino-and-easydriver/. If you have any question about it, please just continue this thread. I hope you'll have a properly working jig in no time  ;)  Cheers!
 

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #11 on: February 25, 2013, 10:56:32 AM »
You sir are a GENIUS! First I would like to exend a huge thank you for helping me get this project rolling and introducing me to Arduino. I certainly do feel much more comfortable with the hardware after spending some more time with it.

Update:
Success!....Finally
I apologize for the late update but I spent considerable time on this project over the weekend and didn’t want to post back with negative results. At first things seemed simple enough. There were very few extra components needed from the previous configuration. I'm using a Pro-Micro so it is missing pins 11,12, and 13 (for anyone that is following along). I changed these pins to 10, 16, and 14 on my board. I put it all together, uploaded my new sketch, and waited for the results. At first things just seem to jitter around. I was worried that this was due to the added leds sucking up my very few precious milliamps. I toyed with things some more and didn’t manage much more than some flickering leds and a jittering stepper.

The board started to act almost like a capacitive touch switch. If my finger was anywhere on the boards/breadboard the stepper would jitter and the leds would strobe. I figured this was an indication of a bad or floating grounding problem. I know logic circuits reference off ground so this surely seemed plausible. I re-striped my jumpers and looked out for any stray wires. I made sure nothing was crossed or shorted. I tried again and had the same outcome as above.

I then figured the problem was somewhere within my sketch. I thought maybe simply swapping output pin numbers was the issue and so I carefully went through everything. Nothing seemed to be missing. I re-uploaded the sketch and set things in motion. This time the indexer would just continuously spin. I played with the gain on the pot. and the stepper sped up considerably. It was then apparent I had plenty of amps to spare and that could not be my problem. The leds continued to strobe or go stead very randomly.

I suffer from OCD (obsessive compulsive disorder) as most engineers do so naturally I like my boards laid out very compactly and neatly. I initially ran my output pins 10, 16, 14 and resistors to the leds under the Pro-micro board and EasyDriver board. I thought maybe this could be an issue with a short from exposed tracks under the boards. It turns out the boards are pretty well insulated underneath to prevent this. I then assumed there must be some signal degradation from my unnecessary routing of jumpers. I pulled everything apart all over again re-checking EVERYTHING once more (this was at 2am last night and I typically have to get up at 5am for work…. Time to sleep!)

This morning at work I reverted back to the original sketch without leds and all the fancy stuff just to make sure I didn’t fry any of my boards. Things worked out perfectly even with my relocated direction and step input pins. I was at a loss.

I started to repopulate the breadboard but this time I used the large floating green jumpers as seen in the below picture. This SOLVED everything. The sketch works flawlessly. I’m not sure why pulling the jumpers up and over the board fixed things but those outputs are pretty sensitive.

Below is also a picture of the test fixture. This one is not loaded with the optics so you can see right through the wheel. You can see why a indexing stepper can be a lifesaver in testing each and every element.
Thanks again Sir for all your help! I will surely update as things go. I am very fortunate to have stumbled onto this forum.
I will try to post a video later in the day.
« Last Edit: February 25, 2013, 02:08:22 PM by Yellow »

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #12 on: February 25, 2013, 10:57:18 AM »
Cleaned up board. Take note of the Green Jumpers.

Yellow

  • Trusted Member
  • *
  • Posts: 9
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #13 on: February 25, 2013, 10:57:52 AM »
Indexer Jig - Optics missing

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Easy Driver Stepper - Worlds Smallest stepper Project.
« Reply #14 on: February 25, 2013, 12:24:16 PM »
Indexer Jig - Optics missing
Looks so very interesting! Are there going to be lens in those holes by any chance? Just guessing by your mention of optics...

Anyway, thank you for the update. I am glad things have started working out!

I don't believe routing of the jumpers would make much difference - this is by far not an RF circuit, all the currents are sufficiently high and voltages are sufficiently low for the actual conductor path (and, within reason, their length) to not really play a role. There would not be a signal degradation either - it's either pulled up or down, it's not oscillating. It could be an issue with the old jumpers not making good contact with the breadboard or something of that nature.

Breadboards are not all that good for long term use, perhaps you want to solder this on a piece of perforated board instead if this device will be used for a long time.

Thanks in advance for the upcoming video update! I am always interested in seeing other people's projects in action - sometimes can lose myself in YouTube browsing mode for hours looking at all the fascinating devices people build!

Cheers!

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
10629 Views
Last post December 14, 2012, 04:14:52 PM
by ElectroNick
1 Replies
5911 Views
Last post December 14, 2012, 04:26:03 PM
by ElectroNick
9 Replies
12546 Views
Last post February 09, 2013, 06:18:18 PM
by ElectroNick
0 Replies
6966 Views
Last post November 07, 2013, 10:26:20 AM
by Lego
9 Replies
20031 Views
Last post December 16, 2015, 12:03:18 PM
by PaulBailey