Archive for the 'Software' Category

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.

 

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 want to test it a while longer then post it on GitHub.  I also have some plans to use the extra power on some cool projects.

Here is a picture of my test setup.

0213172059_HDR

The Delta Router + 4th Axis

deltarouter

Overview

Every year I make a new thing for ORD Camp.  This year I made a delta router.  The ORD contraptions I make, have one primary function; to spark conversation.  This means they have to be interesting, a little whimsical and a little cool looking.  They are generally rather small for portability and to keep the costs down. Practicality and suitability are way down the list, so go ahead and snark away.  If you do, you are missing the point.

This year there happened to be a session on creativity with constraints.  The question we debated for an hour was, do constraints help or hurt the creative process. Constraints can move you out of your comfort zone and maybe that is a big part of creativity.  The topic was perfect for me because I had intentionally challenged myself with a few constraints on this project.

  • Use non captive stepper motors. Not a lot of people have seen these in use, they are cool to watch and they simplify the design.
  • Limit myself to 3 unique fabicated parts.  People keep thinking deltas are more complicated than .  This was to demonstrate the simplicity.  Go ahead, design a Cartesian machine with only 3 unique fabricated parts.  All other parts had to be commonly available parts.
  • Use stock reprap software.  I could only touch the configuration files.

Design

I met all the constraints except for one.  I designed a common top and bottom bulkhead, but at machining time I decided it was silly to to spend the time to add holes only used on the top to the bottom and the same with the top.  So the four unique fabricated parts are the top, the bottom, the carriages and the end effector.  The top and bottom are 3/4 inch Baltic birch.  The other fabricated parts are 3mm carbon fiber.  All parts were setup and cut in less than 30 minutes on my homemade CNC router.  A 3D STEP of my design is here.

Mechanicals

The vertical rails are MakerSlide.  I used steel V wheels because I had them laying around.  The rest of the mechanical parts are Actobotics parts from Servo City.  I thought they were an awesome discovery and then the next day I saw that Sparkfun started to sell them.  They really worked out great.  My only complaint is that they are imperial thread based parts.  I prefer all metric on my designs.

The non captive stepper motors are really cool.  The thread is a 2 start 8mm trapoidal, so it moves 4mm per rev.  They are quite fast and strong.  I custom ordered them at Robot Digg.  The only drawback is you cannot move them by hand.  You can’t spin the rod or the motor.  In this design they are a little vulnerable too.  If they get banged hard they could bend.

The linkages are Acrobotics heavy duty ball ends attached to some standoffs I got at McMaster.

Electronics

I used some mini arcade style switches for the limit switches.  They are pretty nice snap acting switches, but probably a little less accurate than microswitches.  I chose them because they would be super simple to mount without adding mounting brackets.

redbut

The controller is my favorite reprap controller; the Azteeg X3.

2014-02-09_10-17-20_373

Spindle

The spindle is a brushless DC hobby motor.  It is a Turnigy Trackstar.  The speed controller is a Turnigy Plush 30.  The shaft is 1/8″.  I used a simple shaft coupler to mount the bit.  This added a lot of vibration so the motor could not run at full speed, but that was OK becuase the full speed is close to 30,000 RPM and 550Watts!.  I eventually manually balanced the coupler and it runs a lot smoother now.  I did it by drilling through the existing set screw holes to the other side with a small bit.  I enlarged that hole until it was balanced.

balanced

ttsmn

 

TR-P30A

4th Axis

2014-02-09_11-48-11_382

Later when I got home, I thought it would be cool to add a rotary axis to it.  The challenge was going to be using the extruder motor logic for the rotary axis.  I had this attachment laying around that was bought from eBay a few months ago.  A typical 4 axis machine simply disables one of the axes while using the rotary.  That is not possible with a delta, so all 4 axes need to run at the same time.  It is quite fun to watch.

rotary_attachment

 

It was perfect because it was so small.  It has a 6:1 reduction gear inside.  I made a simple base for it that would allow it to be quickly mounted to the router.

rotary_base

 

Firmware Changes.

The firmware changes to Repetier were pretty simple.  Extruders use millimeters as the feed unit, so I just converted that to degrees.  The motor is 200 steps/rev with 16x microstepping plus 6: 1 gear reduction.  This yielded 53.333 steps per degree.   I changed the safe extruding temperature to a very low value and then just wired a 100k resistor across the thermistor pins so it read a constant value above the safe temperature.

 CAM Software

