Jul 29

Using Raspberry Pi to Control a TinyG ShapeOko

When I put together my ShapeOko CNC I decided to use a TinyG as the controller. It’s a great board with a lot of support behind it, however the TinyG is strictly a controller for the mill’s motion. The G-Code commands need to be read in though a serial connection and it only has a buffer of 255 characters which means it requires that a computer be connected to send the commands. Instead of leaving my laptop with the ShapeOko I decided to use a Raspberry Pi for this purpose. Most of the documentation around the TinyG is based on Windows or Mac; there is not much info on using it with Linux. This is currently the way I’m using the Raspberry Pi to control the TinyG.

Finding the Serial Port

The first thing you need to do is find which serial port the TinyG is on. The easiest way to find it is by running the command:

dmesg|grep FTDI

It will respond with something similar to this:
I’ve highlighted the line you should look for. Unless you have another USB to serial device connected (like an Arduino) yours should also show up as “/dev/ttyUSB0″. In the following examples the assumption is that this is the address for the TinyG. If yours is different then you may need to change the commands below.

Putty and Plink

The commonly recommended program to communicate with the TinyG is a freeware (not open source) program called CoolTerm. It does have a Linux version however it is compiled for x86 processors so it will not run on a Raspberry Pi’s ARM CPU. An alternative program that can do the job and will be familiar to at least a few IT people is Putty. It is a free, open source terminal emulator and serial console for Windows and Linux. Putty is a GUI based program and it can be used, however I find it easier to use the command line version: Plink.

One of the benefits of using Putty is that it supports XON/XOFF flow control protocol. As I’ve mentioned, the TinyG can only buffer up to 255 characters before erratic behavior, missed lines and other trouble start cropping up. TinyG utilizes XON/XOFF to tell the sending computer to stop sending commands when its buffer is almost full and continues when it gets below a certain level.

Install Putty and Putty Tools

Putty is available in the Debian based software repositories (this includes Raspbian and Ubuntu). You can install Putty and Plink on a Raspberry Pi with this command:

sudo apt-get install putty putty-tools

Open the Serial Console

To connect directly to the TinyG using the command line version use this command:

plink -serial /dev/ttyUSB0 -sercfg 115200,8,n,1,X

This will open an interactive serial console that can send and receive commands. From here you can fully interact with the TinyG.

Stream G-code Files

The next step once you’ve configured all your settings and run some simple commands is to be able to send a whole file of G-code to the ShapeOko. You can do this by piping the file to plink like this:

cat project.nc | plink -serial /dev/ttyUSB0 -sercfg 115200,8,n,1,X

In this example the file “project.nc” would contain a series of G-code commands and plink would send those to the TinyG.

Exiting Plink

The shortcut to exit plink is CTRL+C. You can also use CTRL+Z but this simply suspends the program instead of closing it (Explanation of the difference between CTRL-C and CTRL-Z in Linux CLI).

Next Steps

The method above will give you the basic ability to directly communicate with the TinyG or stream of G-code into the TinyG, however it doesn’t give you a visual interface and you still need to find a way to get the G-code files to the Raspberry Pi. I started writing a web interface based on PHP and have spoken with Alden from Syntheos who invited me to help with their NodeJS based web interface, hopefully I will have more on this in the near future.

Jun 03

Using the GY80 10DOF module with Arduino

I recently purchased a 10 Degrees of Freedom (10DOF) sensor from eBay called a GY-80. It’s a compact module that includes a gyroscope, accelerometer, digital compass, and a barometric pressure / temperature sensor.

GY80 Top Labeled

All of the individual sensors are accessible over I2C so you only need 4 connections to access all those sensors. SDA, SCL, Ground and VCC (you can use 3.3v or 5v).

GY80 Bottom Labeled

Each component can be accessed individually. I was planning on doing a write-up on each one, but it looks like Bildr beat me to the punch as they already have a great tutorial for each component. Here are the links to the datasheets and tutorials for each component:


3 axis gyroscope from ST
L3G4200D Datasheet
Bildr Tutorial: http://bildr.org/2011/06/l3g4200d-arduino/


3 axis accelerometer from Analog Devices
ADXL345 Datasheet
Bildr Tutorial: http://bildr.org/2011/03/adxl345-arduino/


3 axis digital compass from Honeywell
HMC5883L Datasheet
Bildr Tutorial: http://bildr.org/2012/02/hmc5883l_arduino/


Barometric Pressure and Temperature Sensor from Bosch
BMP085 Datasheet
Bildr Tutorial: http://bildr.org/2011/06/bmp085-arduino/

