Archive for the '3D Printing' Category

Yet Another Way to do the Kinematics


Paul Kaplan, originator of the Easel project, came up with another way to do the kinematics for the Line-us Clone. My method used intersecting circles. His method uses the Law of Cosines.

The Law of Cosines relates the lengths of the sides of a triangle to the cosine of one of its angles.




This can be used to find the angles of the servo arms.

(Click on the images if you want a larger view)

The Goal


The goal is to find the two angles, A1 and A2, of the servo arms

Known Values

  • Px is the desired X location of the pen
  • Py is the desired Y location of the pen
  • L1 is the length of the upper servo arm (50mm)
  • L2 is the length of the end of the Pen Arm (50mm)

Step 1

Find the distance “D” of the pen to hub using the Pythagorean Theroem and the angle T1 using arctangent.

Px2 + Py2 = D2

rewritten … D = Sqrt(Px2 + Py2)



T1 can be found using the arctangent or inverse tangent formula. Note: When programming use the atan2(x,y) function to preserve the quadtrant.

T1 = atan2(Py,Px)

Step 2



Find T2 using the Law of Cosines

L12 + D2 – L22 = 2 * L1 * D *cos(T2)

rewritten …  T2 = acos( (L12 + D2 – L22) / (2 * L1 * D))

Step 3



Find T3 using the Law of Cosines. We want the left one of the two T3 angles, but since the linkages form a parallelogram that same angle shows occurs in several places.  We will use the right one and the dimensions associated with it.

L12 + L22 – D2 = 2 * L1 * L3 * cos(T3)

rewritten … T3 = acos( (L12 + L22 – D2) / (2 * L1 * L2))

Step 4



Determine A1 and A2 from the angles we figured out.

A1 = T1 + T2

A2 = A1 + T3


I think I will switch the code to use this method. I think I can optimize it better in C code. The speed of the code is important.  The faster it runs, the most times per second we can run it.  The more often we run it, the smoother it will run.


Line-us Clone Controlled by Easel and Grbl

Last week I made a Line-us drawing robot clone.  Unfortunately I had no good way to make it draw easily.  I thought I would give the CNC toolpath a shot.  My goal is to have a super portable thing to generate conversation at meetups. If I used Easel it would allow anyone with a web connection to easily make something.



Grbl Logo 250px

The most compact machine controller is Grbl and I have a lot of experience with it.  Grbl is designed to send step and direction signals to stepper motors.  The draw ‘bot uses hobby servos.  The nice thing about hobby servos is they don’t need to be homed.  They have feedback to tell them where they are. They also don’t care about speed, acceleration or steps/mm.  They just go wherever you tell them as fast as they can go. It occurred to me, the easiest way to hack this into Grbl was to not modify the Grbl code at all.  I would let Grbl think it is using stepper motors.  I would just add some extra code that runs on regular interval to tell the hobby servos where the stepper motors are in 3D space and they would be told to go there.  I played around with some intervals and 8 times per second (8Hz) seemed to work pretty well.  The ‘bot uses machine coordinates. The work coordinates are offset to the left because the ‘bot cannot draw at 0,0.  The pen would crash into the frame.


I recently port Grbl to PSoC. I used (3) 16bit PWM components to control the hobby servos.  See this blog post on how I did that.  I then attached a 8Hz clock signal to an interrupt.  The interrupt sets a flag when it is time to update the servos.  When the main code sees this flag it does the calculations and and sets the PWM values.  Keeping the code out of the interrupts gets Grbl happier.



Easel is already setup to use Grbl.  You can either import gcode or create a design right in Easel.  I started out with importing gcode because the Benchy design was not in a format I could import. I created a template that shows the allowable work area. This will allow anyone to quickly create a drawing.


2D Benchy

I wanted to have a little fun with the first print.  ”Hello World” was not good enough.  3D printers use benchmark prints, so I thought I would do a 2D version of the classic 3DBenchy.  To get a 2D drawing of 3DBenchy, I traced over an image with the line tool in CorelDRAW.  I then exported a DXF of that.


A Line-us Clone