I don’t have any high end CAM software that does anything really cool on a rotary.  I did have an evaluation copy of DeskProto, but that timed out.  I did have Vectric V Carve that does have a wrapped rotary feature.  That would be good enough to do my Hello World project.  I had to write a post processor for it.  I basically hacked the Mach3 wrapped rotary post processor.  I had to make it really simple and tell it convert “A” moves to “E” moves.  There were a couple other changes too. The post processor is here.

hellopath

Changes and Issues

  • I really need a tail stock to support the stock and help set up the job level.

tailstock

  • The feed rate on rotary axes are tricky because millimeters per minute is quite different than degrees per minute and there is no way to deal with that in GCode.  The actual feed rate through the material depends on the radius (Z).  Programs like Mach3 can compensate for it.   I could really hack the firmware or maybe write a post post processor to compensate the speed based on the Z.
  • I need to get some real software to some interesting carving with this thing.

hs

First Job Video

Go Deltas!

 

vld

 

 

Camera Slider Controller Hack

csc4

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.

 

kiss

 

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; // 
       layerNumber++;

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

       takePicture();
     } 

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

}

Wiring

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.

ramps_servo

 

 

csc2

 

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.

csc3

 

The Result

Click here if the video is not displayed below.

SONY DSC

Alibre is Now Geomagic

3D Systems recently acquired Geomagic.  Several years ago they acquired Alibre.  Alibre is a parametric CAD program.  It appears that they are simply re-branding the existing version of Alibre as Geomagic, but will incorporate feature of the Geomagic product line over time.  Here is the basic product line.

  • Geomagic Design Expert $1999
  • Geomagic Design Pro $999
  • Geomagic Design Personal $199

I am also pretty sure that Cubify Invent @ $49 is a further simplified version of “Personal” that allows you to work at the part only level.  A comparison of the upper levels is here.

I have used Alibre and Cubify Invent and find them to be quite capable.  Some day I may loose my easy check out access to Pro/Engineer and these products are on the radar as possible solutions.  I found the even Cubify invent could do a few little tricks that are a pain in Pro/E.

 

Intro to V Carving

In a couple weeks we are going to do a CNC V Carving night at Pumping Station One.  We hope to fabricate a number of designs on the CNC router.  This blog post will serve as a basic introduction to the concept and will help people get artwork ready.

What Can V Carving Do?

V Carving uses a V shaped bit to to “carve” a design into the material.  Because the bit has a v shape, you can cut narrow shapes with the tip or wider shapes near the bottom.

You can even cut shapes wider than the widest part of the bit by doing multiple passes of the bit.  The depth of the cut is proportional to width of the cut, so you need to make sure your material is thick enough.  If you have very wide areas, you can set a depth limit and you can make that area have a flat bottom with a second flat bit.

Normally routers cannot cut square inside corners because you are cutting with a round bit.  V Carving can get around this limitation because the bit can rise up into the corners until it gets to the zero radius tip.

Finishing Tricks

V Carvings can look great simply cut in the natural material, but they can really pop when you put a contrasting finish in the carved areas.  This is a time consuming process and can be difficult to do well.

You can often shortcut this process by using masking materials.  You start by applying a background finish to the work piece.  This is then masked with tape or specialized masking material.  The router then cuts through that as it is cutting the design.  Now, only the cut area is exposed and you can simply spray paint the exposed area.  If the design has multiple colors you can cut one color, paint, remask and repeat the process.

The files should in in DXf, DWG, AI, EPS or PDF  format.  Many programs like InkScape and CorelDRAW can output these formats.  If you have hi resolution bitmap, some of these programs can convert to a vector format.  Feel free to try that, but help with that will be beyond the scope of the session.

The quality of the masking material comes into play with very fine details.  If your design will leave tiny isolated dots of masking, some materials may not stick well enough and break free during cutting.  If that happens, you can manually touch up those areas later.  I like to use Avery Paint Mask, but plain masking tape, adhesive shelving paper and materials for vinyl cutters also work.

What is good artwork to start with

  • Avoid very thin lines lines.  The  material needs to be needs to be perfectly flat and consistently thick for this.
  • Very large areas to cut will take a long time, so avoid them for this session.
  • Multiple colors.  Multiple colors is OK, be each color needs to be separated from the other color so there is masked uncut area between them.