Next steps

This module can be used individually as the articles above show but they can also be monitored at the same time. MultiWii is an open source software project that is used as the brain of multi-copter projects. The code runs on Arduino and it is compatible with a large variety of sensors (the GY80 being one of them). It does require a little tinkering to get it working properly. I’ll document the process in a future article. Also since this module works over I2C it can also be accessed using a Raspberry Pi.

Apr 21

Dissolve a Tap Broken in MakerSlide

About 10 minutes into my Shapeoko I hit my first snag. One of the steps in assembling the Shapeoko is to tap the maker slide in order to create threads where a screw can be put into. While tapping my first piece of MakerSlide I snapped the tap off inside the MakerSlide with almost nothing sticking out the end. I tried using pliers to get it out but the piece was lodged in there pretty good and I could not remove it. I did some research online and found I was not the first to have this problem. I found several people talking about dissolving the tap while leaving the aluminum intact. Thankfully it worked and I’m back on track. Here is how I did it.


  • Aluminum, glass or Pyrex container
  • Hotplate
  • Alum (I used aluminum sulfate from a local pool supply store)
  • Wooden or plastic stirrer
  • straw or pipet

How It’s Done

  1. Boil water and put it in your container (enough to cover the tap in the MakerSlide)
  2. Put your container on the hotplate and turn it on (I used an old coffee maker)
  3. Add alum to the water and stir in until no more will dissolve
  4. Put the end of the MakerSlide with the tap into the alum solution
  5. Use the straw or pipet to drop some alum solution into the top of the hole the tap is in (this helps to dissolve the tap from both ends)
  6. At this point you should start to see little bubbles coming off of the tap
  7. It took about 8 hours for the tap to dissolve enough that it practically fell out.
  8. The end of the MakerSlide that was in the alum solution will be a little discolored. Just wipe it with some WD40 to remove the white residue

How to Prevent This from Happening to You

I made 2 major mistakes: I didn’t use lubrication and I was too aggressive with the tap. Please learn from my mistakes. Many people online recommend cutting oil but once I got a new tap I ended up using WD40 and it worked great. You should also turn the tap slowly. If you feel any resistance back off on the tap a quarter or half turn and try again.

Apr 15

My Shapeoko Build

In my last post I wrote about creating a BlinkM module on a breadboardshapeoko and wanted to create a more finished project based on that design. I looked into etching a PCB and after much research decided to use the magazine laser toner transfer process followed by the Hydrochloric Acid (H2O2/HCl) etchant. I bought all the supplies and had nothing but trouble with it. Then I remembered a Hack-a-Day post from last year with a video of a CNC milling a PCB. This seemed like such a cool solution to my problem and also opens the door to more projects so I started to research CNCs.

I quickly found that many of the CNCs out there are pricey, require specialized software and are not upgradable or configurable. Then I found Shapeoko; it started as a kickstarter project back in July of 2011 to create an open source, affordable, CNC with a standard design. I have to say the original design out of wood wasn’t that exciting but what it’s turned into is simply amazing. In its current state it utilizes MakerSlides (another Kickstarter project), standard NEMA 17 stepper motors and is entirely open source. It is available for purchase from Inventables in several kit forms.

While researching my purchase I came across this How to build a CNC for $500 post on Reddit that was well researched, had lots of good tips and basically became the blueprint for my order.  In my research I also found that if you would like to mill PCBs, the stability and accuracy of a Dual Drive Upgrade Kit was required so I purchased that as well. Here is my BOM for the project (please note that I’m reusing a Dremel for my spindle but there are many affordable options out there):

Four Steppers from Sparkfun67.811.6279.42
Shapeoko Mechanical Kit22525.14298.99
Shapeoko Dual Drive Kit (w/o stepper and cable)39.85
FR1 PCB Blank9
Power Supply from Amazon23.353.9827.33
EndMill for PCB3.9903.99
General EndMills352.9537.95
Tap 5mm-0.84.99
Metric Allen Wrench Set6.3506.35

Another big selling point for Shapeoko is the community that has built up around it. They have an active forum and a detailed wiki. Many makers have brought their own ideas for improvements and expansions to Shapeoko and these upgrades are well-documented on the wiki showing parts needed and assembly instructions. Some of the more exiting upgrades and modifications are to replace the spindle with a laser cutter or a 3d printer extruder.

My parts just started coming in this week so expect to see more articles around this topic and hopefully a few freshly milled PCBs.