40W CO2 Laser Engraving and Cutting Machine

So my old DIY laser cutter was a great experiment, but unfortunately the laser just wasn’t powerful enough, so I brought a new one.

It’s a “40watt” laser, and it’s pretty much the cheapest of the cheap. There are numerous problems and safety concerns with the product, but providing you’re not silly then nothing should go wrong.

After unboxing my cutter, I was disappointed in the build quality. But then, what was I expecting for a product that cost almost as much to ship as it actually cost…. and for less than £400 (all in) it’s a bargain. It took a while to get working, mainly due to the fact that it didn’t home correctly, which meant some investigation work with my multimeter. After finding the offending broken wire and bodging a repair, it was working OK.

40w laser cutter

40w laser cutter

The software was pretty easy to use, and I was up engraving and cutting within an hour or so of aligning the mirrors (yes you need to do this yourself). It’s a little bit Quirky, but for the money you can’t complain.

Some future mods will include,

  • Air assist,
  • Water temp and flow rate sensors,
  • New extraction system,
  • Increasing the cutting area.

Gamma correction on RGB LED’s (or something like that).

So today I’ve been working with some RGB LED’s once again and I’ve notice (or rather re noticed) how non-linear LED’s appear.

A bit of background: I’m working with 5050 type LED’s with ws2803/1 drivers, so each LED gets 8bit PWM for Red, Green and Blue LED’s. The problem is that when you drive the LED’s with signal, zero is off, and 255 is the brightest, but 128 is brighter than half brightness. So in fact the input data to the perceived output level appears to be non linear.

So I could just work out a mapping of input values to output values, but that’s not very smart is it… I could use some primitive squaring to obtain a kind of gamma correction, of I could use some Maths (yes Maths is Maths and not Math!). The only problem there is that my ability to create a complex but awesome function way surpasses the abilities of the Arduino I’m using to drive the LED’s. Might have to get creative on this one…

Anyway here’s some LED’s to keep everyone happy,

Learning verilog….

So it’s not as bad as you first might think. It turns out that real time logic isn’t much different from process logic. Tho I did fall at the first hurdle:

So apparently the file name has to be the same as the entity name and that needs to be the top level entity. Furthermore the module inside it needs to have the same name also.

oh, and ‘end module’ is actually ‘endmodule’, or it will fail to compile!

(This is in QuartusII FYI.)

Laser cutter update

So here’s a little update on my laser cutter,

I’ve moved over to a pre-written firmware, as writing the code for Arduino to receive and interpret the g-code was getting boring and why re-invent the wheel?

After a few mins of tweaking and some time using Inkscape to make the G-code, this is what I’ve  progressed to….

A primitive cut on my laser cutter - still needs some work.

A primitive cut on my laser cutter – still needs some work.

Still need to work on the focus and the speed settings.

Testing two axis stepper control on two A4988’s

So last night I breadboarded the two driver circuits and wrote some simple command line style Arduino Sketch.

Here’s the code,

#define stepPin 2
#define dirPin 3
#define enablePin 4
#define stepPin2 5
#define dirPin2 6
#define enablePin2 7
int incomingByte;

void setup()
{
pinMode(enablePin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
digitalWrite(enablePin, HIGH);

pinMode(enablePin2, OUTPUT);
pinMode(stepPin2, OUTPUT);
pinMode(dirPin2, OUTPUT);
digitalWrite(enablePin2, HIGH);
Serial.begin(9600);
}
void loop()
{
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// up
if (incomingByte == ‘U’) {
digitalWrite(enablePin2, LOW);
delayMicroseconds(10);
digitalWrite(dirPin2, HIGH);
for(int x=0;x<3200;x++){
digitalWrite(stepPin2, LOW);
delayMicroseconds(2);
digitalWrite(stepPin2, HIGH);
delayMicroseconds(80);
}
digitalWrite(enablePin2, HIGH);
Serial.println(“Moved up”);
}
if (incomingByte == ‘D’) {
digitalWrite(enablePin2, LOW);
delayMicroseconds(10);
digitalWrite(dirPin2, LOW);
for(int x=0;x<3200;x++){
digitalWrite(stepPin2, LOW);
delayMicroseconds(2);
digitalWrite(stepPin2, HIGH);
delayMicroseconds(80);
}
digitalWrite(enablePin2, HIGH);
Serial.println(“Moved down”);
}
if (incomingByte == ‘L’) {
digitalWrite(enablePin, LOW);
delayMicroseconds(10);
digitalWrite(dirPin, LOW);
for(int x=0;x<3200;x++){
digitalWrite(stepPin, LOW);
delayMicroseconds(2);
digitalWrite(stepPin, HIGH);
delayMicroseconds(80);
}
digitalWrite(enablePin, HIGH);
Serial.println(“Moved left”);
}
if (incomingByte == ‘R’) {
digitalWrite(enablePin, LOW);
delayMicroseconds(10);
digitalWrite(dirPin, HIGH);
for(int x=0;x<3200;x++){
digitalWrite(stepPin, LOW);
delayMicroseconds(2);
digitalWrite(stepPin, HIGH);
delayMicroseconds(80);
}
digitalWrite(enablePin, HIGH);
Serial.println(“Moved right”);
}
}
}

It receive’s a letter, U, D, L or R and moves the respective stepper motor one turn in that direction. Trivial but it’s a step forward (hehe).

While doing this I’ve had to learn a lot about how the Arduino handles power and how the power pins actually work. Feeding 5v into the 5v pin turns out not to be a good idea. A better thing to do (arguable the proper thing) is feed 12v to the Vin pin and use the on-board regulator. This also (I believe from the schematic) disables the 5v from the usb from the Arduino (meaning I don’t feed 20a into my USB port :D). One annoying thing I’ve noticed is that the Vin pin will output a voltage while running on USB. there is no protection diode on the Vin bus – there is a diode between the 2.1mm input jack and the Vin but tho.

Onwards and upwards I’ve also made a board up to hold the drivers and have output’s and things all nice and tidy, with pins for Vin, gnd, Vout and 5vin and GND to the Arduino, and then 2 6 way headers for stepper control and 2 4 way headers for the stepper motors. Here’s what it looks like now:

New driver board

New driver board (the breadboard is just a 5v rail while I change the code to use different stepping methods)

Next steps will be to continue working on the code , Might move to an Arduino Mega so i can use a touch screen too.

16th stepping stepper motor with A4988 driver carrier from Pololu

So in an effort to control the stepper motors more accurately I’ve invested in some Pololu Stepper motor driver carrier boards. This gives 2 advantages over a traditional H bridge arrangement,

  • Micro stepping,
  • Current limiting.

Using the diagram from here but with a few changes, I pulled ms1,2,3 to high to enable a resolution of 16 microsteps, and wired it to an Arduino for control.

#define stepPin 2
#define dirPin 3
#define enablePin 4
void setup()
{
pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, HIGH);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
digitalWrite(enablePin, LOW);
delayMicroseconds(10);
digitalWrite(dirPin, HIGH);
}
void loop()
{
digitalWrite(stepPin, LOW);
delayMicroseconds(2);
digitalWrite(stepPin, HIGH);
delayMicroseconds(80);
}

this simple code allowed me to achieve around 3.8 revolutions per second, or ~230rpm. Which is a lot more than in full stepping mode without jumping.