6 Axis Grbl Port on PSoC

If you have done any extensive poking around the Grbl source code you will eventually come across this line in nut_bolts.h.

#define N_AXIS 3 // Number of axes

It would be so easy to just change that to 4 or 6 and have some fun, right?  No, unfortunately it is not that easy.  With a little work though, it is not too hard to add those extra axes to Grbl. I decide to try this with my PSoC port of Grbl.

ABC Axes

Typically the axes after X,Y, and Z are labeled A,B, and C and are often rotary axes. Here is a simple 4th rotary axis.

4axis

Things get more complicated when you add more axes.  Here is an example of a 5 axis upgrade for a 3 axis machine.

aaxis

N_AXIS

While simply changing N_AXIS does not suddenly make the extra axes work, it does do a lot of the work. I found it used over 80 places in my port.  It will do virtually all of the major code work.  I just needed to do the following…

  • Read the ABC parameters in the gcode.
  • Add additional $$ settings for steps/mm, speed and acceleration for the A, B, and C axes.
  • Add homing code for A,B, and C.
  • Adds some #define statements to make it easier to configure between the axis counts.

As I was working on this I stumbled upon a few other people working on this.  This code I found was especially helpful.

Configuring I/O

Grbl uses 1 byte byte each for axis step, direction and limits switches.  Those bytes are used with a mask (to say with bits are actually used) and applied directly to an I/O port.  This is a very efficient way of doing it, but it forces you to put all axes on one I/O port for each of the step direction and limit switch functions.

My port to PSoC uses Control Registers to output the step and direction signals and Status Registers to read the limits switches.  These registers can be ‘wired’ directly to I/O pins.  There are several advantages to this, but the main ones in this context are, you don’t need to map them to the same I/O port and you only have to connect the ones you want to use.  Here I have defined all 6 bits on the Control Register, but have only connected the I/O pins I am using.

controlregister

 

To make the PSoC port easier to maintain as Grbl changes, I did not change the Grbl method to much.  The mask is still applied, but the mask is hard coded.

The homing switches work in a similar fashion. Here is a 4 axis setup.

limits

EEPROM

The storage of the steps/mm, speed, and acceleration will increase the amount of EEPROM required.  The PSoC has plenty, but keep in mind every time you change the axis count, you will need to reset the EEPROM because the locations will get shuffled and the restore from EEPROM will not work the first time you start under the new axis count.

Status

The status is going to report the extra axes, so I assume it will break a few senders.

?
<Idle|MPos:1.680,4.568,-0.900,0.664,0.428,0.984|FS:0,0>
ok
$#
[G54:0.000,0.000,0.000,0.000,0.000,0.000]
[G55:0.000,0.000,0.000,0.000,0.000,0.000]
[G56:0.000,0.000,0.000,0.000,0.000,0.000]
[G57:0.000,0.000,0.000,0.000,0.000,0.000]
[G58:0.000,0.000,0.000,0.000,0.000,0.000]
[G59:0.000,0.000,0.000,0.000,0.000,0.000]
[G28:0.000,0.000,0.000,0.000,0.000,0.000]
[G30:0.000,0.000,0.000,0.000,0.000,0.000]
[G92:0.000,0.000,0.000,0.000,0.000,0.000]
ok

Sending the GCode is pretty easy, but I don’t know of any basic gcode senders that support more than three axes.

My personal sender uses regular expression to do the basic parsing of the status. This is a robust way to to handle status that can change formats as long as it is predictable.   I send the position data to a function that splits it into a string array.  I’ll just need to add some DROs for the extra axes if it detects them.

Testing

I don’t have a 4 or 6 axis CNC, so I built a little test rig with 6 axes.  I used a Gecko G540 and 2 single axis drivers.  Each stepper has it’s own home switch triggered by a cam on limit switches with roller actuators.  This allows the switches to be triggered , but allows the steppers to run continuously in either direction.  The homing sequence is quite fun to watch. Building this test rig took about as much time as the firmware changes.

testrig

 

Here is a YouTube video of it.

Next Steps

