Electronic Dividing Head using the Arduino

Discussion in 'Software and Programming' started by cfellows, May 21, 2012.

Help Support HMEM by donating:

  1. Jun 9, 2017 #201

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    After a bit more experimenting the stepper motor driver seems to be the culprit. The decay setting to be specific. I tried rodw's code from the other thread, which BTW I like better, but at first I had the same issue of missed steps. I played around with the decay setting switches and for the most part that solved the problem. I still get the occasional missed step, but it's not as far off as it used to be.

    The dividing unit is mounted directly to the spindle of a benchtop lathe, so there are only the 12 tooth pulley mounted to the motor and a 72 tooth pulley mounted to the spindle. No flexible couplings or anything like that, so practically there are no backlash issues, but of course there is a bit of flexing from the belt itself. However, in this application it is not an issue. I still have a few stepper drivers that I haven't tried with the new code, and I'm pretty sure one the new drivers will solve the issue for good. I'll just have to wait for my new toys to arrive in the mail.

    That's my experience as well. I've had these strange issues with two drivers. I suppose you get what you pay for.
     
    rodw likes this.
  2. Jun 11, 2017 #202

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,333
    Likes Received:
    264
    I hope this doesn't sound obvious but have you double checked the current setting on the drive? One thing I've notice on other forums is that people sett the current settings too low because "the stepper gets hot". This kills motor performance.

    Another suggestion would be to tie the direction signal input either high or low. This is one way to isolate out noise and other problems on that line.
     
  3. Jun 12, 2017 #203

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    The motor is rated 2.8A and I'm driving it at 3A. I've tried all the settings between 1A and 3A and 3A works the best. I haven't tried the direction pin trick, but I'll give it a go.

    The decay setting seems have the most significant effect on performance. At 0% the motor is quiet and the motion sounds good too, but the holding torque just isn't there. I can easily turn the lathe spindle with my hand and holding the upper belt pulley with my finger the motor stalls. At 100% it sounds a little different, but still good and the torque is what it should be. At 25% and 50% the motor is noisy and it starts to whine after it stops. So simply put, the 100% setting is the only one that works. I would call the system 95% stable at this point. I'm guessing it's just a matter of the driver not being quite good enough.
     
    Last edited: Jun 12, 2017
  4. Jun 12, 2017 #204

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Can you disable the decay mode totally? With the Geckos and Longs Motor drivers I've played, with decay mode does not exist and they have performed flawlessly with both Arduinos and LinuxCNC
     
  5. Jun 12, 2017 #205

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    OK I corrected a few umm... observations in my last post.

    So yes, it is possible to disable the decay setting, but It seems this little driver is on its last legs. I was using the step program and I moved forward about one step per second and the motor driver just shut down. It came back to life after powering it off and leaving it for a minute or so and then power back on.

    The driver worked for a few minutes but I wasn't getting the same results from the decay settings I did before. This time the motor didn't stall when I held the pulley with my finger, but I couldn't say for sure if there was a torque difference between the decay settings. It all seems pretty random with this driver.
     
  6. Jun 13, 2017 #206

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    A quick update: All the problems disappeared with the new Leadshine DM542T stepper driver. The motor runs so smooth it makes me smile. No missed steps, perfect alignment every time. I'm using it with 36V @ 2.84A. Also the old TB6560 driver pretty much died today. It stays on for a few steps and then just shuts down.

    I still have another stepper driver coming in for a second dividing head for my milling machine and I'll be using a slightly beefier motor for that one as well.

    On that note, thanks all for your input. You've been genuinely helpful. I'm especially pleased to have found rodw's script as it suits my purposes better than the Liming one.
     
    rodw likes this.
  7. Jun 13, 2017 #207

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    They are a very good driver. In my view superior to the Geckos and 1/3 of the cost.


    Thanks for the feedback. I'm glad you like it. A rotary table controller seems to be a popular starter project for Arduino loving machinists. They don't realise to do it well, some advanced programming techniques are required and then the limited memory space bites so code has to be really lean & efficient. I don't think you can add any more features into an Arduino RT controller than I have!
     
  8. Jun 13, 2017 #208

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Don't forget that my controller supports multiple devices numbered 0-n (limited by memory) so if there are different parameters between your two rotary tables, you can set one up as device 0 and the other one as device 1. Then just select the correct device config as you move from one machine to another. :thumbup:

    Also a device can be configured as a linear one so you could also use it to control a stepper driven milling feed table on device 2.
     
  9. Jun 13, 2017 #209

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    Yup, that's what I was thinking. I just need to get a suitable connector for my control box so it's easy to plug in. My second dividing head will be using a separate 48V PSU as well, so all I need is to connect the control box to the stepper driver. I do have a bunch of available Arduinos and LCD shields but why be wasteful, eh?

    Faintly touching the subject, I thought I'd just write a word of modest wisdom here: I've made it a rule that if I buy these cheap Chinese industrial power supplies, I will never plug them to mains voltage before I check them internally. It has happened before and today I was reminded again why I do it every time. I got my 48V power supply in the mail today and for a fraction of a second I thought of skipping my standard procedure, but then decided to do it anyway. Good thing I did too, as I found immediately that one end of the beefy inductor inside was not connected at all, but the solder joint had failed and the inductor was just floating in there. I also found the Chinese had thought of using high quality "Rubycong" branded capacitors. They had also done a fine job heatsinking the unit, as pretty much every component was smeared with thermal paste. The unit has all the QC stickers and other cool stuff on it too. Oh well, after soldering the inductor back in and swapping the capacitors the PSU is working fine.
     
  10. Jun 14, 2017 #210

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    I also have an experience with a failed 48v Chinese power supply but there may have been some user error involved. It was replaced under warranty after I returned it to an Australian address. But by the time it arrived, I had bought a quality Meanwell power supply.

    I use these CB microphone plugs and sockets for stepper motors.

    [​IMG]

    If you use the 5 pin one, you can use one pin to pass the shielding through the control box. and earth it right at the stepper controller (but leave the shield unconnected at the stepper motor end.
     
  11. Jun 15, 2017 #211

    Ryan

    Ryan

    Ryan

    Well-Known Member

    Joined:
    Mar 5, 2009
    Messages:
    49
    Likes Received:
    11
    Hi Chuck. With your fixture for the collet chuck, was it difficult to bore the steel block for the bearings without runout or misalignment? I'm still trying to decide if it's easier to use pillow block bearing units (although they're more expensive)?
     
  12. Jun 15, 2017 #212

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17

    I had one of these connectors in my junk box. This is what I ended up hammering together. Just the Arduino and the LCD shield hot snotted to the panel and a few tactile buttons soldered to a piece of perfboard. I only need 3 pins for the step and direction signals and ground, as the stepper driver will be bolted directly to the bottom of my bench and the stepper motor is hardwired to it. So yeah, it's not pretty, but it works.

    cbox.jpg
     
    rodw likes this.
  13. Jun 16, 2017 #213

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Looks great!
     
    Captain_Obvious likes this.
  14. Jun 17, 2017 #214

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    Many thanks.

    I don't know if should be posting this here, but here goes anyway...

    I just got thinking about integrating a mechanical spindle brake to my dividing head. The brake itself wouldn't be very difficult to make, but I was just wondering about the Arduino code as I'm not exactly an expert on Arduino programming. Would it be as simple as adding a sort of go/no go line to the script?

    The Arduino could send a command to a relay card which controls an actuator of some sort and there could be a limit switch or something like that confirming the spindle brake is off and now it's safe to move the spindle.
     
  15. Jun 17, 2017 #215

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    It would not be hard. You'd need two 2 spare ports. One would be an output to enable the brake. When it goes high (+5v), it would trigger the actuator. The other would be an input that would tell the Arduino the state of the brake (on or off). You'd just need to make sure the current handling of the arduino pins was not overloaded or you will blow the pin. Optoisolators might be useful to separate the low volatage logic side from the higher voltage actuator side.
     
    Captain_Obvious likes this.
  16. Jun 17, 2017 #216

    Foozer

    Foozer

    Foozer

    Well-Known Member HMEM Lifetime Supporter

    Joined:
    Nov 26, 2008
    Messages:
    1,164
    Likes Received:
    69
    Gender:
    Male
    Occupation:
    Retired
    Location:
    Camano Island, WA
    SparkFun Beefcake Relay Control Kit (v 2.0) < 10 bucks . . . 10A on the NC contacts and 20A on the NO contacts at 220VAC.
     
    Captain_Obvious likes this.
  17. Jun 17, 2017 #217

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,333
    Likes Received:
    264
    There are a number of ways to do this but all involve using some sort of I/O on the Arduino. Generally solenoids strong enough to act in a brake mechanism are pretty high current devices. This high current requires a switching device external to the Arduino. What you use in that external buffer is up to you, it could be a mechanical relay, an optically isolated solid state device or even an old fashion tube if you are into retro

    One possibility worth considering is to go with a pneumatic solution that uses an air cylinder instead of a large solenoid. Going this route you can use a much smaller buffer to drive the solenoid in the pilot operated valve. A pneumatic solution gives you a lot of options as to how the mechanism would work for you.

    In any event as others have already indicated you really want to know the state of the brake before trying to index so an input that ascertains that the brake is in fact released is a good idea. The problem here is that many breaks solutions have extremely short throws and thus are hard to get a reliable on/off signal from.
     
    Captain_Obvious likes this.
  18. Jun 17, 2017 #218

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    The Sparkfun relay card was exactly what I had in mind. There are plenty of similar relay cards designed specifically for Arduino So all the high voltage/current stuff would be separated from the signal side of things.

    I was thinking something along the lines of a mechanical bicycle disc brake caliper driven by a simple electric actuator, solenoid or whatever. The travel of the brake lever would probably be something like 10mm so it would be long enough for reliable limit switch function. The brake could be mechanically engaged by default and switched off only when the stepper motor wants to move. The limit switch would give go/no go signal to the Arduino so even if the brake would be locked because of an electrical fault, and the Arduino wouldn't try to move the spindle.
     
  19. Jun 17, 2017 #219

    Foozer

    Foozer

    Foozer

    Well-Known Member HMEM Lifetime Supporter

    Joined:
    Nov 26, 2008
    Messages:
    1,164
    Likes Received:
    69
    Gender:
    Male
    Occupation:
    Retired
    Location:
    Camano Island, WA
    At 6:1 leaving the stepper engaged - writing stepper pin high - thus acting as a brake, be hard pressed to get it to slip considering the size motor you're using . . .
     
  20. Jun 17, 2017 #220

    Captain_Obvious

    Captain_Obvious

    Captain_Obvious

    Active Member

    Joined:
    Jun 3, 2017
    Messages:
    43
    Likes Received:
    17
    True, but the belt will still have a bit of flex. I doubt it will be an issue, but hey, why not make it better if it's not very difficult or expensive. I think I'll order one of those brake calipers for testing. They are dirt cheap after all.

    The lathe dividing head does have 6:1 ratio and an HTD 3 belt and that doesn't require any kind of a brake. The system is good enough as it is because it is almost exclusively used for cutting small gears. The motor is rated only 1.26Nm but it's plenty for this setup.

    The milling machine dividing head still in the works will have a 2.83Nm motor, 4:1 ratio and an HTD 5 belt, which will be somewhat more rigid, but there will most probably be noticeable flexing from the belt if I ever choose to do slightly heavier milling operations than I usually do. This unit will have an ER32 collet spindle since I already have a set of collets and the spindle is on its way from China. I may add an adapter for a 4-jaw chuck later, but that's irrelevant.
     

Share This Page