I have been going to the monthly Amp Hour, Hardware Happy Hour meetup.  A lot of people bring something to show.  My projects are too big.  Also, you need to bring your own power.  The meetup standard seems to be running off a USB cord. I was brainstorming ideas, when I saw the Line-us project on Kickstarter. It looked like the perfect size and power. I also love the challenge of non linear kinematics.


I decided to make a clone of it.  I started by importing one if their drawings into CorelDRAW and scaling it up to 1:1.  I then added some measurements.  I rounded them up to 80mm for the pen arm and 30mm and 50mm for the linkages.


I looked into hobby servos and found that the “mini” size looked about right.  I ordered 4 of them from Amazon.  I made sure to get metal output shafts because I thought I might have to press them into the 3D printed arms.




I created a basic design in PTC CREO.  I added a lot of construction sketches for the linkages to help me with the kinematics later.  I downloaded a model of the servo from GrabCAD  to use while I waited the delivery.


I used 3mm bearings for all the joints.  These are pressed into the linkages.  This would allow me to firmly tighten the joints and not have to worry about slop in the joints.


When the servos arrived, there were slight differences in from the model.  The mounting holes we much smaller at about 2mm.  I had to reprint with some changes.

My concept was to press the arms onto the servo shafts.  This sort of worked, but after a few crashes, they loosened up.  I ended up using a drop of thick super glue to secure them.  They were able to stall the motor without slipping.  It is important to mount the arms at the precise angle.  I made an Arduino sketch to hold the servo in the precise position while attaching the arms at the angle I wanted.  Each servo has a 180° travel.  The upper arm travels from 135° to negative 45°.  The lower arm travels from 45° to 225°.


In order make the pen go where you want it to go, you have to figure out what angle to set the arms. This is not a simple linear equation. You have to solve a multi-step geometry problem for each new location. I’ll walk you through the basic process. I placed the axis of the two servos at XY 0,0 to simplify things. You know the desired Pen Tip location, so start working back towards the cranks.

  • Step1: Find the Pen A point. You know the lengths of the linkages between the 0,0 point and the pen tip. They are both 50mm. Each arm end has a set of points where it can exist that scribes a circle. If the desired pen point is within reach of the machine, the circles (green ones) will cross at two points. The solution is a well documented process. I used the C code from this page. So far, I found that using the location, of the two, with a higher Y value is the one to use.
  • Step 2: Find the Pen B point. Pen B is easy to find because you now know the slope of the Pen Arm. Multiply the X distance from the pen tip to the Pen A point by the ratio of the length of the pen arm (80mm) over the length of the arm from Pen Tip to Pen A (50mm) and add it to the pen tip. Do the same for the Y axis.
  • Step 3: Now that you know the Pen B location, you can do the intersecting circles (red ones) trick again. This time I used the left most point of the two.
  • Step 4: Find the angles. Use the X and Y distances of the crank tips and the atan function to get the angles. ( angle = atan(deltaY / deltaX) )

Another problem with non linear machines is that moving between two points will not be a straight line. The points will typically be connected with a slightly curved line. You need to constantly recalculate points along the way to keep it straight. If you break a line into smaller segments, the connecting curves also get smaller to the point where they are not notices.





Everything I chose was for prototyping ease and probably not the final solution. I used an Arduino UNO as the controller. I used a PCA9685 based servo motor controller for the servo. The Arduino could probably handle it on its own, but the wiring is so clean and simple with this. I used a breadboard power supply to power the servos. It had a handy switch to kill the power to the servos without killing the Arduino.




The Results

Here is a video of the machine running. The rectangle is hard coded via some for loops recalculating at 1mm increments. The results are shaky, but consistent with the Line-us results. The machine is quite rigid. Most of the shakiness comes from the servo motion. I also do not have the machine held down. If I get some magnets like Line-us, it might help.


Open Source (sorry)

I don’t think it is fair to the Line-us folks to release any files at this time. I think there are plenty of resources in this blog post if you want to clone it yourself. So far I only have about 5-6 hours into the project, so it is pretty a pretty easy project.

