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.
Design
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.
Assembly
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°.
Kinematics
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.
Electronics.
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.
Firmware
Here is the firmware I used. It is a quick and dirty port of my PSoC port of Grbl. I cannot give support for this. Only experienced PSoC programmers will be able to install and use this.
CAD File
Here is my STEP file of the design. This contains all of the printed parts and some of the hardware. You will need to figure out a few things on your own.