Category Archives: software

Does it make sense to develop another Hardware control for CNC and 3D Printing? There is the great GRBL for Arduino, the TinyG software and hardware. Especially for 3D Printing you got the famous RAMPS board with the Marlin or Teacup firmware and many others. Recently more powerful solutions like the Smoothieboard emerged. So what is the point in adding just another hardware and firmware platform?

The birth of T-Bone

For several reason we know Trinamic products very well. And we love CNC machines. I’m tinkering around with a Reprap Mendel and Jonas just bought a ShapeOko2 CNC mill. Just at this point he got the idea to create a controller board with Trinamic chips and we were immediately stoked.
We got the chance to evaluate a brand new chip. Even though still in beta stadium, this motion controller was a perfect match for a CNC machine: It can execute motion commands stand-alone. Set the target for the axis and the controller does the rest. It is able to use constant jerk acceleration profiles. This means it is not only capable of accelerating and decelerating properly. It can even control the acceleration force on the moved object (e.g. extruder). The force slowly increases during acceleration up to an allowed maximum. This gives much more controlled motion profiles and less stress on the mechanical structure. The motion controller can even handle end stop switches or running closed-loop with encoder feedback!

After some beers everything fell very fast into place:

Motion is much easier with motion controllers

We can use high level languages for much easier ‘machine programming’

We can develop the CNC driver board ourselves!

So why not just start and see how far we can get?

The idea of the T-Bone

So how do we combine those motion controllers with some software to get a real different CNC controller?
First of all we want to program the CNC machine (e.g. our RepRap 3D Printer) in a high level language since they are more easy to use. Straight forward thinking was to take a BeagleBone Black and programming it in Python?
The motion controllers are capable of coordinating position, speed, acceleration and deceleration of the stepper motors. Just everything to realize single movement segments. The high level control just needs to calculate various segments and send them serially to the motion controllers.

To feed the motion controllers with the segments requires simultaneous serial real-time communication. We have to send a segment as soon as the previous segment is finished. Using a Linux based system for this is really hard. Of course there is the Programmable Real-time Unit (PRU) in the Beagle Bone – but then again the PRU has to be programmed in assembler. Fortunately there is a really simple to use, real time capable MCU: The Arduino. It can buffer several segments and feed new data in the motion controllers when they finish a segment.

The overall architecture is quite simple:

The CNC control is a Python program in the BeagleBone. It reads G-Code, creates tool paths from it, has a nice web interface and is easy to adapt. The G-Code is split in paths and those paths are planned. Those paths re split into segments and those segments are sent to the Arduino. The python program knows which motion controllers belong to which axis and how to coordinate a motion with several axis.

The Arduino (for prototyping we used an Arduino Leonardo – hence we included an Arduino Leonardo compatible MCU on the T-Bone) gets those segments and sends them to the motion controller. It knows when a motion controller finished a movement and needs new segment data. The only job of the microcontroller is to read segments, buffer them and send them at the appropriate time to the motion controller. No complex logic or hardcore assembler. No matter if the T-Bone controls a CNC mill or a 3D printer. The Arduino program can be almost the same.

The Motion controller move the stepper motors. Nothing more, nothing less. It knows the speed of the motor, the maximum speed, the acceleration profile and generates driving signals for the stepper motor. It can notify the microcontroller when the stepper motor reaches its target position and can directly execute the next movement.

Realizing the T-Bone

After we got the basic architecture we could start to design the final board and software. We literally started prototyping everything on bread board. After some iteration in hard and software we finally could design the first real boards (of course only genuine with fix wires).