Friday 31 August 2012

Inductorless wah pedal (coloursound)

Inbetween hacking CNC drilling machines, and almost as a respite from it, we've been busy preparing some guitar effects to show off at the up-and-coming Brighton Mini Maker Faire.
As well as a variation on the earlier Fuzz Factory pedal (made during a BuildBrighton workshop) we've been trying one of these inductorless wah pedal effects -




The final board size is really tiny. This is a perfect candidate for use in some kind of onboard electronics as well as a traditional pedal. Here it is alongside one of our Fuzz Factory boards (wah above, fuzz below):


When we've got it working, the idea is to replace the 100K linear pot on the wah effect (we'll leave the optional volume control out) with a digital potentiometer and use a microcontroller to set the wah intensity. This should allow us a couple of different options for activating the wah -

  • A wii controller would allow us to rock the guitar up and down, using the actual guitar body as the pedal rocker.
  • An ultrasound range finder would allow us to change the wah effect by strumming at different positions along the guitar body

In fact, once we've managed to hook up a microcontroller to control the wah effect, the possibilities are endless!

CNC drilling machine - testing everything

This is one of the most exciting blog posts for a while. After working on the CNC drilling machine as part of the BuildBrighton £50 CNC challenge for a few weeks, we're actually at the point of putting software, hardware, nc drill parsing and motor controller all together and actually trying to cut a PCB.

Actually, we don't have the drill part running yet - but this test shows actual movement, and we've used a laser dot in place of a drill head. But it shows a (sort-of) working CNC machine....


Instead of jumping in at the deep end and trying to draw a complex PCB (the printed pattern on the paper) we started off with a simple square. But as you can see from the video, we deliberately drew (and mounted) the square on an angle, to simulate mounting a PCB on the cutting bed on a wonky angle.

The software takes care of the rotation and follows the dots.
The first few seconds of the video show the machine being calibrated - the software prompts you to place the cutting head over a hole, record this location, then move the head to a second hole. This is what you see as the head travels diagonally across the board at the start (and the slight delay in the finer movement is us changing some parameters on the PC to reduce the jog step size).

The software then works out the cutting path (in this case, a simple down-across-up type pattern) and sets the motors spinning!

It's interesting to note that the cutting head doesn't necessarily follow the "lines" between the dots (if the dots were on the corners of a square for example), since it is a point-to-point machine, rather than a line follower. We'll try to demonstrate this more clearly in a later post.
But for now, sit back and enjoy our first CNC test.

It's not bad. It's not perfect - we need to take out any backlash in the gears (the motors themselves have quite a bit of "slop" on the spindle because of the internal gearing) to get greater accuracy but as an initial test - and particularly the handling of skewed boards - we're quite pleased with progress so far!

Next time we hope to actually cut (or maybe just draw felt-pen dots on) something.....

Thursday 30 August 2012

SOIC to DIP breakout board - SOIC14 to DIP14

After an earlier success with our CNC motor testing, we decided to wind down for the night by making a breakout board for our little digipots from Farnell.

