Get the software here:

Video of the software in action:

I’ve had my blue box k40 laser setup with Smoothie for a couple of months now and one thing I couldn’t find a way to do was 3D engraving – varying the power along a line to create different depths of cut. This is normally controlled by a grayscale image where black = full power and white = minimum power.

Visicut is my controll software of choice and has an Engrave 3D mode but it only works for Epilog machines. I couldn’t immediately see anything else pertinent (except PicEngrave which is $$$), so I had a go at putting something together. I call it SmoothCarve:
Screenshot 2016-03-01 13.56.09


It’s fairly basic but, crucially, it does seem to work. Here’s my first attempt (feedrate was too slow, power too high etc., be kind!):
2016-03-01 11.26.16

And a bonus Hackaday logo engraving:
2016-03-01 11.26.29

Basically all it’s doing is scanning the input image line by line, pixel by pixel looking for where the gray value changes. Once it’s established the length of the gray that’s the same colour it produces a G code line to move the head that distance at the appropriate power rating for the gray value. At the beginning and end of each line it moves the head by the defined Acceleration Space at the same feedrate, this seems to give a more even cut than usign Viscut’s 2D engrave mode which starts the powe and the movement at the same time.

Here’s a sample of the gcode it produces (this is carried out in Relative positioning mode) ):

G0 Y0.08
G1 X20 S0 F8000
G1 X7.68 S0.5
G1 X0.08 S0.492
G1 X0.08 S0.5
G1 X0.08 S0.496
G1 X0.08 S0.49
G1 X0.16 S0.5
G1 X0.08 S0.488
G1 X0.08 S0.5
G1 X0.08 S0.473
G1 X0.08 S0.19
G1 X0.08 S0.029
G1 X0.08 S0.057

The current program is written in Matlab, mainly because that’s what I had easily available and am currently most familiar with. Also it’s very easy and fast to work with large matrices in Matlab (it is a MATrix LABoratory, after all). There’s absolutely no error trapping or head tracking to prevent over-runs of the bed. Hell, it doesn’t even check to see if the output file already exists, just overwrites it without warning. It’s not pretty, but as I said it does work.

It’s been a fun little exercise to do. Unless there’s a better solution already out there I’d be interested in porting the code to something a bit more useable (C++ probably).

Anyway, thought others may be interested in seeing the results, never thought I’d manage to do 3D engraving on my K40.

The code is on GitHub under a ‘Whatever the heck you want’ license.¬†¬†

I acquired a a cheap n’ cheerful laser cutter a few months back – it’s one of the fairly popular Chinese K40 models, but it’s controller board (or more likely the USB dongle is uses) was dead. After researching a number of options, it was decided to replace the brains with a Smoothieboard, a great little ARM based board that provides motor drivers, laser control and G-Code interpretation.

I got a 4 axis smoothie (potential to reuse it in other projects…) for about ¬£100 delivered, and over the last week I’ve slowly been fitting it to the machine.

The original machine used ribbon cables to carry X-axes motor power and limit switch data. After several unsuccessful attempts to reuse this method, I ripped the ribbon cable and the optical limit switch boards out and replaced them with new wiring. I now have an articulated cable track carrying the X-axis motor power, and the limit switches have been replaced (temporarily) with mechanical ones.

Yesterday I managed to get the board more or less configured for driving the XY axes, I still need to tweak the motor current and there’s also still a few kinks to work out with homing, scale (steps-per-mm) and motor judder (hopefully just to do with current, but some lubrication could help, too).

I attached a pen to the laser head last night and managed to draw a square – it came out at 101.13 mm instead of 100 mm, but that’s close enough for now – the pen was not rigidly attached so there is going to be some slop in position. I’ll do some test cuts once its up and running and fine tune the scaling.

Once the homing and juddering is solved I’m going to connect up the laser tube to the Smoothieboard and, fingers crossed, it should be ready for cutting stuff! No pictures yet, but I’ll try and remember to take some before it’s finished.

I made some bramble gin to give as Christmas presents, and then used a friends laser cutter with a rotary attachment to engrave the bottles with a nice logo.

Very pleased with the results, and so far the feedback from those who received one has been fantastic! Check out my other site,, for the full details and my wonderfully pretentious description of the gin.

Bottles of Old Railway Gin

Old Railway Gin Group Photo

Screenshot (11)A new project?! But what about all those half finished projects?!

I know, I know. But I have some electronics lab time available at uni, and it has to be something vaguely electronics related and not coursework, and none of my existing projects really fitted. Last year I used it for exploring some MPU ideas using the Arm mbed platform (interrupts are crazy useful!), examining motor controllers for my CNC machine (still on hold till I buy more bits) and so on. This year I decided to use it for one project, and hopefully have a working device by the end of Uni next May.

