Saturday, 27 February 2010

Serving the Servo

Today, I spent some time playing around with some old stepper motors and Arduino. The programming was the easy part. The challenge is to make it work without actually knowing the specs of the stepper and having to "make do" with available power supplies.

I completely ignored the Arduino built-in examples and modules to get where I wanted to be. Unfortunately, the stepper (85 Ohm, built in the last millenium) with the power supply at hand (12V plug-pack) didn't yield a lot of power nor dynamics to make it interesting with micro-stepping etc. Well, it rotates as you'd expect, and at some speed it locks up, as you'd expect.

All I had at hand was a ULN2003A (pdf) to drive the stepper, so there was no going with some of my bipolar types. Anyway, looks like micro-stepping, changing from micro-stepping to full-stepping at higher rpm are no problem. Interrupt-driven routines are fine as well, though it takes a bit of digging to find the right programming references.

Step by step.

I also have 3 old battery-power-drills, and decided to give one of them a go. An IRFZ44N (pdf) HEXFET power MOSFET plugged into the ULN2003AN, and an old PC power supply to deliver 12V 8A made up the electronics. A photo-interrupter plus an old business card served as the feedback system. This turned out to be an interesting, but also somewhat puzzling setup.


Servo Control run on Coffee, Cable Spaghetti & Arduino.

The idea was to make the servo to run at low speed by chopping the supply voltage based on the rotational position. In principle it works, but the motor is quite powerful, and my 32-alternations-per-rotation are not enough. Basically, the motor fires up, then rolls out to a stop. Stir and repeat.

ULN2003A + Arduino.

I lowered the effective power to the motor by chopping down the already chopped signal to 10%. This worked and the motor ran slower. Some side-effects: The system is undamped and a certain amount of accelleration and decelleration is noticable. Strangely, the motor does not like it when I chop the signal at a high frequency. I'm not sure if that is related to the electronic components (unlikely as the IRFZ44N has a very fast response rate) or if it's to do with motor friction. Basically, all you hear is a high-pitched sound and no motor movement at all. I would have expected a high-frequency chopping signal to make things better, but no.


Don't throw out them olde business cards.

Well, back to the real world. As expected, servos aren't the ideal choice. In particular, when something goes wrong, they might just push on and physically crash your cnc system. In comparison, a stepper motor will just lock up. It's a pitty, because these motors would be easy to connect, have high speed, are cheap, and are comparatively powerful. Finally, I wouldn't want to use business cards on a real cnc machine, and proper encoders are amazingly expensive.

2 comments:

justint said...

Business card! Once version 2.0 (i think that's what your up to) is ready, first thing you cut is new encoder disks.

Thomas, the Infinitely Wise said...

justint:

This may be less funny than it seems. It might actually be good to have an encodeer disk to figure out if the stepper losts steps and allow an on-the-fly adjustment.

A 50mm diameter disk with 3mm notches would give about 52 changes per revolution. with a 2.75mm bolt, that means a resolution of 0.05mm, or around 4 full-steps of the stepper. Definitely better than the expected precision of the entire system.

Problem is that this is a bit fiddly with the photo interrupter and the disk in the middle of flying wood debris and dust. I previously drilled the holes into a CD-ROM. That worked quite well and was more robust than my business card. But doing this by hand without a drill stand was not pretty.

I'll keep it in mind.

Thomas