Aberysytwyth population is mostly mad people, students, teachers, and madder people. Which is why it is the best place on earth. It just happens to be by the sea, on a reasonable sized hill. That just adds. But what's really great is the people.
Nice sky over Mach tonight, I just wish I had a camera good enough to capture
A mere camera cannot capture the sky! For such a task you require
as seen on Professor Von Helium's Dirigible of Doom (TM), when he held the
entirety of the Earth's airspace for ransom in 1878. Remember?
After what seems a very long time, I now have to get to work writing more software.
I fixed an RC aeroplane brushless motor to the CNC, and Dremelled the shaft into a cutting bit.
I feel a bit naughty doing it, but now I can get started on the final stage of the development. All steam ahead to better software and firmware.
Okay, firmware done, now to tackle the path command stuff. I really want to build a simple UI for the setup stage. So it's easier to move the cutting head around, and get it ready to run its pattern... luckily I've been doing a bit of Tkinter work that should do the trick.
CNC project has stalled due to no money to buy bits. I need some parts to make the drill. The dremel is too noisy and I want to be able to turn the drill on and off via the arduino, so I'm going with good quality DC motors and trying to figure out how to mount the milling bits onto them.
In the mean time, I've been working on a new book and a new computer language. The book is about how to program giving practical examples of how to develop using the data-oriented programming paradigm. The idea is that that book will help people get a good grasp of how to do it by example, and will read and understand the sections on why OO code tends to be a lot slower and harder to debug.
The language is an incarnation of this premise too. It strips away most of the language features that allow object oriented programming and restricts the programmer into coding ready for parallelism and GPU acceleration (FPGA is planned too).
If I wasn't working on those, I would be writing simulation software for the CNC using polyvox so I could test out all the cuts ahead of time. But seeing as I don't really know for sure what is happening there until I fix the cutting head, I have let it stay patient while I get on with other things.
Since the backlash compensation went in I've had a lot of toothach. I'm not blaming the machine, no, I'm blaming the dentist. The toothache stopped me from doing what I wanted with the project as I've been trying to code the necessary file convertor to drive the machine via an SVG. Reading an SVG in, then recognising the parts of the path element, then figuring out the best way to handle the relative vs absolute coordinate stuff mid-stream (that struck me as quite odd), would normally be all in a day's work for me, but with my head being addled from the pain I only managed to get it completed on Friday night.
With said new code in place, I managed to get the machine to draw (pretty accurately) direct from a file.
So, new code in hand I decided it was time to do some real cutting. I added a mount for the dremel, added a clamp to the bed, clamped in some
of the left over perspex from the build, and attempted my first CNC engraving job.
First attempt wasn't too bad, there is quite a bit
of slop as the engraving head was dragged quite quickly across the work so there are some diagonals on the word, but it was nice to see it actually cutting. I've now added a tooling movement rate to the script so it moves slower when it thinks it's cutting.
I tested some aluminium next, but the engraving head was useless at cutting it. This just kept aggravating me until I noticed I did have a milling
bit, a small, ball headed milling bit. So, first thing I did was set up the same run again, but when I did I found the dremel wanted to dive into the work. I didn't understand until
after I'd had to emergency stop the whole operation as
the dremel almost went through the 1.5mm aluminium when it picked up and put down again. It turns out that the battery pack I'd been using to power the steppers had finally got to the point where it could no longer power the Z axis stepper well enough to enable it to lift the heavy dremel out of the work. Of course, these are steppers, so they don't know they have failed, so when it was told to head back down into the work, it duly complied and dug down even further.
I wonder how difficult it would be to add an encoder to each of the axes just to see if I can catch this kind of error quicker. Anyway, for now, I'm just going to wait until I can afford to buy a barrel socket and plug it into an AC adaptor, and also, because of how noisy it is, I'm going to try to find an alternative to the dremel. I have a couple of 24V motors out of a printer which, when tested merely with their already attached drive gears, can cut aluminium. How to add a chuck to these, that's another question.
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.
Got a bit of time at the weekend, so managed to finish of the Z axis on the new metal machine.
I've changed the stepper connections to tubing, X and Z are using some tough plastic fuel line from the RC cars I had, and the Y axis is using some softer stuff (also fuel line, but probably not aged into being hard).
I've got to add the mount for the Dremel (I had anticipated the weight, so I've beefed up the strength of the gantry), put the H-bridges on a PCB so I can control the steppers from my arduino, then write the control software. That should keep me busy for the rest of the week.