Motion Control for the Masses: The TinyG Story

CNC & Machining
Motion Control for the Masses: The TinyG Story

IMG_3045

What is TinyG?

TinyG is an open source hardware project that I co-created to make industrial-grade motion control affordable and accessible to casual users while still powerful enough for professionals. It’s a personal project that became a public labor of love. We formed Synthetos when members of our local hackerspace (HacDC) asked us to make the hardware available so they could to drive their own motion control projects.

The TinyG board is a complete embedded multi-axis motion control system on a 4-inch circuit board. It’s been used in CNC milling machines, 3D printers, pick and place machines, small industrial production lines, art projects, and other applications that require precise, fast motion control. With it, your CNC or 3D printer can print faster, more precisely, and much more quietly than the alternatives. Some of the features are:

    • G-code motion control commands run directly on the board
    • 4 stepper motors up to 2.5 amps each
    • 6-axis control — controls XYZ linear axes + ABC rotary axes
  • Controlled jerk acceleration (I’ll explain that later on) planning for very fast and precise movement
  • Talks JSON (JavaScript Object Notation) so the board can be controlled using the same technologies that the web is based on

A full list of features is available from the Synthetos Site.

IN THE MAKER SHED:

ShedTinyG is available from the Maker Shed

What’s on the board?

Not much, really. The CPU is an Atmel Xmega — a moderately powerful processor with 192K of flash running at 32 MHz. This is six times more flash than the processor (the ATmega328P) on the Arduino Uno, and twice the processor speed of the Arduino Uno or Mega boards. We use the extra space and power to make TinyG do what it does. TinyG The stepper drivers are the incredibly reliable Texas Instruments DRV8818 chips. The drivers will handle up to 2.5 amps per winding, so this handles all NEMA17 motors (commonally used in desktop 3D printers and mills) we have seen, and most NEMA23 motors — which are about as big as your fist.

There’s also an FTDI USB chip (so you can plug it into a computer) and a 3.3 volt switching power supply for powering the logic. The rest is just LEDs, current setting potentiometers, and connectors. The majority of the effort went into the firmware, which is available open source on the Synthetos Github site. That’s what’s taken more than four years — and of course we continue to add features and improve the code. There is also a TinyG firmware port that runs on the Arduino Due ARM processor, and we are in the process of releasing TinyG version 9 which uses an ARM processor. The Due version runs nicely with a 3 axis stepper shield we made called gShield.

Who made it and why?

TinyG has been under continuous development by Riley Porter and myself since early 2010. Rob Giseburt joined the project in 2012, and there have been many contributors who have also added to the code base. TinyG began as an Xmega branch of the grbl motion control software, which was also in a very early stage of development at that time. TinyG was originally conceived as a way to control a large number of stepper motors very accurately but inexpensively. The original design was intended to control a large calliope that would have taken upwards of 100 motors, depending on how many instruments were added. People in the local hackerspace (HacDC) got word of the project and started asking for boards to drive small DIY CNC machines and other projects. Then more people found out about it. So we went down the path of writing the firmware for those uses. The calliope has yet to be built.

How is it different from what came before?

We think the main difference between TinyG and other controllers is the attention paid to motion control itself, as opposed to being an application-specific board for 3D printing or some other application.

Party Like It’s 1969

One big difference is a commitment to creating a relatively full G-code interpreter. G-code is a ’60s vintage ASCII command language that’s still the dominant way to drive industrial CNC machines. Parts of G-code have been adopted by the 3D printing community, but we wanted to implement the rich functionality that the language supports.

All that Crazy Physics and Math

One big part of G-code is support for 6 axes of motion control. This means implementing the rotary axes in addition to the XYZ linear axes. The A, B and C rotary axes are the rotations around X, Y and Z — kind of like pitch, roll and yaw in an airplane.

The Jerk

Another big difference is acceleration management that directly controls the jerk (no, not the Steve Martin movie from 1979). For the mathematically inclined, the jerk is the third derivative of position, or the rate of change of acceleration. More physically, jerk is a measure of how much impact a machine can take.

Jerk is like hitting the machine with a hammer, and it causes all kinds of bad side-effects. Jerk excites resonances that cause shaking, chattering, skipping, and in extreme cases, loss of position. Controlling the jerk means that the acceleration looks like a smooth S curve, not a bunch of straight lines (trapezoids) stuck together.