This logo would work.  The red would be the base material and all other colors would be cut and colored.

This one would be very hard to do because of the adjacent colors.

How to bring the artwork to the session.

To save time, the artwork should be as ready to import as possible.  Problem artworks will be pushed to the back of the queue and might not get cut.

The artwork needs to be in a digital, vector format.  By digital I mean you can sent the file electronically.  Vector files are created with actual geometry.  Lines are lines and not a string of pixels.  Scans and photographs are not usable.  If you zoom in and the image gets pixelated, it is not ready to use.  The shapes also need to be closed.  If you have a square, for example, all the corners need to meet or the software cannot determine inside from outside.  Tiny gaps can be closed in the CAM software, but if you can see them, close them.

Try not to be too complex or have large cut areas.  These will take a long time and will limit how many people we can accommodate in one session.  We can still create G-Code, but you many need to cut it at a later date.

If there is time I my cut small PS:One snowflakes for the people who did not bring any artwork.

Material

The idea material is a smooth, pre-finished piece of wood.  It needs to be as least as deep as 1/2 the width of your widest feature if you are not planning a flat bottom.  The material should be as flat and consistently thick as possible or the results can be distorted, because the depth of the cut is so critical.  Avoid oily or wet finishes because the mask material may not stick well.  Plywood does not look well and often interior layers have voids.

Examples

Image From http://www.routercut.com/

 

Image from: http://www.makecnc.com

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.

N100G17G91G1X5Y5Z6M03S1000(comment)G1X5;comment

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.

Usage

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.

 

Getting More Power and Cutting Accuracy Out of Your Home Built Laser System

I have developed an inexpensive control system (less than $70) that can be used to both get more cutting power out of a DC discharge laser and significantly improve cutting accuracy for home built laser systems.  The control system implements a control technique known as Pulse-Per-Inch (PPI) control.  PPI control involves pulsing the laser every time the head travels a certain distance.  PPI control allows a CNC laser to produce consistent cuts at the same power level setting over over a wide range of speeds.  In effect, pulsing the laser as a function of distance along a cut decouples the power input to cut from the speed that the head travels.  Therefore, the speed and acceleration of the CNC system have minimal bearing on the cut characteristics.  Furthermore, the unique transient rise response of a DC discharge laser allow PPI to deliver more power to a cut in comparison to the same laser system with just on/off control.

Background and Motivation

A while back, I was active on a forum in which we were discussing the time it takes to turn a laser on and off and how that relates to engraving control.  One of the forum members from Full Spectrum Engineering posted a high-speed intensity spectra for the cheap DC discharge lasers that we use for DIY laser cutters.  I was quite surprised by the spectra.  I expected to see a nice exponential rise to set power level, but what we saw was a rapid rise to a very high power level (nearly double the set value) followed by an exponential decay to a set value.  The Spectrum in question is shown below (credit for the spectrum rests with Full Spectrum Engineering).  The yellow square wave is a 5ms pulse sent to the laser power supply.  The green spectra is the intensity spectra of the laser.  For whatever reason, the magnitude of the spectra is upside down (I think the ground and signal leads were reversed), so on for the digital signal and higher intensity for the laser power spectra are down rather than up.  Anyhow, the spike in intensity is caused by the necessity voltage to start a plasma in a DC Laser.  The laser power supply generates a very high voltage to start the plasma which is stored in a capacitor.  When the signal comes to turn on the power, the power supply dumps this charge into the system and then supplies a nominal (still very high) voltage to sustain the plasma once it is on.

DC Discharge Pulse

Continue reading ‘Getting More Power and Cutting Accuracy Out of Your Home Built Laser System’

MakerSlide Camera Slider Control Program

There has been a ton of interest in camera slider applications for MakerSlide.  A while ago I decided to make a very simple reference design for a motorized slider.  This design only required fabrication of one part.  The rest of the parts are existing components.  The part can be made on a laser cutter, router or even by hand.  There are no tight tolerances and you can use the MakerSlide carriage as a template for drilling some of the holes.  I can sell a complete slider system including motor for less than $120 for a 1 meter setup.  It would only be $10 for each addition meter.  The longest I can ship is 2.5 meters, but I stock the material in 4.5 meter lengths if you can figure out how t0 get it.