The real Line-us looks very polished and they are selling it at a good price. I am sure a lot of the work they did was on the UI, which I did not replicate at all.

Next Steps

I need a way to stream drawing data to the machine. I would like to use g-code. It also needs a UI and I thought Easel might be best. For the gcode I might try hacking Grbl. I would just add a timer that reads the current location at about 5hz, send it through the math and set the servos. Any value above Z 0 would be pen up.

For Easel, I could create a template that shows the usable work area. You would then just click Carve






Camera Slider Controller Hack


I have been having fun with my camera slider controller.  It is a cool, little, general purpose motion and camera controller that will soon to go on sale at Inventables. Taking a picture is very easy.  You just plug the camera into it and run the takePicture() function.  It has a lot of spare I/O pins that can be used for some cool hacks.

I always thought it would be cool to take a time lapse movie of a 3D print, but do it exactly one layer per frame and have the picture be taken at the exact same location every time so the print appears to grow out of thin air.  I know people have done this before, and I could probably hack the circuit right onto the printer controller, but camera slider controller was ready to go with the circuit and connectors all ready to go.  With less than ten minutes of coding and making a cable, I was ready to go.

GCode Hacking

The first task was hacking the GCode to output a a signal I could read remotely.  Kisslicer has a feature where you can add a few lines of Gcode every “N” layers.  I added the following GCode.  Note the “1″ in the layers box.  This means do it every layer.




G1 X0 Y0 means move to 0,0

G4 P500 means dwell for 500 milliseconds.  This was added because the next command was happening before the move completed.  I think this has to do with the way commands are buffered.  I think there is a more elegant fix for this, but adding a little delay here was a quick fix.

M42 P11 S255 means set I/O pin 11 to full on (255  is max).  Pin 11 is the first of the “servo” pins on my RAMPS controller.  This three pin connector would map directly to the servo connector on the camera controller.

G4 P1000 is a 1 second delay.  I had my DSLR on “auto” so it would need to focus for each shot, so I gave a little extra time.

M42 P11 S0 turns pin 11 off.

I ran a few test layers with my volt meter hooked up to the connector and it looked great.

Camera Slider Controller Hacking

The controller has 2 servo connectors that are intended to be used for hobby servos in a pan and tilt arrangement.  The signal pin on the connector can also be used as and input.  The code is simply going to watch for that pin to go high.  When it does it will display the next layer number and take the picture


Arduino Code

In the setup() section you need to make the PIN_SERVO_1 pin an input because that is connected to the printer controller.

pinMode(PIN_SERVO_1, INPUT);

The loop() section looks for the PIN_SERVO_1 pin to go high. When it does the layer number is incrememented the picture is taken and the LCD is updated. The camSignalRead flag is set so we don’t go read the same pulse more than once. The flag is cleared as soon as the signal