So, what is it? A 3D printer, of course! But not a filament extruder, a UV resin printer. It’s designed around using a 405nm laser diode to cure the resin, as they cost about ¬£15 instead of around ¬£400 for a DLP projector. I’m hoping to keep the whole build cost to around ¬£100 or so.

Here’s a sneak peak of the XY axis, next up is the motion control part (going for timing belts with tensioners, I think). Enjoy!

XY rendering 02112015

Back in February/March time I bought myself a fantastic 2004 L200 Warrior pick up truck. It’s probably the most impractical vehicle I’ve owned for every day stuff, but my god it’s fun! It’s also been extremely reliable so far, although I have taken good care of it with regular servicing and nipple greasing. It even made it from Edinburgh to Leipzig for WGT, around a 1,200 mile round trip. There has been one thing that’s been niggling at me with winter approaching, though: the cab heater was split and had been by-passed by the previous owner, meaning no heating on those cold mornings that are far too common in Edinburgh.

The first challenge was finding a new heater matrix. Second hand ones, from similar vintage trucks, are readily available for about ¬£20 on ebay. However knowing how much work it was going to take to replace I really didn’t want to put in a part of a similar age, similar duty cycle and likely similarly close to failure. I did fine one guy selling a new part (pattern part, not OEM), for ¬£40, so I got it ordered and it came next day, well packaged and ready to install. It seems good quality, but the supplied screws were too short and I had to reuse the old ones. There’s no inlet pipes on this unit, so I was crossing my fingers that the existing pipework was sound and that the split was indeed in the radiator. Below is a fairly comprehensive guide of how to replace the unit. It’s an incredibly daunting task when you first look at it, but take your time and it soon comes together. There’s a step by step guide below.



How to replace the heater matrix/heater core, step by step

Time required: 12 hours +

Tools needed

  • screwdrivers, long reach will come in handy later (Philips, mainly number 2 size but there could be the odd other one kicking around)
  • sockets: I think I only needed 8mm, 10mm and 12mm sockets. A long reach 10mm will be needed for the aircon units. I didn’t encounter any annoying custom screws or bolts.
  • a plastic shim of some kind to lever out sections of dash without damaging the plastic
  • masking tape and a marker pen
  • Boxes for screws/bolts: I used clip-lid Tupperware and divided the screws into 4 lots: floor console (actually used the storage bin in the console for these), and then one each for each page of the manual I followed for the dashboard.


The first thing to understand is *where* the heater matrix is located. If you sit in the drivers seat and look at the heater control unit in the dash, the matrix is located about a foot behind it, inside a big plastic casing that contains the ducting for temperature and vent control. The only way to get to it is to remove the entire dashboard, there are no¬†short-cuts. Removing the dash is a long process, budget 2 days for it. It can be done on your own (I did), in fact I’m not sure how much help a second person could give apart from at the point of removing the main dash moulding as there’s often limited space and things need to be taken apart in the correct order.

Click Continue for the full step-by-step and pictures!

Continue reading

The CNC project is still ongoing, but summer was pretty hectic studying for exams and so on, and due to being mostly poor I wasn’t able to take things forward at all. It *will* continue, I’m hoping to be in a position to order linear rails within the next few weeks.


I’m also looking into building a UV resin based 3D printer – I’ve ordered a 405nm laser diode and I believe I’ve found a cheap source of UV resin (around ¬£20/litre!). On Mondays I have a 3 hour session with a bunch of other students in the electronics labs at uni. This is an extracurricular lab session to work on personal projects, so I plan on devoting that time to developing a 3D printer design. Tonight I’ll be getting a wee bit of training/guidance with Autodesk’s TinkerCAD¬†from one of our resident 3D printing experts, so that should be interesting. Updates *will* follow. Honest.

2015-03-10 19.04.57

2015-03-10 19.04.57Not much to report at present, real life has been getting in the way again. But the stepper drivers I ordered from China have finally turned up, and I had a chance last night to play with them.

So against all the advice found online, I ordered some TB6600 based drivers from eBay. At the price (¬£11 per axis) I figured it was worth a punt, as even if they’re pap I can sell them back on eBay and at least recoup the cost…

First thing to note is that these PCBs appear to have a different layout compared to the ones I’ve seen discussed on CNC forums. I hoped that it was a newer, better design. ¬†The other boards I’ve seen have all the inputs and outputs along one edge of the board, these ones have the step input control on one side, and motor and power supply on the other.

They’re supplied with 4 brass stand-offs, and a heatsink on the TB6600 chip. Immediately I noticed a problem here: the heatsinks are mounted on the *bottom* of the chips. I know I only scraped through my Thermodynamics class last semester, but I’m pretty sure having the heatsink on top of the chip would be a squillion times better. I plan on replacing the heatsinks with something bigger anyway, either with directly mounted fans or in an air cooled box with the other electronics.I suppose I could even leave the underside coolers on and just add a better cooler to the top side.

