Wednesday, 20 July 2011

Whoops, posted this in the wrong blog.

(This was posted a while back on my non-CNC blog)

Firstly, update on what I've done:

I soldered myself a stripboard with the h-bridges. I hadn't really thought about how I was going to do it until I reached the point of doing it, so was taken aback when I noticed that my initial plan to mount the ICs in series across the board would have involved a lot of awkward wiring to make it possible to remove the ICs when I move up to a 5 axis. I had a think about it and went totally the other way with the layout, moved the IC sockets to the top of the board (strip lines going across the board from side to side) and just had the signal entering on the left and power lines out on the right. This configuration meant I only had to jump between the tracks the number of times I had to convert from signal to IC and from IC to power (plus a few for power+ and signal+) only 24 wires to solder. Easier to layout too.

Once I had the board ready, I started making sure that the arduino code was up to scratch to drive the three independent steppers. First test was just to pump the same signal to all three, which found a couple of loose connections quickly fixed, and a major issue with forgetting to drill out the tracks between the signal in and power out. I'm glad nothing exploded, but I guess the signal never got anywhere because the stepper was sinking the signal line so it never reached the h-bridge's threshold. Better luck than judgement though.

The first thing I noticed was that the new machine was an order of magnitude more accurate. I made some test scripts with circles as I'd found that normally circles are really hard to do well if your machine is not set up right. There are two reasons for this, a circle relies on very small changes in velocity, and especially around the axes, there is a good chance of any backlash effect being amplified by the very slow motion of the non-dominant motive axis. Also, any code that has to deal with speed control is going to deal with a very small small and a max speed at the same time, stretching the driver's accuracy to the limit.

The new machine does have backlash, about 0.25mm, so I coded up some backlash compensation into my arduino. Basically, this just runs the steppers at full speed in the direction of the motion until it takes up the slack if it detects that there would be any slack to take up before continuing with the real command to move the axes. This seems to work quite well, and you can see it in the video as the sudden spin when an axis slows right down and has to take up the slack before heading slowly in the other direction.

I had a bit of trouble getting the arduino to reliably call back once it had finished working. Sometimes the arduino doesn't call home to say it's finished, and that leaves the script dangling, waiting to issue the next command. I know it's not the arduino stalling as the keyboard exception in my python script (hit Ctrl-C to break the sequence) makes the arduino force the axes to head home if anything goes wrong. So, I made the script have a timeout on waiting for the callback. Now, when it's left hanging, it asks the arduino directly if it has actually finished or just forgot to say so.

Without the software backlash compensation, the circles where terrible, but with it, you can hardly see that there is any backlash at all.

With these software changes, the machine is now mostly working. The next hardware stage is to mount the dremel on the z axis and try cutting rather than drawing. But I think some more software updates first: I think I should try to add some text capability or the ability to import svg paths. Either would be great for any simple 2D engraving, but I think possibly essential for when I get to the next stage of machine rebuilding. The bit where I make the machine make the parts for the 5-axis variant.

So, just to show how noisy it is and also to show the whole setup, live and drawing, including the backlash compensation in full effect, here is a video of the machine... I have yet to name it... drawing some more calibration and test stuff.



1 comment:

  1. Very good post, thanks. I learn a lot from this post, hope for more posts like this one. Best regards !Used CNC Router

    ReplyDelete