Ideally we were after some 10k digital pots that could handle up to 9v (to try out some digital effects pedals) but the nearest we could find were 20k, up to 16v (most digital potentiometers run up to 5v and we've heard some bad things about using 5v digitpots with a 9v supply). 20k instead of 10k is fine, we'll just use half of the available range (so we'll have 128 steps instead of 256 to play with). All this would be fine, except the chips themselves are teeny-tiny little things! So we had to make up some breakout boards:

Soic to Dip 14pin


These we easy enough to toner transfer (using a laminator, not a household iron) but a bugger to etch! The traces are a tiny 0.25mm so over-etching/under-cutting was a bit of a problem. From four boards (we only made up half of the boards in the design) only one was good enough to use without any doctoring!


Using solder paste and a fine-tipped soldering iron (and some blue-tac to hold everything in place while soldering) we got this little chip stuck down and tested in a few minutes. Sadly it was then too late for any testing, so we'll just have to get this hooked up and tried out some time soon...

Wednesday 29 August 2012

CNC motor testing via USB

There's an often held belief that you can't do CNCs without a parallel port on your PC and cleverly timed move instructions. That may have been the case back in the day, but we've had the nineties guys, USB is all the rage!

So we're building a USB CNC controller board.
We're quite lucky that these cheap little 5V 28BYJ48 steppers have already been stepped down. They're supposed to be 1/64 but inside they're geared down again. There are loads of places all over the internet which say that they're stepped down again by 1/32 - meaning you need 64 * 32 = 2048 steps for one complete revolution.

If that's the case, we should be able to get pretty precise movement, even with a massive gear/cog riding on the shaft, and without having to bother with the complexities of micro-stepping. There's only one way to be sure - and that's spin one around and count the steps!

In-keeping with our NC drill software, we're looking to build a USB controller which we can give a number of steps and have the motor(s) play out those steps. We've no idea at the minute how many steps we may need to move up to (depending on how many steps per revolution these motors actually need) so we've allowed for a 4-byte value to be sent to our trusty 18F2455 PIC microcontroller.

We're using (as ever) a generic HID device interface and sending data in 8 byte packets.
  • The first byte (byte zero) is our "command byte".
  • If the value is one, it's a command to set the x motor step count
  • If the value is two, it's a command to set the y motor step count
  • The second, third, fourth and fifth bytes make up our 4-byte value (0-2,147,483,647)
  • The sixth byte (byte 5) is a direction - one is anit-clockwise, zero (or any other value) clockwise.

After sending the x-axis step count (or the y) the controller board stops all motor activity (since if the motors are spinning when new values come in, the x- and y- axis will go out of alignment with each other, as the earlier axis will be ahead of the later one).

Only once the command byte 254 is sent do the motors actually spin up.
For as long as the x/y step count has a value greater than zero, the motor(s) are given a signal to move them onto the next step. The step-count value is decreased by one each time one of the axis motors steps. Once both motors have a step-count value of zero, a flag is set to tell the PC that the motors have stopped spinning and the head is now in it's correct position.

Here's a video of some early testing:


What's happening here? Thanks to the autofocus on our camera-phone it's not too clear - but if you squint and stand back from the monitor you might see:

Firstly, the command byte (7th byte) is given the value 1 (set x motor step count), along with the second byte (from the right) set to 16. Since our x count is a 4-byte value, we're setting it to 16*256 = 4096.
We repeat these values with the command byte set to value 2 (set y motor step count) then clear the buffer and send the command value 254 to get the motors spinning.

Giving our control board a value of 4096 makes the motor complete one full rotation.
So there we have it. Our stepper motor has a 1/64 step angle, geared down, not by 1/32 as some other forums suggest, but a full 1/64 again. 64 * 64 = 4096 so this is the number of steps required for a full rotation.

The video then skips back to a blurry laptop screen, where we enter the same values, but this time setting byte 4 to 1. This is the direction byte. When this is set to one, the motor spins in the opposite direction.

All in all, we've had quite a successful evening - we've got both axis motors spinning from a custom-built PIC-based USB (HID device) board and some software which we can talk to the board with and get predictable results. Now we just need to remember how to work with Timer1 to create a 20m/s interrupt on the PIC and we can use this to send servo commands for the z-axis (drill up, drill down and motor speed).

Tomorrow is another BuildBrighton open evening.
There's even a slim chance that after the beers and pizza, we might actually get something working......

NC drill file format - origin is bottom left

So far we've been working with screen co-ordinates, with the origin (0,0) at the top left. But when reading/parsing NC drill files, the origin seems to follow cartesian co-ordinates with the origin in the bottom left (like you get when drawing a graph on a piece of paper).

So a quick hack later and our software now starts with the dot nearest the bottom-left-hand corner of the board


It then prompts to move the drilling head to the top-right-hand corner hole


And calculates a cutting path from the current hole (the top-right) back, not necessarily to the origin, but in a way that passes through each hole.


When the cutting head reaches point A, the general rule to follow is "move to the nearest undrilled dot". If we were doing this job manually, we'd probably go from point A to point E, continue working up the board, then move to the left and work our way back down again.

But that doesn't actually follow the "move to the nearest dot" rule. From point A, the nearest dot is point B, so that's the path that's taken. Now at point B, point E is still further away than one of the other, non-drilled, points. So the head moves to point C instead. When it gets to point D, however, the nearest undrilled hole is point E, so the cutting head moves there and continues in a more predictable pattern.

We could probably "iron out" these peculiar movement patterns by looking ahead more than one hole at a time, but that's an awful lot of work for something that we've not even tested yet! For now, we'll live with a few quirks until we've seen it actually drill a PCB board!


Tuesday 28 August 2012

CNC drilling software development

Ever used Mach3 for your CNC machine? Or RouteOut? Or one of those other CNC applications with a myriad of settings so that it can support any type of CNC machine?

If you've ever bought a second-hand CNC machine off eBay or tried to build one from salvaged parts, you know how difficult it is to work out (or guess at) the settings to make it work. Sometimes you end up shoving numbers in and keep tweaking until the actual output sort-of matches the drawing files you give it.

Well not any more....

Not only has Robot Steve redefined simple CNC design, with his awesome push-fit chassis, but this custom-written software is designed to do away with CNC-hardware-related headaches. Simply load a file, manually move to head to a start position (origin), move the head to a second position, then hit go.

At the minute the software can read NC drill files.
Here's the app reading a drill file generated from an Eagle PCB


After calculating the scale and rotation for each point (at the minute we're just working on scale, having just read in an nc drill file) the software runs through each point, creating a "cutting path"


At first, something appears to have gone wrong down the left-hand side. But on further inspection, the software is actually following the simple rule "move to the nearest hole that hasn't been drilled yet".
Because we set the origin to the top-left-most hole then travel to the bottom-right-most hole, the cutting head  should be at the bottom right of our PCB.
From here, it starts with the rule "move to the nearest point" then marks it as "drilled" when it gets there.
Repeating for only holes that haven't been drilled creates the cutting path above.


Monday 27 August 2012

CNC drilling machine first test (x- and z- axis)

After a successful couple of hours at the nerd cupboard, we managed to get Steve's CNC design working in two axes. The test board simply uses buttons to turn a connected stepper motor clockwise and anticlockwise (we've yet to finish our controller software) but proves the concept of moving a drilling head across a gantry and performing a plunge-and-drill operation.



Exhilarating stuff!
We're particularly pleased with the dual-servo control: the first servo is actually an RC motor controller and sets the drilling spindle spinning. Then the z-axis servo plunges the drill head, pauses, and retracts the head, before stopping the drill spindle. (In code we "detach" the z-axis servo so that it is only powered for as long as is required.)

Surely it's only a matter of time before the y-axis (cutting bed) is in place and we're ready to try out some custom software to drill our first board!

CNC drilling software (open source?)

We're still not 100% au fait with the requirements for open source, GNU licences and all that kind of stuff - does everything in the chain have to be open source? Can we use our preferred PIC microcontrollers to make a USB device when the Microchip software and USB libraries are not open source? Does it really matter?

We're blundering ahead with our software, but have hit upon two potential problems - and hopefully workable answers to them:

The first is converting the NC drill file units (mm or inches) into steps on our CNC machine.
Since a big part of our design process is to make the machine easily repeated and built from spare parts (salvaged printers are a great place to get hold of cheap steppers) we're trying to work from the assumption that the end user knows nothing (or very little) about their hardware.

Rather than have the user enter all kinds of values to describe their hardware (or worse still, guess at them) we thought we'd have a simple manual calibration routine at the start of the software. Simply put, the user loads their pre-printed/etched PCB onto the cutting bed and moves the drill head above the top-left-most hole (the software will highlight one if there are multiple possibilities). This will form the origin (co-ordinate point 0,0) for our cutting routine(s).

The software will then find the bottom-right-most hole (furthest away from the origin) in the drill file, highlight it and prompt the user to move the drill head (maybe using the computer keyboard's arrow keys or similar) above this second hole. Using these two co-ordinates we can calculate two vitally important things: scale and rotation.

In the NC drill file we have co-ordinates for every point on the board. Using pythagoras theorum (a^2 = b^2 + c^2) we can calculate the distance R1 between the top-left and bottom-right points. On our actual PCB, this represents the same distances between the same two points. The only difference is the units used to measure this distance.

In the same way the same distance can be described in imperial (inches) and metric (millimetres) by multiplying one set of values by a constant, we can do the same to convert inches or millimetres in the NC drill files into steps on the CNC machine. Let's pretend both images (above) are exactly the same size. Let's say the distance R1 is measured in millimetres, but we want the same distance R2 in inches. We know that 1 inch = 2.54cm and 1cm=10mm. So we can easily compare R1 (mm) with R2 (inches) by multiplying R2 by 25.4 (or dividing R1 by 2.54 to get R2, the same distance in inches).

We don't know what this constant value is to convert our NC drill measurements (mm/inches) into number of steps, but we can calculate R2, the distance the drill head travelled between two points, in terms of steps. Knowing the value of R1 (in, say, mm) and the distance of R2 in steps allows us to calculate the scale between the two. Scale = R2/R1

The great thing about using the first hole as our origin point is that it doesn't actually matter at this stage whether or not the PCB board on the CNC machine is dead square. If the PCB board were not aligned exactly squarely, the difference between these two distances would be exactly the same, since they both describe the radius of a circle with it's centre point at the origin

 So now we've worked out the scale (the constant to multiply our NC drill hole positions by to convert distances in mm/inches into number of stepper motor steps) we now need to work out the rotation of the PCB on the cutting bed

Even if the PCB on the cutting bed were badly skewed, the ratio (scaling) between R1 and R2 would be the same. We know the location of the bottom-right-most hole from the origin according to our NC drill file, and we know the distance of the same hole on the actual PCB in terms of number of steps travelled in both the x and y axis. What we need to do is calculate by how much the PCB has been rotated.

One way to do this is to calculate the angle (from the origin) of the diagonal in the NC drill file (the larger of the three angles above) then calculate the angle from the origin of the current position of the drilling head.
Since we know the position of the cutting head from the origin in terms of steps (we count the number of steps moved in both the x- and y- axes) we can calculate this angle (the green diagonal) quite easily.

Using simple trigonometry:



If we rotate the bottom triangle 90 degrees clockwise, we can see that we've described a right angled triangle, where the adjacent side is the number of steps travelled in the y axis, the opposite side is the number of steps travelled in the x-axis, so tanA = stepsY / stepsX

From here we can calculate the angle of the position of the drilling head from the origin.
Using the same principles, and with the values from the NC drill files, we can calculate the angle between the bottom-right-most hole and the origin (top-right-most hole). The opposite side of this triangle is the difference between the x co-ordinates of the two holes and the adjacent side is the difference between the y co-ordinates of the two holes, so tanA = (y1-y2) / (x1-x2)

Knowing these two angles, we can subtract one from the other to calculate by how much the PCB has been rotated on the cutting bed. Now we know the scaling AND rotation, we can simply apply these to every point in the NC drill file, to get the number of steps needed to move in both the x- and y- directions to reach in point on the actual PCB on the cutting bed.

Apply rotation to a co-ordinate point can be acheived by using a rotation matrix:



What this scary looking equation boils down to is - the coordinates (x',y') of the point (x,y) after rotation are:
x' = (x * cosA) - (y * sinA)
y' = (x * sinA) + (y * cosA)

Given that we know x and y (from the NC drill file) and we've calculated the rotation of the PCB on the cutting bed, we can work out:

xSteps = ( (x * cosA) - (y * sinA) ) * scaling
ySteps = ( (x * sinA) + (y * cosA) ) * scaling

where x and y are the co-ordinates given in the NC drill file.
And all without knowing how many teeth are on the CNC belt, how many steps the motors turn per full revolution or any of that other junk, nor without any headaches lining up the PCB to get it absolutely square and accurate on the cutting bed.

In theory, this provides a really nice and easy to use - if not entirely easy to understand for everyone - way of drilling every hole on the PCB, from an NC drill file, given the user has manually located two holes on the board.

Software design requirements for CNC drill machine

Robot Steve's late entry into the BuildBrighton CNC Drilling Machine competition has in some ways spurred us on and in others caused things to grind to a halt. In some ways, seeing such a simple, usable design has us wondering whether it's worth continuing with our little laser-cut caddy. The main difference between our approach and Matt's CNC monster was simply scale and cost:

Matt came up with a solid (though possibly over-engineered) design using linear bearings, rods and bolts by the bucketload, expensive steppers and belts - basically blowing the budget to create the best CNC type machine he could manage.
We stuck to the cheap-as-possible, easy to replicate route, but possibly at the cost of accuracy (we still don't know if our design will actually create a working, functional CNC machine!)

Steve's design fits nicely in the middle.
With 3d printed parts, built from a 3d CAD-based design, he can see his prototype working (virtually) before cutting or casting a single piece of plastic! Yet with minimum part count and easy push-fit construction, there's no need to worry about bolting plastics edge-to-edge and trying to get everything square. It's a great design.

So is it worth continuing with a slightly shonky design, knowing that eventually we'll probably adopt another in the near future? We'll leave that question, and spend our time constructively on the one aspect that no-one seems to have addressed just yet: software.

The budget allows for the complete build - including driver board/electronics and controlling software.
The easiest approach would be to get a MACH3 compatible driver board, hook up the steppers and run everything through some milling software like MACH3. But this is an expensive way of going about things, so we reckon custom software is the way to go.

Also, we're not drilling or milling blank material. Our PCBs with either already be etched, or have tracks and traces already marked on them, ready for etching. So before we start any drilling, we have to make sure our boards are perfectly lined up to begin with.

In something like mach3 we could do this by moving the drill head to a known position and placing the board underneath it, then moving the head to a second (known) position and rotating the board until this second point fits under the head. With the board in place, we could lock it down and start the cnc running.
MACH3 also has a myriad of settings, belt-tooth size, leadscrew adjustment values - all things which make it quite complicated and daunting to the untrained user. For our software we want:


  • Minimum settings screens - we don't care how big your stepper motor is, the tooth pitch, degrees per step and so on. The software should work with a wide range of machines without any complicated maths/physics calculations!


  • Auto-alignment - placing a PCB exactly squarely on the cutting bed is going to be difficult enough. Cutting the sides square is hard - knowing that you've placed one edge exactly squarely can be hit-and-miss, and if your edges aren't exactly true and straight, getting the whole thing to line up is almost impossible!


  • Auto-scaling for different measurement units - NC drill files are commonly described in imperial (inches) but there is software that uses (and an NC drill command for using) metric (millimetres). The software should be able to handle mm and inches without the need to re-calculate the drill position data in the NC drill file.

We're not worried about making everything open source, complying with GNU licences and all that - we're just looking to create some software that just works (in Windows at least) using whichever tools do the job. Of course, details of how the software is created will be explained, should anyone wish to re-create their own, but we're not ruling out any specific technologies just because it's not "open source" or GNU-a-like or anything like that!

Sunday 26 August 2012

Late entry to the BuildBrighton CNC drill machine challenge

It's a bit late - though not as late as our actual machines are for being ready (they should have been drilling PCBs in time for last August's BuildBrighton Guitar Stompbox Workshop) - but we've had an exciting last-minute entry from Robot Steve.


Steve's taken the simplicity of our design but coupled it with the super-low cost option (and ease of construction) of a 3D printed solution. We think it looks amazing.


Using a servo for the drill plunge, this design keeps things about as simple as they possibly can be. The rails are structural as well as functional (carrying the carriage for the x/z axes) and the tiny steppers are mounted directly onto the moving parts. Rather than mess about with linear bearings, Steve has gone for the simpler (and cheaper) design used in many inkjet printers - greased rails and precision cut nylon blocks sliding along them!


We think the best thing about this design is the relatively low part count. Once you take away the cutting bed (a piece of cheap acrylic or some mdf) and the rails, you're left with a handful of cheaply produced 3d printed parts.


Steve sent over some early prototype photos. It actually looks better in real life!


Friday 24 August 2012

CNC linear rails testing

Down at BuildBrighton tonight, fellow PIC-programmers were in short supply, so with reluctance we had to crack open an Arduino Duemilanove and learn some crazy Arduino coding. It turns out it's not as difficult as it looks (but it does still make you feel a bit dirty).

To get things working, we just wanted to be able to turn a stepper motor clockwise and anti-clockwise. Here's the code we came up with:



int state=0;
int dir=0;

void setup(){
     pinMode(1, INPUT_PULLUP);
     pinMode(2, INPUT_PULLUP);
     pinMode(3, OUTPUT);
     pinMode(4, OUTPUT);
     pinMode(5, OUTPUT);
     pinMode(6, OUTPUT);

}

void loop(){
     //read the pushbutton value into a variable
     int inputVal1 = digitalRead(1);
     int inputVal2 = digitalRead(2);
     
     // Keep in mind the pullup means the pushbutton's
     // logic is inverted. It goes HIGH when it's open,
     // and LOW when it's pressed.
     if (inputVal1 == LOW) {
          // turn the motor clockwise
          dir=1;
     }else if(inputVal2 == LOW) {
          // turn the motor anticlockwise
          dir=-1;
     }else{
      // stop turning the motor
      dir=0;
     }
     
     if(dir!=0){
               // move the motor
               state+=dir;
               if(state<0){state=7;}
               if(state>7){state=0;}
               
               switch(state){
                     case 0:
                     // energise coil A
                     digitalWrite(3, HIGH);
                     digitalWrite(4, LOW);
                     digitalWrite(5, LOW);
                     digitalWrite(6, LOW);
                    
                     break;
                    
                     case 1:
                     // energise coils A+B
                     digitalWrite(3, HIGH);
                     digitalWrite(4, HIGH);
                     digitalWrite(5, LOW);
                     digitalWrite(6, LOW);
                     break;
                    
                     case 2:
                     // energise coil B
                     digitalWrite(3, LOW);
                     digitalWrite(4, HIGH);
                     digitalWrite(5, LOW);
                     digitalWrite(6, LOW);
                     break;
                    
                     case 3:
                     // energise coils B+C
                     digitalWrite(3, LOW);
                     digitalWrite(4, HIGH);
                     digitalWrite(5, HIGH);
                     digitalWrite(6, LOW);
                     break;
                    
                     case 4:
                     // energise coil C
                     digitalWrite(3, LOW);
                     digitalWrite(4, LOW);
                     digitalWrite(5, HIGH);
                     digitalWrite(6, LOW);
                     break;
                    
                     case 5:
                     // energise coils C+D
                     digitalWrite(3, LOW);
                     digitalWrite(4, LOW);
                     digitalWrite(5, HIGH);
                     digitalWrite(6, HIGH);
                     break;
                    
                     case 6:
                     // energise coil D
                     digitalWrite(3, LOW);
                     digitalWrite(4, LOW);
                     digitalWrite(5, LOW);
                     digitalWrite(6, HIGH);
                     break;
                                             
                     case 7:
                     // energise coils D+A
                     digitalWrite(3, HIGH);
                     digitalWrite(4, LOW);
                     digitalWrite(5, LOW);
                     digitalWrite(6, HIGH);
                     break;
                    
               }
               
               delay(1);
     }
     
}




It's a simple state machine - when the motor is turning clockwise, we energise the coils in sequence 1...2...3... etc, when running anti-clockwise we go 7...6...5.... etc

Doing this allows us to quickly and easily make the motor run by pulling an input pin low (pull-up resistors mean the inputs are always high with no input on them).


Here's a video showing the motor in action:

Wednesday 22 August 2012

Miniature CNC drilling machine x-axis carriage

We've had a bit of mixed success at Nerd Towers tonight.
Firstly, we wanted to get our x-axis working on the miniature drilling CNC machine. The y-axis (bed) is easy enough - it's just a plastic bed set on top of an Ikea drawer runner. The x-axis is altogether more difficult, as it's a gantry-based axis (to keep the size/footprint down).

In the spirit of making everything as cheaply and as repeatable as possible, we're using the same rack-and-pinion approach for our x-axis as we have done on the y.
Simply put, a long toothed edge will run along the top of the gantry, and the stepper motor mounted on top of the moving carriage will pull the carriage along by rotating a cog/pulley along the tooth-edged strip.

We've decided on this approach as once the parts are designed and proven to work, anyone with access to a laser cutter should be able to make the same thing from our drawings.
The only thing is, we've drawn most of the CNC by eye - so have no idea how far away from the rails or toothed edge our carriage is going to be. So the first thought was to make an adjustable carriage:


At the bottom of the picture you can see the side section of our carriage. By adjusting the bolts. the stepper motor (mounted on the top of the carriage section) could be moved closer to and further away from the toothed edge running along the top.
After bolting all this together, we found that not one single piece of this carriage had been designed properly so we started the whole thing again, this time with a slightly different approach - "guesstioneering"

It's a term coined one night at BuildBrighton and fits this approach perfectly.
Basically we make something based on a best guess, then whittle things down until they fit.....


This second carriage (in blue) was designed entirely by eye and with no reference to our frame! (if the frame doesn't fit, we can always tweak that, and the carriage together, until they line up and mesh together nicely!)
In this instance, the small cog on top of the stepper motor is neither high enough, nor close enough (laterally) to the toothed edge running along the top.
Instead of messing about measuring and re-measuring and cutting and re-cutting, we just decided to make our toothed edge have a bit more play in it. The idea being that we line it up with the carriage in place and just fix it down!

As we were cutting a new toothed section, we decided to go for a double-sided piece, with the cog on the stepper motor sitting between two rails. Hopefully, this will stop the motor from pushing away from the toothed edge and skipping steps....


The only thing now, of course, is that we need to make our gantry stands about 3mm higher and a little wider on one side (so they're asymmetrical) so that this new piece doesn't look like it's been cobbled together and just shoved on as an afterthought. (it has, but there's no need to advertise the fact!)


This new carriage moves along the rails quite nicely.
There's not much play and hopefully this double-rail approach will eliminate this altogether. Here's a quick photo to show the actual size of the gantry. It's really quite small -


So there we have it. A nice sliding gantry with a stepper motor mounted onto it. It's not quite working under it's own steam just yet, but we can't help but feel that we're getting a little bit closer!
Here's how the final thing will sort-of look in place over the y-axis bed. We may even go crazy and lose the lump of scrap wood for a nice piece of red acrylic. That's the kind of colour scheme that would make Robot Steve have a fit



Tuesday 14 August 2012

Cheap linear CNC rails

Well, our CNC drilling machine challenge is certainly generating a bit of interest, both across the 'net and down at BuildBrighton, our local hackspace.
Nowhere in our "rules" does it state that outside help is not allowed - in fact, we even encouraged other people to get involved - so it was great to have a link sent by one of the group asking if it was of any use. The link was to a laser-cut CNC linear rail on Thingiverse at http://www.thingiverse.com/thing:3554


As we've not really given much thought to our z-axis, we figured we could build this on a gantry over our moving bed (y-axis) to give us an x-axis movement, then simply mount something either on the underside, or on top, overhanging one edge, with a simple raise/lower mechanism on it for the drilling head.

The first job then was to make up the laser cut linear rails:


The carriage bolted together quite easily, and with the cogs and gears held in place by only a few turns of a screw, we thought we'd try the carrier assembly on the rails:


A neat trick we learned (well, it would have been neat if we'd had the proper tools and not spent four times longer than we needed to trying to cobble it together) was to create the holes in the acrylic at 2.5mm, not 3mm, to accept the M3 bolts.
Running an M3 tap through the hole (this is where we needed the proper tap-and-die sent, and not just a single tap and a pair of rusty pliers!) created a lovely threaded hole in the acrylic, so all the bolts held themselves in place and didn't simply fall out when you picked the whole thing up!



The green cog in the centre is the one that will be connected to the stepper motor. As this centre gear turns, it causes the other gears to turn against the rails, causing the entire carrier to move left/right.

All we need to do now is stick the lid on and hook up the stepper motor and we're good to go!

And why the garish green/orange colour combo?
Simply put, they were was the first two sheets of acrylic in the pile.

Sunday 12 August 2012

ExpressPCB to NC Drill files

As part of the CNC drilling machine challenge, one of the things we have to be able to do is parse NC drill files. The idea being that using an industry standard file format makes the machine compatible with a much wider range of PCB layout software.

One of the problems we have is that Eagle sucks.
Yes, that's quite an inflammatory comment but, compared to ExpressPCB, we've seen loads of people have trouble with Eagle-drawn circuit boards.

The first thing is those stupid lozenge shaped pads. And the default hole size seems to be too small. And the pads are ridiculously small. And when you've finally etched your board and drilled it, it's all too easy to ruin a pad because your 1mm drill bit has ripped up all but the tiniest thread of copper left around the pad (right-most-pad, below). One slight wobble with the drill or mis-aligned pad and the whole board can be ruined!


Over at Nerd Towers, we defy convention and refuse to get drawn in to the everyone-uses-Eagle-so-we-must argument. Although it's less of an ideological standpoint and more to do with the fact that it's just so complicated to use when no-one has ever shown you how!

Our tool of choice is ExpressPCB. It's not only free but it's simple to use.
For the hardcore gerber-loving geek crowd, the very things we laud it for may well be it's Achilles Heel too - but it is very simple to use and you can get a PCB thrown together very quickly, all with 2mm pads with 1mm holes (ok, the default is 0.89mm but what's a tenth of a millimetre between friends?). No worring about mirroring, or not mirroring, or which-do-I-mirror before printing for toner transfer - just draw on the top (red) layer and print it out!

To produce PCBs for etching, we usually print to a virtual printer, such as CutePDF and make a PDF file for editing in Inkscape but one thing we recently discovered was the "export to DXF" option


This is quite exciting, as it allows us to generate a file which can be parsed and turned into a drill file. The export to dxf option in ExpressPCB can send just the pad data to a single drawing. Simply loop through the text-based dxf file, find all instances of CIRCLE and write the co-ordinates out to a NC Drill compatible file format!

After a cursory glance at the generated dxf file we can see all our pad data quite easily:


Every pad is a circle entity so we fiddled with a few values and loaded the resulting dxf into Inkscape until we found which entries corresponded to the X and Y co-ordinates. Ultimately it is these values that we'll be interested in to create our own NC drill file.

(comments in the above image were added one we'd identified which values did what, they were not present in the original, generated dxf)

To try out our idea, we picked a circle and set the X/Y to zero and the radius to 4
Interestingly, Inkscape does not position circles from their centrepoint, but from the bottom left corner of the shape. So we expected to see our shape at -4,-4


Inkscape seems to include the stroke (shape outline) width in the X/Y co-ordinates for each shape. So we reduced the stroke width and indeed the X/Y co-ordinates updated accordingly.


We can only assume that with a stroke width of zero, the shape would indeed line up to -4,-4 and thus prove that the values we changed in our dxf file were indeed the correct x,y and radius values.
With this in mind, we're off to write a simple script to convert metric x/y value pairs into an NC Drill file.....


Friday 10 August 2012

CNC drill machine challenge rules

A few people have been asked about the CNC drill machine challenge and it seems that not everyone has access to the BuildBrighton Google Groups page. So here's the preliminary post, outlining the basic rules for the challenge:


After making what felt like millions of boards for the midi workshop, we've decided to make a cheap, little drilling machine for making homebrew boards.
As the discussion went along, we decided to see if we could make the smallest, cheapest machine we could. Almost immediately we couldn't agree about a single thing for our machine, so we've decided to make one each and compare them.

Matt gets loads of stuff cheap off ebay by buying in bulk. 
Chris gets stuff cheap by extracting it from old hardware using hammers.
Matt uses Eagle and could create NC Drill files directly from it to drive the machine
Chris uses ExpressPCB and a convoluted print-to-pdf-then-convert-to- svg method of generating drilling data

Matt wants to make a machine that can drill large, panellised pcbs - double eurocard size (200x160). 
Chris wants as small a machine as possible to fit on a shelf when not in use, and rarely makes boards bigger than a 50 pence piece.
Chris doesn't get the whole open hardware movement and still prefers PIC microcontrollers over AVR. 
Matt thinks an Arduino-based machine would be much more open to hacking if other people used our plans to make their own boards.
Matt can get cheap linear bearings and has experience of making a gantry-based cnc device
Chris thinks he can cobble something together out of ball-bearings and sellotape
The list goes on and on....

So, we've come up with our own hacker challenge. Hopefully this could be the first of many - little projects that we can work on in small groups or individually, then present back to the group.
It would be really cool if other people joined in (or maybe even joined forces) to come up with alternative ideas for this first challenge.

We'd love to see some alternative ideas to make a drilling machine - we've come up with some parameters (it's not really a contest, so it's not fair to call them rules) but here's what we've eventually agreed to work towards. Because it's a machine that we're hoping others will want to try and make (assuming either design eventually works) our first rule is about cost and availability of parts.
It's easy to hit ebay and Rapid and Farnell and blow a small fortune, but that puts it out of reach for a lot of people. Similarly, it's possible to smash open some old hardware and salvage some cool stuff but no-one else might be able to get hold of the same equipment, and would need to find alternatives. So the rules are


  • If buying all new components, not more than £50 on the entire build (just think about it, a cnc based device for under £50!)
  • If using salvaged hardware (stepper motors from old printers, for example) not more than £20 total build cost
  • As we're building a small machine, the footprint of the device, when put away, should not exceed A4 size (210x297mm)
  • But it'd be useless if it could only drill tiny pcbs, so it has to be able to drill up to half eurocard sized boards (100x80mm)
  • Any bought components should be accessible to everyone and you should reasonably expect to be able to purchase the same components from the same, or alternative suppliers 12 months from now (so you can't win a job lot of motors from some bloke off ebay and put cost of materials down as 50p)
  • Overseas suppliers can be used to keep costs down, as their price per unit is often much less than UK suppliers.
  • The device is to be platform independent - it can use any microcontroller and any software can be used to control the machine, including homemade software/drivers. 
  • It has only to work on any one platform, not all
  • For accuracy, the drilling machine should be able to drill a 1mm hole in a max-sized 2mm pad and leave a complete copper ring intact around the hole
  • For building materials, assume a price for acrylic sheets as £1 per mm thickness, per A4 sheet
  • Cheaper alternatives (such as mdf or laser ply) can be used instead of acrylic for the chassis if required
  • Trivial components and the cost of pcb etching, running a laser cutter etc and consumables will not be used to calculate total build cost
  • The price for delivery of all components bought online will be included in the final cost

More rules may be added as the build goes on, but only to clarify any points that may arise, not to act as a restrictive force to deter alternative ideas.

So there we have it. Another stupid challenge that probably won't get finished (or much beyond the planning stages) But there's nothing like seeing someone making more progress on a project than you, to act as a catalyst and get things moving along. So who else fancies joining in?

The prize? We'll use the "best" design for a "proper version" of the machine for use in the hackspace for all members making their own pcbs. Better than money or other tangible goods, you get to win kudos!

CNC drill challenge update

At an epic BuildBrighton session last night, there was loads going on. Including a new design for our CNC drilling machine challenge.

One of the things we're keen to stick to is repeat-ability (the other is, of course, a shoestring budget). So instead of expensive (and as a few people have pointed out, extremely accurate, precision-made) pulleys and belts, we're going all out with laser-cut acrylic and little, cheap stepper motors.

The previous platform we built was nice and sturdy, but during it's construction we came across a little problem. It's not a major problem, and can surely be remedied easily by anyone with the proper tools and a bit of time and effort, but it does stand in the way of repeat-ability. Basically, getting the two runners exactly parallel is a little bit difficult.


If the runners are not exactly equi-distant, along their entire length, the platform "binds" as it reaches the end of its travel in both directions. This isn't really a major project if the length of travel is kept to about half the total length of the bed (in fact, this is about the maximum we're expecting our bed to travel) but there's just something about the fact that it's so easy to mess this part up that we're not happy with.
So we're going with a much easier (and some would say, slightly shonky) design:


It's a single runner with the platform bolted along the centre-line. The single runner can be mounted onto a scrap of wood (exactly what we used here!) and it's not really important how square this mounting is (we mounted it along a centre-line along the wood for neatness, but it's not critical).

The only bit that's really important is getting the gantry mounts on the sides square with the runner.
BUT - having mounted the runner onto the board, the runner is fixed nice and securely. Using a set-square the gantry mount can be placed and fitted from the same side of the board. In our previous design, having to bolt everything together meant lifting the whole assembly up, and this is where things slipped out of alignment.
With this design, it's quite easy to get the runner and gantry at 90 degrees.


With the two gantry supports fitted, the top/cross piece just clips into place.
In theory, everything should be nice and square. Next we need to fit the stepper motors and actually get something moving to see if this design actually works ;-)

One thing that isn't immediately obvious from these photos is just how teeny tiny this little machine is. It's almost comical. In fact, a few BuildBrighton regulars have decided that it's not only comical but unusable - and have already started a book on how long before this design is abandoned and v3.0 started. We'll show 'em....

Buildbrighton drawing machine

Last night's BuildBrighton meeting was pretty cool, with a great turnout, and people actually getting on and making stuff (standing around drinking beer, talking nerd and eating pizza may be cool, but the real cool kids just get on with it!)

Seb was busy trying out his stepper-driven drawing machine.
This is just a proof-of-concept to try out the software and hardware kit, but the final idea is to scale this up and use bike chains/sprockets and draw across a 5m surface!



After a successful test, Seb tweaked the software and started producing some real works of art....


It can even draw images - albeit slightly abstract ones...



No, the machine didn't suddenly start drawing upside-down.
Some of us probably need some remedial how-to-use-your-smartphone lessons. Still, a great looking print, even if the photo is a bit wonky!


Buildbrighton stompbox grinding

Here's Joel from the earlier BuildBrighton Stompbox workshop getting busy with a new enclosure for a variation on the Fuzz Factory pedal we made. The box is actually an old (and he tells us, quite crappy) effect pedal, but with space for four knobs and a nice big stomping area, it's the perfect box to put his modified fuzz factory in.

The first job, of course, is to clean up the artwork and design a custom decal sticker. Joel attacks his enclosure with a wire brush mounted on an angle grinder....



Showing us how to do it properly - note the dust mask and safety goggles

Sunday 5 August 2012

BuildBrighton Guitar Stompbox Workshop

It's been a long, exhausting, but ultimately satisfying day, after running the BuildBrighton guitar stompbox workshop today. There was a sell-out crowd (plus a couple of last-minute attendees, squeezed in on the day) and we had a fantastic success rate - of 12 boxes, 10 were (eventually) working by the end of the workshop!


The boxes were based on the Dallas Fuzz Factory schematic, with a couple of tweaks. Firstly, as only two pots were to be exposed on the box (drive and volume) the others used were trimmer pots (compression and gate) so each person could create their own unique sound and capture it inside the box!

Fuzz Factory Schematic

As well as making the circuits on stripboard, everyone had a go at drilling their alloy enclosures in the BuildBrighton "dirty workshop" as well as fitting all the hardware and wiring everything up.



As well as creating a circuit board from the schematics using stripboard (veroboard), everyone had to wire up all the pots, footswitch and sockets and it was amazing to get ten fully-working pedals after about six hours hard work!


Jamie Matthews was the first successful candidate to rock out with his fuzz pedal

Note how you hear the tone/flavour of the pedal changing as Tom tweaks the compression and gate trimmer pots. These pots allowed us to tailor each pedal without having to swap out lots of different components

It didn't take long for others to follow:


Though not everyone was successful on their first attempt. Jon (in this video) actually managed not only to make a crackly pedal, but a direct short across the drive pot terminals in this pedal actually caused it to smoke (shortly after this video ended). When a tiny flame appeared, it was decided to replace his pot and capacitor, just to be sure!


Not so much smoke on the water as "smoke in the pedal"

But it was great to see genuine smiles break out - the real ones that you just can't hide - as more and more pedals fuzzed and buzzed into life


For that authentic rock sound, we were using 2 x germanium transistors in each pedal. Germanium transistors are not as stable nor consistent as silicone ones, so some have a higher gain than others. Real pedal enthusiasts have been known to sit and try out loads of different transistor combinations, to get that "just right" tone. We included sockets for our transistors to all people to do this if they wanted. As time was tight, Jason spent a few hours testing all our germanium transistors and sorting them into (relatively) high and low gain. We used a low gain for Q1 (see schematic) and a high gain for Q2.

Joel, from GAK specifically asked for two high gain transistors to make  really "hot" pedal. You can hear his pedal going crazy when pushed to the top end of the range 


Here's the documentation that everyone was following. Use it to create your own fuzz-factory clone!

Stompbox Workshop