I don’t know much at all about this type of camera work so I did not see all this interest coming.  Several people approached me about buying my prototypes and I have sold several of them.  Most of them asked me how to control the motor.  I come from a CNC background so most of my demonstrations were done using CNC software like Mach3, EMC2 or even GRBL.  This has few issues.  The first is many photographers have no knowledge of CNC or G-Code.   The second is the solution is way overkill in cost and complexity for a single axis machine.  The third issue is portability.  This will probably be used in the field where a PC is impractical and power may be unavailable.

I decided to make an Arduino based controller.  Arduinos are good because they are cheap, small and easy to program.  They also use very little power.  I wrote a similar controller for the PIC processor a long time ago and borrowed the basic algorithm from that.  The method used could work for multi-axis machines if you want to steal the code.  The Arduino is. using my Stepper Shield.  I have just one driver installed and in another “slot” I have a bread boarded switch.  The stepper shield is nice because it can act as a mother board for many future features.

MakerSlide: Camera Slider Control Program 2011 CC-A-SA

0 = Set Current Location as 0
S = Stop now!
D = Disable Motor
E = Enable Motor
H = Home (Move to 0)
M = Move to ..(M Dest Speed Accel)
J = Jog until stopped ('J 1' for forward, 'J -1' for reverse, 'J' to stop )
I = Info (show current parameters)
G = Go (start program)
P = Show Program
C = Clear Program
L = Edit Line.  Format: L Line# Dest Speed Accel)  Ex: L 0 2000 3000 1500
      Use 0 for destination and speed to indicate end of program
      Use 0 for speed to indicate a pause.  Dest is pause in milliseconds
R = Set Max Speed
A = Set Max Accel
V = SaVe to EEPROM
? = Redisplay this menu

The controller uses a menu driven interface via the USB connection.  The easiest way to talk to it is though the Arduino IDE serial monitor.  That allows a free, common interface between PC, Apple and Linux,  but most serial terminals would work.  The commands currently work in the unit of stepper motors steps.  It could be easily converted to a real world unit, but at this time it is just easier to use the same unit that the motors use.  My system has 4000 steps per inch.  That makes for a very smooth system.  Extremely slow rates are possible.  It can go 1 step per second at 4000 steps per inch, so it could take well over and hour to go an inch.  You could hack the code to easily drop this by many orders of magnitude.  Each move can have its own speed and acceleration to fine turn the affect you want.

It has several commands to interactively move the carriage around.  This would probably be done to setup the system before the actual “shot”.  These include Move, Home (go to zero), Jog and Zero (define current location as zero).  You can also create a move program.  This allows you to define a couple dozen moves that run sequentially.    These can either be moves or dwells (pauses).  Once the program is entered it can be saved.  This allows you to pre-program the device before you take it in the field.

At power up the motor disables.  This allows you to slide the carriage by hand.  This is handy if you don’t have a PC to do it in the field.  As soon as you make any move or run a program the motors enable.

How it works (programmers only)

The controller uses a timer to run an interrupt function at a regular interval.  The default is 40,000 times per second, but that be be tweaked by changing one program line.  The interrupt function determines if a step should be taken.  If you want to move at 20 steps per second, you allow the interrupt to run (40000/20) or 2000 times before the step is taken.  A counter in the interrupt counts up until it is time to step.  By varying the count on the fly you can create smooth acceleration.  All the math required to smoothly accelerate could limit the interrupt rate, so  the calculation are done once, before the move occurs.  Inside the interrupt is all simple integer counting and a few tests.

 

Source code (Arduino 1.0)

 

 

 

Wiki Page on Slider

Wiki Page on Software

 

Buy one here at the MakerSlider Store

Future Plans

I have several features I want to add.

Drawbacks

Stepper motors draw a lot of power.  I was running my NEMA 17 at 11V and 0.1 amps.  You need a decent battery of 2000-3000 mAH to do a multi-hour run.  Steppers are also notoriously loud.  The camera will  pick up the noise if the mic is close the the motor like on the camera itself.   The motors I have are way over kill and running at less than 10% of their rated current.  I have some NEMA 14 motors on order.  Servo (not hobby servo) motors would be a lot quieter but and lower power, but are more complicated and might require gearing down.

Comments: feel free to comment below or on this forum thread.

Videos