void loop() {

   if (digitalRead(PIN_SERVO_1) == HIGH) {
     if (!camSignalRead) { // make sure we read once per pulse
       camSignalRead = true; // 

       lcd.cursorTo(2, 0);
       sprintf(sVal, "Layer %d", layerNumber);


   else {
     camSignalRead = false; //reset this. the pulse is over 



Simply connect the signal pin (D11) on the servo 1 connector of the printer controller to the signal pin on the servo 1 (J7) connector of the camera slider controller. You also need to connect together a ground pin on each controller.






Camera Setup

I setup my DSLR on fully automatic and disabled the flash. I am sure the movie would have been better if I manually focused and locked the speed and aperture settings, but I just wanted a quick result. The controller first sends a focus signal and then a shutter signal. The focus signal acts like the half button push you do to focus most cameras.

The Print

The printing was done on the Quantum Delta printer.  I used my CNC Ninja Squirrel as the test print. It was scaled to 50mm tall. At at 0.25mm layer height, that gave 200 layers. The print took about 45 minutes with the added delays. It was run in a busy room at Pumping Station One so there was a lot of activity in the background and some light level changes.



The Result

Click here if the video is not displayed below.


CNC Translator for BeagleBone

The Rosseta Bone is a “universal” CNC translator for BeagleBone Black.

Rosetta Bone

The BeagleBone is awesome little controller.  It is a lot like the Raspberry Pi, but it has one special feature that makes it viable for CNC.  It is the PRU.  This is Programmable Realtime Unit.  This a part of the CPU that runs separately from the OS and gives it the critical timing required for smooth stepper motor control.  People have tapped into this and LinuxCNC to make a real embedded version of LinuxCNC.  Add in all the other capabilities like HDMI, keyboard, mouse networking, etc and things get amazing really fast.


I bought the BeagleBone Black which is the second generation BeagleBone.  It has more features than the original “white” version and actually costs less.  There are several CNC capes for the BeagleBone, like the BeBoPr or Replicape, but they are expensive, can be hard to get and some have issues with pinout changes that came with the BeagleBone Black.

BeagleBone CNC

Continue reading ‘CNC Translator for BeagleBone’

Web Page G-code Viewer

Try this Web Page G-code Viewer

I met programmer and maker, Joe Walnes, through a few local Chicago maker groups.  He  showed me a really cool web based G-code viewer he wrote to preview his 3D printer G-code.   It used WebGL for super smooth motion of the model.  It also allowed you to drag and drop your own files right into the page.  It worked great, but really only worked with 3D printer G-code.  He posted the code on GitHub.

I have a couple programming projects in the works that need a G-code viewer, so I decided to update his program to handle more types of programs.  Joe had a really nice UI and design pattern for the code, so I left that  alone.  He also helped me out with a few issues as I worked.

G-code Parser

A parser is a bit of code that breaks down text into tokens, or the basic grammer of the G-code.  He was working with very well formatted G-code so his parser was pretty simple.

G1 X5 Y5 Z6 E0.124

I was dealing with really Fugly lines of G-Code like this, so I needed to totally rewrite the parser.


Graphics Generation

Reprap 3D printers basically use G1 (straight moves) for everything.   I needed to add the code to handle G2 and G3 (arc moves).  This was a little tricky because there are no arcs in WebGL.  I had to break them into small line segments.   Joe also treated each Z level as a separate layer.  That is nice for printers, but not for general G-code.  I changed that and the way the color of the lines worked.

A Work in Progress.

It works on all my CAM generated 3D printer and CNC router G-code, but I want to add code to deal with more advanced features that are often hand coded like incremental moves, machine offsets, parameters, math functions and subroutines.

I will post the source code soon.


You need a WebGL capable browser like Chrome, Opera or Firefox.  I hard to turn on WebGL  in my Firefox.  I got it to run on my Android phone in Opera, but could not spin/zoom the model with the screen controls.

To view your own files, just drag and drop the G-code into the browser.  It will use the zoom settings for the previous model, so if you drop something that is a different size or offset to the side you may need to zoom around to find it.


Filament Extruder Competition – $40K!

Inventables announced a filament extruder competition the GE Garage at Maker Faire on 5/19/2012.  The contest is to design a machine to extrude ABS or PLA filament from pellets to 1.75mm using less than $250 worth of materials.  The extruder must be able to add the colorant as well.  The first person to upload a solution wins.  Inventables plans make pellets and colorant available to people to play with.

The prize is $40,000 and a desktop fabrication lab.  The lab consists of a laser cutter, 3D print and a ShapeOko CNC router.  The details are at

Filament is running about $40-$50 dollars.  That is about 5-10 times the cost of raw pellets.  This would be a great resource for a MakerSpace, HackerSpace, club or school.



ORD Bots on Sale at

Inventables is now taking pre-orders for Hadron ORD Bots.  I will not be shipping anymore kits and Inventables  is now the official, authorized distributor of the kits.  Go here to get on the list for one of the units.  The Inventables kits will also have the following improvements.

Bright Dipped Finish

  The previous version looked great, but the matt finish quickly gets dirty and scuffs often looked like sceatches.  Bright dipping is a chemical polishing that is done before the anodizing process.  The goal is to get the finish quality of a Mag Light.

Open Ended Wiring Holes.

A well wired ORD Bot is a thing of beauty, but once wired some of the parts are trapped by the wiring.

By adding open ended wiring holes, the wires can escape out the sides.  This will allow you to completely side off thing like the gantry without removing any connectors.

Wider Extruder Platform.

Deep extruders like some of the Wade’s family of extruders previously had to overhang the front a bit.  This adds more depth and an extra hole pattern to give you more options.

Loop Belts

With loop belts you will not have to measure and cut from open ended stock.  They will be a lot easier to install and will have twice the grab in the belt clamps.

Build Platform Changes.

  • Added holes for the ORD Bot heated build platform.
  • Increased spacing between the wheels.  This improves rigidity, reduces the sensitivity and cleans up the busy center area where the clamp and switches. fit.

Electronics Plate Changes

The Electronics plate will now have hole patterns for the RAMPS, ORDuino and Azteez controllers.

The Quantum ORD Bot Gets a Big Brother

There has been a lot of interest in an ORD Bot with a bigger build area. This is the Quantum’s larger brother. This uses the MK1/MK2 heated built platform which is about 214mm x 214mm. You can go larger, but you are on your own.

The name is not yet determined. I wanted something similar to Quantum that conveyed a larger volume. A search of units of volume reminded of one of my favorite units “The Firkin”. Not only does Firkin sound cool, it is part of the FFF (Furlong/Firkin/Fortnight) unit system and it is a measure of beer. The other suggestions was Hadron, which is very similar to Quantum but larger and means thick or stout in greek. Firkin is cool, but Hadron is more family friendly.

They share all parts except the MakerSlide length, the handle and the build platform.

ORD Bot Debut at PS1 HackerSpace

The ORD Bot made its debut at the Chicago HackerSpace, Pumping Station One. They host a monthly DIY CNC night that is open to the general public. I have been going for about 6 months and it is always a lot of fun and you meet some great people. Last night’s event was very well attended with about 30-40 people. Many of the people were there for the first time and found out about it via the Hackaday blog post. They usually have a 15-20 minute presentation and then everyone starts breaks away to work on projects or discuss ideas.

I was drafted into the presentation role to present the ORD Bot. It was received very well. Everyone liked the simplicity and clean look to it. Just about everyone picked it up to hold it in their hands. You don’t see people just spontaneously pick up someone else’s 3D printer very often. I guess when it is small, cute and has a handle, it is just asking to be picked up.

Up until then, the ORD Bot had never actually tried to do a full print. I had a lot of trouble getting the PLA filament. I had some get lost in shipping and two orders canceled due to lack of stock. I had some scraps of ABS that I used to test the extruder and I had run all the axis motors. I had done all my testing on a desktop PC at home and brought my laptop to the HackerSpace without all the software. I hooked into the PS1 Wifi and got the nessesary software.

This is the software “stack” I ran. Sprinter was already loaded on the Arduino. I used Slic3r to create the G-Code. I used Printrun (Pronterface) to interface with the printrer. Jeremy from tinymachineshop had a similar setup on his Makerbot and had Slic3r setup in about 3 minutes with the settings I needed. He also donated a length of black PLA

I decide to run the 20mm calibration cube STL that comes with RelicatorG. Slic3r generated the code in about 1 second. We spend about 5 minutes running PLA through to clear out the old ABS. The first attempt immediatly had a problem with the Y axis. I releazed that the set screw was never tighten on the pulley and it was just running on shaft friction. I tightened the set screw and the print ran great. I probably could play with the retract a little.

We were amazed how quiet the machine ran. You can compare it to the background voices in the video. There is even a Makerbot in the background about 10 feet away you can hear. I am not sure why it is so quiet. I think it might be because there is really nothing to resonate. All the flat parts are pretty small and pretty well bolted down.

The completed part measure about 20.015mm square. The layering looked quite even. There were several 3D printer owners in the room and they all commented that it took many hours of trial and error to get the quality I got on the first try. I am sure the tools have evolved a lot since they started and they helped by giving me the good Slic3r settings.

I took a bunch of pictures, but I left my camera at home. I will post more soon. Here is a picture of the part I took later.  If anyone else has some pictures, please send me a link.