Surprisingly for boards from China, these things also came with a data-sheet of sorts, detailing the various limits for inputs/outputs, wiring examples and DIP switch settings. Foolishly, I believed the datasheet and wasted 30 or 40 minutes trying to get the board to respond: the Enable PIN has to be pulled LOW to enable the board, not HIGH as stated on the sheet!

I hooked up the board to one of my steppers, a 30V, 3.5A bench supply and an ARM mbed micocontroller to provide the clicks. My code for the mbed was very rudimentary, all it does is send the ENABLE pin LOW (haha, eventually), Direction pin HIGH and provide a pulse to the step pin every 0.4 Seconds. I thought it best to keep it simple to start with (code used is at end of post).2015-03-10 19.04.47

I grounded all the -ve pins on the input side together and to the mbed, as shown in the data sheet diagram. The input side is opto-isolated so the inputs must be grounded separately to the motor supply.

Plugged everything in, checked all the connections, turned it on and… nothing. Well, almost nothing. The motor¬†is trying to step, but is just wiggling back and forward. I know the motors work (see previous posts for test), and the TB6600 board is responding to the pulse (the LED on the TB6600 board flashes for each STEP command it receives), but I just can’t get the thing to move. I tried a whole bunch of different timings for the stepping, including a 50% duty cycle between STEP and NOSTEP, but nothing worked. The closest I got to making it work was manually touching the STEP wire to a 3.3V source. If I ‘vibrated’ the wire just right off the 3.3V output pin on the mbed I could more or less get the drive to rotate.

I’m a bit stumped now, one of my lecturers and a few other students helped out probing the thing with a scope, and even triggering the scope from the step pulse, but we couldn’t really make head-nor-tail of the output. The coils were definitely bouncing between 0v and +10v (the bench supply was set to 10v at that point), but not actually rotating.


Also tried one of the other boards and one of the other motors, all with the same result.
So what am I doing wrong? Is it a grounding issue? I’ve had odd behavior with steppers before when there was a grounding issue between the driver and the MCU, but that didn’t seem to solve the issue this time. Any advice gratefully received!


Video of the motor failing to rotate:


Code used on the mbed:

#include “mbed.h”

Serial pc(USBTX, USBRX);
// used to communicate with a terminal on a PC – not actually implemented here so can be removed
// Planned to have RPM and direction selectable via terminal, but sadly never got that far!

DigitalOut Enable(p5);
DigitalOut Direction(p6);
DigitalOut Step(p7);
DigitalOut LED(LED1);
int main() {
LED = 0;
Enable = 0;
Direction = 1;

while(1) {
Step = 0; // Set the STEP pin LOW i.e. no step
wait(0.3); // wait for 0.3 seconds
Step = 1; // Set the STEP pin HIGH i.e. make it step
wait(0.1); // wait for 0.1 seconds. Combined wait time gives one step every 0.4 seconds, ie 150 RPM
LED = !LED; //Blink one of the mbed onboard LEDs to use as a visual cue for when stepping should occur

I order some steppers from CNC4You on eBay on Friday, and they turned up today with DPD ¬†(actually it was early: DPD text you a 1 hour time slot in the morning. The guy turned up a minute before the earliest time allowed and we had to stand their awkwardly making small talk until his scanner would let me sign for the package :’D ).

I don’t have the proper drivers yet, but I was desperate to check that they worked and see what they were like. I hooked them up to an EasyDriver board and turned the current pot up to the heady max of 750mA. Coupled with the world’s simplest Arduino stepper sketch, I had working motors!

I’m really impressed with these so far. They weigh just under 1.5kg each, and even being driven with 750mA @12V they produce useful torque. I was totally unable to stall them by hand. This looks quite promising for my machine!

2015-02-19 16.44.08

So I had my first proper welding lesson today, so much fun! Keeping in mind that I had about an hours practice (taking it in
turns between 4 of us) I don’t think I did too terrible a job welding the frame together. It’s not pretty, but it seems rigid and the frame is pretty damn square so I’m happy with it. I’ll grind down the welds next week to make a nice smooth surface or mounting the rails to. I’ve welded up the bottom frame, and two feet/legs for the gantry. Very satisfying work, and I was really getting the hang of it by the end.



2015-02-19 15.42.15Also been thinking more about the toolchain I want to use with this thing. Some of the features of LinuxCNC are very tempting – particularly the addons that allow proper use of a height probe. I’m just not convinced by hav2015-02-19 15.42.28ing to use a desktop PC with a parallel port to control it all. Putting a force air cooled PC in a milling environment just doesn’t seem that sensible, although I am considering a sound-reducing enclosure for the mill so we’ll see. I think I’m going to push ahead with GRBL to start with, and move over to LinuxCNC once I’ve enclosed the mill.





2015-02-19 16.44.22 2015-02-19 15.42.15