I want to do a lot of testing, then build a machine to do some real world testing.  I currently don’t have any decent CAM software over 3 axes, so I will need to deal with that. I will then add it to my GitHub repo for this.

 

Lost PLA Casting

cast2

We recently did some aluminum casting at the Inventables Beer and Making night. The primary mission was to do some lost foam casting, but I wanted to try lost PLA.

Beer and Making is typically a gonzo/hackathon type event, so we deliberately try to use materials on hand and try to learn for ourselves. We used pink insulation foam because it could be easily hand carved during the event. This was the first time for everyone, so I was quite happy with our success.  I’ll point out some areas where we probably could have done better.

The furnace

One of the perks of working at Inventables is our personal Exploration and Project budgets.  We all get a budget for personal exploration and making things. The furnace was recently purchased by Jon, one of the fulfillment team members, with some of his budget. This furnace runs off standard 110V and can heat the material up to 1150°C.  We set it for about 1000°C for the aluminum.

furnace

 

The Model

sprues

 

The model I used is the unofficial mascot for the CNC build Club, the CNC Ninja Squirrel.  I tried to use as little PLA as possible.  I used 2 perimeters and 5% infill.  There are a few steep overhangs, so I typically need at least 2 perimeters for success with this model. I didn’t use any special filament, just the PLA was in the printer at the time.

The model will be buried in the sand.  You need to create a couple of channels (sprues) to reach the surface for the casting process.  The channels have several functions.

  • Provide a place to pour the aluminum.
  • Provided an escape path for the air and other gasses created when the material is burned out.
  • Provide a a source of aluminum for the part to draw from when it shrinks.

I created the channels from pink foam and hot glued them onto the PLA model.

The Sand

We used what we could find quickly.  We used about 9 parts of a play sand and pool sand mixture and 1 part of bentonite power (the Tait mix).  We added just enough water to make it clump a little.

The Setup

cast1

We got a large metal metal tray and put some dry sand on top.  This was a bit of a fire pit in case of any spills or fires.  You can see the size of the crucible in the foreground and the tongs that came with it.

We made a small enclosure out of MDF.  We filled it half way with the sand mix. We placed 3 items to cast in it.  We then covered the items in sand.  We added the sand slowly and packed it down with a rod at several levels.  We poured each of the 3 items with separate pours.  We wanted to make sure each item got a lot of aluminum.

We used scraps of MakerSlide as the aluminum to melt.  We cut the pieces to the length of the crucible.  We would add a piece at a time as they melted.  It took about 30 minutes for the first batch and about 10 minutes for the other batches.

Pouring

IMG_1722

The pouring was pretty exciting.  Some of the aluminum ran to the MDF sides and started a little fire.  We had a fire extinguisher ready, but simply put a cover over the box to kill the flames. Most of the flames you see in the image are the foam being burned away.

Results

We did three separate parts.  2 were foam and 1 was PLA.  The PLA probably had the best quality finish, but the part came out noticeably darker.  It was easy to clean up with a stiff wire brush.

Next Time

  • The first change I would make is to use something non flammable for to hold the sand.  I think a ceramic flower pot might be good.
  • Build up the sand around the sprues to keep the aluminum from spreading.
  • Cover the part in dry wall paste.  This creates a thin shell between the part and sand to get a better finish.
  • Get some better sand and a little fire clay to make a better sand mix.
  • I might try to model the sprues onto the part in PLA
  • Mark the in and out sprues, so you know what side to pour into.
  • The smoke and fumes were pretty nasty, especially the MDF.  Do this outside!

 

 

Digital vs. Analog Servos

wiggles

There is quite a bit of wiggliness on my drawing bot. While it is a bit adorable as it draws, I wanted to see if I could improve the line quality. I thought increasing the the rate at which I updated the position would make it smoother. I took it all the way up to 48Hz, but was not getting much better quality than I did at a 1/4 of that.

Analog Servos

I little research into analog servos brought some possible solution to light. Analog servos are controlled with a PWM signal.  The PWM pulse should be between 1ms and 2ms and repeat at 50Hz.

servo_timing