In practice this means the machine can accelerate and decelerate faster and generally run smoother. No other controller in our range does this. This all took a lot of time, but we went for quality and worked the physics and the math. We used Wolfram Alpha for months to reduce some huge equations. It took 6 months or more to get acceleration working how we wanted it. A trained pro could have done it in weeks, maybe days, but it was our time to discover and learn it.

CNC in the Browser

tgFX
CNC in the Browser: tgFX rendering TinyG output

Another big difference is the way we talk to the board. We treat the board as a web peripheral. This means that the board talks REST and JSON (JavaScript Object Notation) and behaves like a web page instead of a piece of custom hardware. We want as many people as possible to be able to use TinyG, so it needs to be easy to talk to. For every person that’s comfortable writing a fiddly bit-level protocol there are hundreds of web savvy folks that are already familiar with JSON — in JavaScript, NODE.js, Python, Java, Ruby — whatever. So we implemented JSON at the chip-level, talking over a serial port instead of HTTP and TCP/IP. This is enabling a whole lot of applications that simply would not have been built before because the learning curve was too steep.

What can I use it for?

TinyG is great for just picking up and making something move smoothly because so much of the work has already been done. We get comments from people that they just “skipped over” the motion part of their project, or “it replaced a table full of electronics.”

There are a number of projects that have embedded TinyG as their motion control component:

shapeoko2
Shapeoko 2

Shapeoko is an affordable 3-axis cutting machine. Many Shapeoko builds use TinyG and the Shapeoko project has been a long-time supporter of TinyG.

othermill
Othermill

The Othermill is a portable, computer controlled 3-axis mill designed for use at home or in a small workspace. It’s compact and quiet enough for home use, yet precise enough for detailed electrical and mechanical prototyping work. Othermill launched with a very successful Kickstarter earlier this year.

pocketNC
Pocket NC

Pocket NC makes a 5-axis desktop-sized CNC mill, the P5. The P5 is designed to machine metals or plastics and has a work area of 5 inches in diameter by 4 inches tall. And it’s green.

The DIWire is a desktop CNC metal wire and tube bender. If 3D printers print volumes; this machine “prints” lines of any length. It can be used for anything from steel trusses, hydraulic tubing, large frameworks for giant puppets, delicate jewelry, marble runs, even braces.

DIWIRE

Mythos/Logos is a 4-foot-tall kinetic sculpture made of nested, semi-circular arms that rotate in relation to one another. The inner arm has a computer controlled camera mount. When in motion, the device can position its camera at almost any point on the surface of an imaginary sphere. Even though the sculpture is constantly in motion the camera lens is always pointed at the center of the sphere.

mythos
Mythos/Logos

OpenPnP is a project to create an open-source, surface-mount pick and place machine. The project has produced several prototype hardware designs and work is ongoing to have a Kickstarter later this year.

tempo
Tempo Automation

Firepick is an open-source pick and place machine designed around OpenPnP and TinyG. Tempo Automation is developing a desktop pick and place machine based on TinyG. Tempo’s goal is to help folks quickly iterate through surface mount electronics designs. The Solar Pocket Factory is a small, low-cost machine that makes solar panels, with the goal of making solar accessible anywhere in the world. In its guts, a TinyG controls the motors that place silicon and move panels down its assembly line.

What’s next for the TinyG team?

While TinyG has been focused on motion control and CNC, lately we have been adding capabilities for 3D printing, laser cutting and general expandability for other types of projects. We have developed an expansion bus called Kinen to enable these projects. We are also using Kinen to offer higher power controllers and to enable the “last 10 percent” that many projects need. We continue to work on RESTful communication using JSON. Our goal is supporting Hardware Mashups where web developers can combine multiple, independent devices as easily as they can lay out a web page.

tinyG_beauty

Alden Hart is CTO of Ten Mile Square Technologies, a technology consulting firm that develops systems for media and communications, from the metadata to the metal. In his spare time he co-runs Syntheos and combines micro-controllers, LEDs, mechanics, and other small parts in ways that have no practical application.

1 thought on “Motion Control for the Masses: The TinyG Story

  1. Hermes Bracelet says:

    Attach a closet pole and half brackets after the manufacturer’s guidance for installing.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged
Alden Hart

Alden Hart is CTO of Ten Mile Square Technologies, a technology consulting firm that develops systems for media and communications, from the metadata to the metal. In his spare time he co-runs Syntheos and combines micro-controllers, LEDs, mechanics, and other small parts in ways that have no practical application.

View more articles by Alden Hart

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK