News

Moving your CNC with Bresenham’s algorithm

Programming stepper motors to move together correctly for CNC machining can be a challenge and I’m here to help. To move one motor on it’s own is easy enough. Moving several is not too hard, either. What if all those motors are supposed to move in concert and finish their moves at the same time, perfectly, every time? The solution is today’s topic.

A single stepper motor isn’t too hard. Most stepper motors are driven through a dual H-bridge stepper adapter like the A4988, the TMC2130, or the classic L293D. You, the programmer, set the enable pin (turn on the motor), the direction pin, and then flip the step pin high and low for the desired number of steps. Easy enough…

When it’s time to move two motors, I can (of course) move each the full distance.

I could use an Adafruit Stepper Motor Shield, set the target steps and position, and then say “go”. It will move them both one step at a time. One of the motors will be done first. This is sometimes called the hockey stick.

But what we want is both to arrive at the same time.

Notice that I’m using line drawings to describe these movements. The solution to moving these motors is the same one used to draw lines on a screen – Brenseham’s line algorithm.

Now that I’ve described what the issue is and the name of the solution, Here’s the wikipedia entry on Brenseham’s line algorithm. It has pseudo-code and lots more examples to help you out. If that’s not enough, post to our forums with your questions!

One final note: an especially nice feature of Brenseham’s line algorithm is that it does all the math with whole numbers only, which are much faster to calculate in a microchip AND won’t have any rounding errors that can happen in said microchips. So perfect results every time.

Brenseham’s line algorithm is used in Makelangelo-firmware, Marlin, and probably several other CNC firmwares.

Robot Arm

A Sixi Robot cycloid gearbox eccentric cam shaft

An eccentric cam shaft is at the heart of our cycloid gearbox. Any force acting on the gearbox is focused at this point. So it makes sense that a good gearbox has a super strong cam shaft. This design is made to connect on a motor with a 1/4in diameter shaft, which happens to be the same as the NEMA23 motor in the elbow of the Sixi Robot.

Want to practice your CAD skills? Try making a 3D model of this part, yourself. Tag us on social media if you do!

Here it is inside the gearbox.

Makelangelo

Testing the Bleeding Edge of the Makelangelo App

As I and other devs write new features into the Makelangelo App, we push our shared code to Github where it is automatically compiled, tested, and packaged in Nightly Builds. These nightly builds have unconfirmed bug fixes, delicate new features, and that new code smell. This is so we can get and implement your feedback as quickly as possible. We recommend you try the nightly build before reporting a bug to our issues list.

The builds aren’t actually nightly – they happen any time a new copy of the code is pushed to Github. This way we have the tightest turnaround and best acceleration in class.

There are never more than 3 nightly builds. You’ll probably want to unpack this on top of an existing copy of the latest official release because the fix file will replace the one in your install.

Big shout out to https://github.com/WebFreak001/deploy-nightly/ and IRC#github for their help making this work. You rock!