The basic technology inside an analog servo has been around longer than I have. The circuit converts the signal pulse into a voltage based on it’s length.  The output shaft is coupled to a potentiometer which also outputs a voltage. These two voltages are compared to produce an error voltage.  The error voltage would be positive or negative based on which direction off the output shaft potentiometer is from the input signal voltage.  This voltage is sent through an amplifier and then to the motor.  The motor turns in the proper direction until the error voltage is zero.

aservo

One problem with this method is the voltage to the motor is proportional to the error voltage.  The motor will have very little torque when the error is small, as would occur with small moves.

To keep the servo from being overly sensitive to small changes changes in the pulse length, the servos have a deadband.  Over sensitivity would cause jittering and use a lot of power. The deadband is expressed in microseconds (us). Analog servos typically have a 5us deadband. If the error is less than the deadband, the servo will not move.

If the servo pulse range is 1ms to 2ms or a 1000us range, then this causes the second problem. A  1000us range divided by the 5us deadband is 200.  This means I basically have to move more the 1/200 of the usable range to get it to move.  The full range is 180° so I have roughly 1° resolution.  That will cause lines to look very jittery.

Try this to get a feel for an analog servo.  With the servo receiving a commanded position, attempt to rotate the output.  You will notice two thing. First you will notice the strength of the servo is proportional to how far you twist it off the commanded position. The second thing to notice is noise and vibration.  That vibration is the 50Hz PWM period.

Digital Servos

Digital Servos use the same same basic input method (1ms to 2ms pulse) to preserve backward compatibility, but everything is done digitally.  Additionally, most of the servo’s parameters can be programmed. The digital circuit does not need to be limited to the 50Hz period and the control loop can be more sophisticated than simply using the error voltage.

The two immediate things I can take advantage of is lowering the deadband.  I can program it down to 1us or on some servos even lower. This give me a 5x improvement in resolution.  The other thing is the higher torque at small moves.

Try this to get the feel for a digital servo.  With the servo receiving a commanded position, attempt to rotate the output.  You will notice two thing. First you will notice the strength is very strong regardless of how far you twist it. The second thing to notice is noise and vibration.  That vibration is going to be a much higher pitch.

The results.

digital_wiggles

The results are subtle, but I think it is better.  With no changes to the firmware it got a little better.  I changed the update rate from 50Hz to 200Hz and it got a little better again.

I used Hitec HS5055MG servos.  I wanted a brand name servo, I know I could program.  Out of the box the servo only had about 90deg of rotation.  I was able to up that to about 178.  I was quite surprised I could not get 180°.  That needed to be accounted for in the kinematic or the shapes are distorted.

I think if you want the best, go for the digital, but in my opinion, the improment in quality did not justify the cost.

 

 

Yet Another Way to do the Kinematics

image1

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.

Triangle_with_notations_2.svg

lawofcosines

 

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

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

The Goal

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)

step1

 

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

step2

 

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

step3

 

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

step4

 

Determine A1 and A2 from the angles we figured out.

A1 = T1 + T2

A2 = A1 + T3

Conclusion

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.

2dbenchy

Grbl

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.

PSoC

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.

servospwms

Easel

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.

easel_template

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.

trace

Hobby/RC Servo Control in PSoC

psoc_setup

 

The PSoC family is my go to line of processors for prototyping.  It is like having a breadboard full of digital and analog circuits that you can wire up on the fly. I have been doing some stuff with hobby servos lately so I needed to figure out how to do it on the PSoC.

Hobby Servos

Wikipedia

From Wikipedia

servo_timing

Image from Adafruit

 

Hobby servos set their rotation based on the length or a repeating pulse. The pulse should be 1ms to 2ms long and repeat every 20ms.  One end of the rotation is at 1ms and the other is at 2ms.

The PSoC PWM  Component

PWM_Comp

The PWM component is perfect for this job.  The PWM component can be setup to have a period and an on time.  The period should be 20ms and the on time would be between 1ms and 2ms.  The component uses a clock and two counter values.  The component will count on every clock pulse.  It resets the counters after the period count has been reached and the CMP value determines how long the pulse is logic high.

The PWM output goes to the servo control line.  Here is the configuration dialog box for the PWM component. The graph at the top is a good reference for what the output will look like.

pwm_setup

The goal is to have a pretty decent resolution to set the 1ms to 2ms pulse.  I chose a 2MHz clock.  I picked the fastest clock that would still fit within the 16bit (65535) limit of the control.  PSoC clocks are derived from system clocks, so you need to pick values easily divided down from them.  The IDE helps with creation of these clocks.  At 2Mhz the period (repeat rate) should be set to 40,000.  The equation is the clock * period(in second) = period counts (2,000,000 counts/sec * 0.02 secs = 40,000 counts).

The CMP Value is how many counts the high pulse should last.  The equation is the same. For 1ms the count would be (2,000,000 cnts/sec * 0.001secs =  2,000 counts) and for 2ms the counts would be 4,000.  The range is 2,000 to 4,000 (2,000 count resolution).  This is better than most hobby servos can do.

The Code

The IDE will generate a bunch of functions, a custom API, for each component used when the application is built. There are two PWM Component functions we need to use for this application .

  • PWM_Servo_Start() This will initialize the component and get it running. This is called once at the beginning of the program.
  • PWM_Servo_WriteCompare(val) This sets the CMP Value that will be used to set the pulse length.

I also wrote a function the can set the value by degrees.

void setServo(float degrees)
{
unsigned int val;
// convert degrees to compare value
// 2000 to 4000 = 0 to 180
// value is
val = (degrees / 180.0 * 2000.0) + 2000;

PWM_Servo_WriteCompare(val);
}

The Results

Here is a screen shot of my logic analyzer. The output was set for 1/2 rotation. The pulse is 1.51ms and the period is 20.14ms.  That is close enough for me.  It is likely the clock speed is different between the PSoC and  and the analyzer.

capture1

 

Typically you will have to tune the to the actual servos used.  Just tweak the endpoint values until you get the rotation you want.

PSoC 5 Port Of the Grbl 1.1 CNC Controller

Image from Cypress

Image from Cypress

Grbl

Grbl Logo 250px

 

Grbl is a high performance CNC controller.  It is used on a lot of small scale CNC machines and is the motion control code behind a lot of 3D printers.  It was originally targeted at the Arduino 328p hardware (UNO). It is developed  by Sungeun “Sonny” Jeon. He is a good friend.  He is always very helpful and this port would not have been possible without the quality of his code and his advice.

PSoC Mixed Signal Controller

I love working with the PSoC (Programmable System on Chip) family of micro controllers.  You can configure them on the fly with many analog and digital components.  The analog components are not basic ADCs and DACs, you have OpAmps, PGAs,  filters, MUXs and more.  The digital blocks includes basic logic gates, all the way up to FPGA like components you program yourself in Verilog..  There are over 200 ready to use components you can wire together on the chip.

I have always used them for small prototype projects, but wanted to test my skills by porting a major project like Grbl.  At the same time I wanted to take advantage of the features of the PSoC. The dev board I used was the CY8CKIT-059.  This has ARM Cortex M3 processor a lot of I/O and costs less than $10! It has a built in programmer and debugger.

OLYMPUS DIGITAL CAMERA

PSoC Advantages

Here is a comparison between the the ATMega 328p (Arduino UNO) and the PSOC5

PSoc 5

ATMega328p (UNO)

CPU

32 bit

(ARM Cortex M3)

8 bit

Speed

Up to 80MHz

16MHz Typ.

Flash (program size)

256k

32k

RAM

64k

2k

EEPROM

2k

1k

I/O

up to 62

14

Flexibility

Grbl’s flexibility allows you to tailor it to your hardware.  With a few limitations, you can move the pins around and change things like whether switches are active low or high.  This is all done using #define values in configuration files.  That is great, but the code gets a little messy every time you access hardware. It has to do a little logic gymnastics each time.

With PSoC you can do all of that in a visual schematic and pin wiring feature.  Here is a PDF of my schematic.  Have you ever swapped transmit and receive on a UART? In PSoC you can just swap the pins on the schematic.

Here is an example of the difference in firmware code.

Grbl on 328p

uint8_t limits_get_state()
{
 uint8_t limit_state = 0;
 uint8_t pin = (LIMIT_PIN & LIMIT_MASK);

 if (bit_isfalse(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) { pin ^= LIMIT_MASK; }

 if (pin) {  
   uint8_t idx;
   for (idx=0; idx<N_AXIS; idx++) {
     if (pin & get_limit_pin_mask(idx)) { limit_state |= (1 << idx); }
   }
 }
 return(limit_state);
}

Grbl on PSoC

uint8_t limits_get_state(){  
 return Status_Limit_Read();
}

 

Special Hardware Usage

I used some special features to move functions out of code and onto the hardware.  One of them was the step pulse.  Stepper drivers typically require a pulse of a minimum length to take a step.  In normal hardware you have to raise the pin, then figure out a way to turn it off after a given period of time.  This is typically done via an interrupt.  It works fine, but the code is messy and interrupts can cause timing issues.  PSoC  control registers have a pulse feature that automates this. You attach a clock and the clock determines the length of the pulse.  The code sets it and the hardware clears it.  It looks like this on the schematic.

step_pulse

 

Another feature I used was hardware switch debouncing.  This can be done completely in hardware.  See the image below.  The clock sets the debounce time.  The debouncers are all fed into a status register where they are read  as a single value.  There are digital “nots” after the debouncers because my switches close to ground.  The firmware could invert the logic, but it is so much easier to read on the schematic. It then feeds an interrupt.

switch_debounce

 

If you would rather do this with an analog filter, you can design custom filters in the hardware.  You could fine tune the filter right from your keyboard.

 LCD

lcd

PSoC has a built in character LCD Component that makes using and LCD  very easy.  The code for the LCD is in the main loop and not an interrupt.  This allows the time critical  stuff to have higher priority.  I used an interrupt to just set a flag so the LCD does not update every time through the main loop.  I found the LCD to be an awesome debugging tool.  I could display stuff while the code is running.

lcd_update

 

I also used a hardware Quadrature Decoder for the LCD rotary knob. This works great to monitor the encoder in hardware.  I just need to read the value in the LCD update routine.  The clock feature on the QuadDec is a debouncer, which helped debounce my mechanical encoder.

encoder

Next Steps

I have been testing for a while and so far it is working great. I also have some plans to use the extra power on some cool projects.

Here is the code on GitHub

Here is a picture of my test setup.

0213172059_HDR

A Line-us Clone

image1

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.

8d65c4576042e58c834aa36d1098ceb6_original

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.

measurements

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.

mini_servo

 

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.

design2

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.

 

 

kin2

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.

pca9685-16-channel-12-bit-pwm-servo-driver_1

PowerMBV21

 

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.

image2

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

 

 

 

 

 

The Bipolar ORD Bot

bipolar_ord_bot

 

It’s ORD Camp time again this weekend.  Every year I have done a gonzo build of some type of CNC machine.  This year I only had a few hours to spare, so I wanted something simple.  These are never meant to be practical machines, just conversation starters.

This was hacked together and programmed in about two evenings with stuff I had laying around, but working at Inventables means there is a lot of cool stuff “laying around”.  It was inspired by the RepRap Wally 3D printer, but vastly simpler in construction.  This only uses a couple of fabricated parts.  There are (2) sets of indentical actuator arms.  The inner arms are hard mounted to small NEMA 14 stepper motors.  The other end is attached  to a wood base, but free to rotate on a bearing.  The outer arms are mounted to the stepper motor shafts using Actobotics hubs.  The other ends have 1/4″ I.D. flange bearings.  These are bolted together, but free to rotate using a screw with a holed drilled for the pen.  That is basically it for the mechanics.

The stepper motors are driven with some high resolution stepper drivers.  These are driven by stock grbl 0.9 firmware running on an Arduino UNO.  The UNO does not know what the heck it is driving though.  The resolution is done in degrees.  I wrote a quick conversion tool that converts Cartesian gcode to bipolar gcode using these formula.

  • L = 150mm
  • A = 90mm

penbotkins

I have my CAM software output circles as multiple lines, so circles don’t need to be dealt with.  It has an odd, shield, shaped work area that you need to stay within.  Before powering on the steppers, you place the pen at the top middle of the work area.  You then tell grbl that both angles are at 51 degrees with G92 X51 Y51.

workarea

 

Here are a few more pictures taken at this weeks Beer and Making session at Inventables.

0121151912 0121151912b 0121151912c

 

The shield has a solenoid driver that I was going to use for pen up, but I never got around to that.  I kind of like how it runs so silently.

Here is a video of it running.  It is rerunning over an old plot to show the repeatability.   I think if I used true inverse kinematics the plots would look even better.  Maybe Machine Kit on a Beagle Bone is in its future.

UPDATE:

A few people have asked if the motors could be moved to different locations.  Yes, I think you could put the (2) motors on any (2) joints and still have a controllable machine.  Not all work areas would be the same size and some might have issues with much higher torque requirements.  I believe separating the the motors by one linkage, like this one, yields the best results.

Skate-oko-asaurus: The self replicating skateboard

We build a lot of skateboards for fun at Inventables.  Some of the guys even sell them at local craft fairs.  They thought it would be cool to have a CNC router optimized for skateboards that was easily portable.  I first thought about putting wheels at one end, then realized the machine itself could be a skateboard.  We thought it would make a perfect Gonzo Build.

2014-10-26 11.00.15

A Gonzo Build is something we came up with at Pumping Station One CNC Build club.  The concept is that we try to build an original, “one off”, CNC machine in one evening.  They also tend to have a whimsical aspect to them, so we don’t take ourselves too seriously.  We usually get about 8-12 people to help build.  If parts need to be fabricated, they must be done that night on -site.

2014-10-26 11.00.50

Building a stock Shapeoko 2 in one night is a challenge in itself, but we decided to up the challenge by totally tricking this out with every feature we could think of.  We did have a few master CNC building ringers in the group, like Tait Leswing and David Ditzler.

Here are the stats of the machine.

  • 1200mm x  250mm work area
  • Skateboard specific wasteboard supported by additional extrusions.  It is narrower than a stock Shapeoko 2 and about 3 times as long.
  • Drag Chain
  • gRAMPS Controller running grbl 0.9.
  • Quiet DC spindle with full speed control.
  • Feed hold / Resume / Reset buttons
  • Homing switches on all axes
  • Auto Z zero with Z probe
  • Trucks and wheels
  • NEMA 17 motors with dual Y stepper drivers.
  • Portable dual 24V/48V power supplies with master power switch.

2014-10-26 11.18.20

 

soa_controller

Most of the Shapeoko parts came from reject area at Inventables, so there are a few dings and scratches.

The wasteboard was cut from 5/8″ particle board on the PS1 Shobot.  It has a grid v carved into the work area.  There are threaded inserts for clamps, primarily around the perimeter, but there is a truck bolt pattern strategically placed so a cut out board can be flipped or remounted accurately . It is supported below by 2 additional MakerSlide pieces and tied to the MakerSlide rails above.  It is the bed turned out very rigid.  It does deflect a little with heavy rider but pops right back.  After the build, I added several coats of spar varnish to ward off the dusty footprints.  Biggest guy to ride it so far tips in at about 230lbs.

soa_bottom

We set our selves a goal of completing before midnight.  Done or not, I was going to ride it at midnight.  We thought we were finished about 20 minutes early.  Everything worked fine except the Z axis was not moving correctly.  It had the classic stutter and random motion of one coil wire not connected.  We tried to find the problem, but over 2 meters of drag chain slowed us down.  Midnight came some we dropped it to the floor and I rode it across the shop.

2014-10-26 11.03.30

As a skateboard, it is pretty much a joke.  On the first ride, we didn’t even have long board trucks, so the turning radius was huge and you can easily scrap an edge.  The front has a handle cut into the nose of the bed.  The ideal way to move it around is to lift the front and drag it on the back wheels.