So last time I wrote about my awesome new spindle. It is a serious piece of equipment and the rest of my machine now seems somewhat inadequate to deserve such a beauty of precision engineering. One way in which the rest of my machine fell short was in its ability to cope with the Electro-Magnetic interference being thrown out by the variable frequency spindle. I noted last time that I had ordered some capacitors to try to resolve the issue.
So what have I learned about EM interference? Well, essentially every wire you run could pick up voltage blips from EMI. If these wires connect to digital signal lines, such as step and direction inputs to stepper drivers, then this gets picked up as random motion. If those wires are connected to ground on your arduino... well that can cause it to crash. So... what do capacitors do to help?
I should pre-fix this by saying I have only what I would consider to be a pragmatic understanding of electronics, and I could be mistaken in my understanding, however I have now fixed my problem so if nothing else there is that.
So the mental model I find most helpful is that an electronic circuit is a little like a closed system of water. In this model EMI basically causes ripples in the water that can be mistaken for the water flowing. A capacitor then is a little reservoir. they come in various sizes depending on how big of a reservoir you want. but even a very small one is enough to absorb a ripple without it making it to the outlet of the reservoir. Where a real signal is a more serious movement of the water, which easily fills and pushes through the reservoir. So capacitors act as filters for this 'high frequency' low but low power type ripple. They also act to 'smooth' power supply. essentially in our model the water in the system flows a little erratically around our desired rate, sometimes a littel fast, sometimes a little slow. for components that require a certain amount of flow in order to work, having a little local reservoir near their power input means that when the flow is a little fast the reservoir fills, and when it is slow the reservoir is depleted, but the component can keep drawing at a consistent rate so it looks like a nice smooth flow. Obviously depending on the peaks/troughs of flow, you may require a larger reservoir to have sufficient capacity to smooth out a larger variance.
Now with that model in mind. basically I put small 0.01uF capacitors between the step lines and ground, and also between the direction lines and ground. I then put slightly larger 0.1uF capacitors between the v+ and gnd of the stepper drivers. And lastly I put a big 10uF 25v capacitor between the v+ and gnd of the main 24v supply for all the steppers. In operation it is likely that there will be peaks of power usage across the stepper drivers, and the extra capacitor provides a chance to provide in these high use spikes without the power dropping lower than it should.
In addition to all these capacitors, I also had a problem with spikes on the ground line to the arduinio causing it to crash. I wasn't really sure how to solve this because I didn't really know where I would introduce a capacitor. The issue here is that the arduino needs to share a common ground with the stepper drivers in order that the signals be correctly detected. However there is really 2 quite different voltage circuits here. the arduino and its signals are on 5V, but the rest of the circuit is 24v for the motors, from a different supply. The ideal thing here I have discovered would actually be to properly isolate these two circuits.
How? there is a component called an opto-isolator. essentially this is an led in a package with a light sensor. the led is powered by one circuit, and the sensor is powered by the other. basically the two isolated circuits are able to signal each other via light, and keep their electrical systems independent. This is an obvious next step for me, as this would allow a more robust setup and might pave the way for future enhancements with even higher voltage motors. However those haven't arrived yet. Thankfully there was one more change I made that fixed the last of my issues.
It turns out there is a reason that computers come in metal cases, and those cases are earthed. This is what can also be described as a Faraday cage. These are used to essentially give any EM a path to ground. When I originally set up my electronics I stuck it in an old cat food box. It just happened to be about the right size for my circuit board, and at the time I was only thinking of keeping components together and a little protected from dust.
But cardboard boxes do not screen EM. So I bought myself a cheap PC case, which even included a power supply and a fan. This was a bargain, I was able o use the pc supply to power fans in the case, and also cooling fans on the stepper motors. Whilst also neatly housing the electronics and running the cables neatly. It looks pretty good and the best part is that this seems to have completely eliminated the problems I had been having with interference in my circuit. yay!
One last note of improvements. nothing to do with interference but certainly an issue I was having was the steppers getting hot. at 24v they were getting too hot to touch, and given two of them are mounted using 3d printed parts, they were getting hot enough to warp the plastic. So I bought 2 AMD cpu heatsinks with integrated fans. These things were fairly cheap, and they are super effective. I've really only lashed them in place, literally using string and gaffer tape to hold them in position. But even after hours of operation those steppers are still cool to the touch. I only did this on the Y and Z axis. the X axis has 2 steppers and they both seem to run cooler anyway, well around 50C, I balance a long steel ruler on each to act as a bit of a heat sink and that seems to be sufficient to keep them from getting alarmingly hot.
So, do I now have a perfect machine?
Not yet...I still ahven't managed to make a complex 3d carved object successfully. I got very close this week with a raspberry pi case that I was milling. But I've been plagued by human error in various forms. First attempt I messed up the model and the setup of wood. this meant the milling process first wiped out a wall of the box that it should not have, then it cut all the way through the stock when it was supposed to leave some material to hold things in place. Then in my second attempt after about 4 hours of machining the bit slipped in the collets grip, causing it to cut far to deep and pull off course into the piece and ruining it. Frustration abounds, but I am trying to learn from these mistakes. I feel like I am close to making a really nice precision part. I just need the time!
Today - I am going to upgrade GRBL to the development branch to see if I notice any improvements in speed, and I'm going to push the speed of the machine higher. This is a real tradeoff, the faster I push it the more forces at work, and the higher the chance of a failure. However too slow and everything takes far too long, and I consume days and days of time, and still risk a failure screwing up. So I will at least try to go faster, but also to try machining parts one at a time, to reduce risk of failing half way through a pass on multiple bits. Wish me luck!