Tuesday 31 May 2016

Etching PCBs - populating with components

Once you've got your PCB etched, with shiny exposed copper traces and drilled, ready to accept components, strictly speaking, you're done.

While the board manufacturing process is finished, to make a complete working device, you need to populate the board. And there are a couple of tricks we use when soldering to our homebrew boards.

The first thing to remember is that homebrew boards rarely have a solder resist (you can buy iron-on green sheets, but we've found them to be more hassle than is worthwhile - and they can be relatively expensive). So you need to be careful when soldering your boards.

If you've designed your boards according to our guidelines, you'll also likely have bits of exposed copper between traces. This makes it easier to create accidental bridges between tracks and traces, so care should be taken when soldering.

In the past, we've tried pre-tinning our homebrew PCBs. This simply involves creating a solution into which you leave the bare copper board and after an hour or so, the copper is magically (ok, chemically) coated in tin. This process helps protect the tracks (exposed copper tarnishes easily, while tinned copper remains shiny and bright for longer) but rarely have we found the process to be worth the extra cost, hassle and time.

Tinning power is sulphur-based, so it smells a bit like rotten eggs too. So we don't bother with it any more - with the correct soldering approach, it shouldn't be necessary.

The trick to soldering homebrew PCBs is flux. And plenty of it.

A no-clean rosin flux pen might seem a little extravagant at around a tenner a go. But they make applying flux really easy, and last literally years. Well worth the investment. As Steve might say "quality remains once the price has been forgotten". This is one of those times when it's well worth spending a little extra to make things much easier in the long run.

If you're soldering SMT parts, draw a line of flux across all the pads, in one motion - don't bother trying to pick out each pad or pin; a single sweep of flux should be plenty.

Same with solder paste.
You can try soldering each individual pin on an SMT component, but you're more likely to create bridges across the pins, and make a big blobby solder mess of everything! So our technique is to draw a line of solder paste across the pads.

Messing about creating stencils and applying paste to each individual pad can be very time-consuming.

Far easier, to just draw a single line of solder paste across all the pads

If necessary, you can hold things in place with a blob of blue (or white) tack while soldering. We much prefer this approach than using those clumsy "helping hands"
Blue-tac allows you to easily position and re-position components and wire, and angle them to make soldering easier. It can do everything the helping hands do, but without the extra hassle of fiddling about with lots of little wing-nuts and tightening screws.

It's also great for holding components on the board while soldering the pins.

With the component held firmly, and a squiggle of paste across all the pads, the trick is not to heat the legs of the component to make the solder melt and stick to them - more to "rake out" the excess solder from between the legs. In doing this, the iron tip will automatically solder the legs to the pads on the PCB, while - at the same time - removing any excess solder which might otherwise have caused a difficult-to-remove bridge between the two pins.

So there you go.
That's how we go about making up our PCBs.
It's not the "perfect" way of making the "perfect" board. We often cut corners and don't always use the cheapest nor optimal method. But after a good few years of experience, it's a balance between how quickly we want to get a result, and how much in time/materials we're willing to invest to get the result we're after.

Of course, if we want beautiful, professional looking boards, we could invest the time and effort in tinning and/or applying solder resist. We could create stencils for applying the solder paste and put a bit more effort into the final, finished result.

We could use cheaper materials, cheaper transfer paper, cheaper toner, cheaper etchant, a bubble tank to speed up etching, hot air or a skillet for solder reworking, etc. etc.

But to get a working PCB, we've found this combination of approaches gives the best compromise between speed, cost and reliability. Of course, we'd love to hear your experiences too.....

Monday 30 May 2016

Etching homebrew PCBs - drilling and finishing

Most PCBs have small holes to drill out - usually for vias and/or through-hole components. Once you've made few (hundred) homebrew PCBs, you quickly learn to favour SMT components (even if they are a little more fiddly to solder) - if only to reduce the number of holes needed per board!

The most common sized hole in a homebrew PCB is 1mm.
This is because the holes can be drilled using a number of different drills and drill bits.

An Archimedian hand-drill gives great control, but they can be quite slow to use. Stick a 1mm HSS drill bit in the end and carefully place it in the centre of the pad on the PCB. Hold the collar near the head of the drill in one hand and push down on the "top" of the drill with the other. The Archimedes screw causes the drill bit to rotate quickly, creating the drill hole.

While it does allow for high precision, the hand-drill approach can be very slow (if you have a lot of holes to drill the squeaky noise can become intolerable!). Drill bits as small as 1mm can easily be found.

You can use smaller drill bits, but with a hand-drill they're quite prone to breaking. The thinner the drill bit, the more accurate you need to be in maintaining a perfectly vertical up/down stroke. We've generally found that less than 1mm means lots of broken drill bits!

Our preferred method for drilling is with a Dremel-like rotary tool. These can take smaller drill bits than a hand-drill, since the shank can be as large as 3mm, while the cutting part as small as 0.1mm in diameter.

For these drill bits, you really should use a press, to ensure that the bit goes in and out of the PCB at exactly 90 degrees (even a slight angle can snap a thin drill bit easily).

A drill press is a really handy tool - but can slow down your drilling too. Not quite as much as a hand-operated drill, but can still make drilling slow and tedious. We use something of a half-way house solution; it's a Dremel drill, with a "snake-head" attachment, to allow you to move the drill-head easily, without taking the entire weight of the Dremel.

Without the precision of a drill press, we found any drill bit smaller than 1mm diameter would break too easily. So when we design our circuit boards, we try to ensure that PCB pads are at least 2mm and that hole sizes are up to 1mm.

Once the board is drilled, it's ready to populate with components!
If you like, you can trim the board down further, to make it as small as necessary. With the copper etched and the toner removed, the board can withstand slightly rougher handling than in earlier stages, so we tend to cut our boards to size only after all the other processes are complete.

Now go wash your hands.

If you can bear to use (and can find big enough) latex gloves, by all means use them. Messing about with Ferric Chloride is a messy business. And all too often leaves you with filthy-looking "ferric fingers" that can last for days!

Sunday 29 May 2016

Etching homebrew PCBs - etching with ferric chloride

We use Ferric Chloride for etching. Some people prefer Sodium Persulphate (those white crystals they sell in Maplins which turn blue in water). There are arguments for and against. We prefer FeCl because it's about five times faster for etching than the useless blue stuff.

Some people argue that Ferric Chloride is bad for the environment, so insist on using the weak blue solution. We don't make up our etchant in small batches - we have a small tank of the stuff, so until it's carelessly thrown down the drain with gay abandon, we haven't yet poisoned the earth! Making small batches of etchant encourages the idea of disposing of it at the end of each session.

In fact, it's not ecological ideology that lead us to make a tank-ful - it's actually quicker and easier to have a decent amount of etchant, than messing about with a small tray of FeCl each time you want to make a circuit board.

We've probably all done it with our first few boards - made up a small batch of ferric chloride from those little yellow crystals in a shallow tray, placed the copper board in it, and gently rocked the tray to agitate the solution over the copper.

Well.... forget that!
Etching face up in a shallow bath takes ages. Far better to etch vertically, in warm ferric chloride. To do this, we made up a large batch of the stuff about three years ago (it's still going strong). It's about 3 litres of water with about half a kilo of ferric crystals. It may have been slightly less ferric hexahydrate (the clever name for those crystals) as it was a long time ago! But ours is a deep, dark brown colour (even after all this time and loads of etching).

Poundland provide loads of useful things (cheaply) for making your own circuit boards, from sanding blocks and pan scourers (for cleaning your soldering iron) to these 5L breakfast cereal containers - perfect for holding a good few litres of ferric chloride, and no risk of corrosion!

Far more effective than agitating (or bubbling if you have a bubble tank) is heating the ferric chloride. We've stuck an aquarium heater into our solution and we heat it up to around 50 degrees before use. The thermostat on the heater isn't brilliant, so the solution probably exceeds this at times.

Now, heating the ferric does cause fumes. And the fumes smell bad. And they make you cough involuntarily. So don't breathe them in! We also deliberately kept our fluid level way below the top of the heater - we don't want that thing corroding and blowing up as it's mains powered and could get messy if any of the FeCl got inside that glass tube!

We simply use some twisted plastic-coated wire (it looks like this stuff may have come from some cheap, stiff, CAT5 cable) and wrap it around the copper clad board. If we need to etch two boards at a time, we put them back-to-back in the wire loop.

Then dunk the whole lot into the warmed-up ferric chloride solution

Stick the lid on (to keep the fumes in) and leave for about 5-7 minutes (fewer if, like us, you've bypassed the thermostat on the heater so it's always heating and forgot about the solution until it almost started bubbling, because it got so hot!)

If you're nervous of heating the solution, you can speed up the etching process by lifting the board out completely, then plunging it back in - oxygenating the ferric helps speed up the etching quite noticeably (if you've heated the ferric, just leave it in there and don't bother dunking - in hot ferric, the dunking action can cause the toner transfer to work loose and expose copper you actually want to remain covered).

The camera lens makes the fumes from the tank appear far worse than they actually are! But when this photo was taken, the etchant was still pretty hot - and the board had only been in for a few minutes and was already starting to etch.

During etching, the copper will go a vibrant pink colour, and then the paper/resin board will start to show through - it's usually a slightly green-y colour, tinted by the ferric as it comes out of the etching bath. It normally works quickest at the top of the board, with the bottom part of the design being the last to etch completely.

When all the copper has completely etched, and after rinsing in fresh water, you should see the colour of the board between the traces. Our copper clad board is a paper-and-resin combination and is a vibrant white colour, but most copper clad board has either a slightly green, or slightly orange tint to it.

If there are any traces connected by little bits of left-over copper, just throw the thing back into the ferric chloride and let it rot for a minute or two, until the little scraps are gone. After a visual inspection of the board, and when you're happy the etching is finished, some acetone on a cloth, some wire-wool, or a sanding block can be used to remove the toner from the surface.

And there we have it! Two beautifully etched PCBs....

Wednesday 25 May 2016

Etching homebrew PCBs - transfer

There are a few ways you can transfer your design onto your copper clad board. Our preferred way is using the laser cutter; paint the entire board with matt acrylic car paint, then etch away parts of it with the laser cutter, to create a mask.

But most people making PCBs at home aren't going to have easy access to a laser cutter. Quite often, we don't have easy access to ours (it's at the studio about half-a-mile away). So for one-offs and prototypes, we normally use the toner transfer method.

If you can afford it, Press-n-Peel blue paper is far and away the best medium. It's a powder-coated paper and gives great, consistent results.

We use a cheaper Chinese  alternative - it's a starch-based carrier which is water-soluble. It doesn't give quite as nice results as Press-n-Peel blue, and large filled areas are prone to "pitting". But it's a reasonable alternative to PnP.

One thing that a lot of people ignore is the quality of the toner you're using.
The idea with toner transfer is to get the PCB image onto the transfer paper, then - with heat and pressure - force the toner plastic to melt and re-set so it sticks to the copper clad board. The quality of the toner used is critical to getting good results.

  • The best printer we've found is a Xerox Phaser - the toner has a very high plastic content, melts at low temperatures and offers excellent coverage.
  • We gave our Phaser to the cool kids at BuildBrighton (it was getting to be far too big for the unit) so we now use a small desktop Dell laser printer. It's not as good as an HP Deskjet, but it's passable
  • We used to have a Brother laser printer. Don't even bother with these. Their toner is junk.
If your printer allows it, turn the fuser temperature down to as low as it will go - we only want the toner to stay on the paper for as little time as possible; we're not looking to make good, solid, long lasting images on the paper!

To save using up your expensive transfer paper, print the design on a sheet of plain paper. Then cut out a small square of transfer paper, stick it over the printed design with a piece of tape and re-feed the paper into the printer, to print the design again over the original image.

Cut the edges of the transfer paper up close along two of the sides of the design.

Clean the copper board thoroughly. You can use acetone and a tissue to remove greasy fingerprints,  or rub lightly with wire wool (or even a Tommy Walsh sanding block from the pound-shop) until the surface is shiny - but be careful not to make the surface too pitted. Wipe the surface of the copper down with a lint-free paper towel to ensure no dust or debris remains on the surface.

Align up the cut edges of the design with the edges of the board and hold in place using paper-based masking tape. By leaving a little extra transfer paper along the other edges, there's plenty room for the masking tape to get a good grip to stop it slipping.

Run the board, face up, through a laminator set at the hottest possible setting.
Depending on the laminator and its heat settings, you may need to do this five or six times. Don't always put the board through in the centre of the slot - put it in, off to one side, in case the rollers might "sag" towards the middle.

You can use an iron, but we've found it makes things more difficult than they need to be - the constant lifting and moving of the iron can easily cause the image to smudge. With our laminator (an Alphatec found on ebay a few years back) we've never yet had a smudged image.

When the transfer paper appears uniformly translucent on the back, you're done. For speed, we often quench the  board in cold water to speed up the cooling process. You can do this, or leave it for ten minutes or so to cool down.

After wetting thoroughly, carefully roll back the backing paper from the design. Don't lift it off in one go, or let it "snap" as press-n-peel has a tendency to do as this can easily introduce breaks and/or fractures in the traces.

Remove all traces of the tape used to hold the transfer paper down.
Cut the copper clad board to size, trying to get as close to the edges as possible. If there is lots of copper around the outside of the design, colour it in using a Sharpie permanent marker. All the time we want to reduce the total amount of exposed copper.

You're now ready to start etching!

Monday 23 May 2016

Etching homebrew PCBs - design

One question we're asked - quite regularly, but especially after posting anything with a custom PCB - is how we make our homebrew boards. So we'll do a complete run-down of making a board, from design to printing and transfer, through to etching and drilling.

The first thing is to design the board properly.
For this, we use ExpressPCB. It's not Eagle. It's easier to use than Eagle. But it does a lot of things differently. If you must use Eagle, then use Eagle. But there are a couple of things to pay particular attention to - and very few people do, so play close attention!

First up, avoid square corners.
It's amazing the number of designs available online that use "square" corners.

When performing the toner transfer, you could end up with "weak points" across square corners - this is where the toner might easily flake off during etching, making the traces very thin at the square corner points. It's also easier to under-cut on a square corner than one "rounded-off" with a 45-degree section.

Secondly, use large pads and thick traces.
Those nasty "lozenge" shaped pads in Eagle might look cool - but drill one out of a homebrew board and it's very easy to separate the two parts of a pad with the hole. Make your pads big and round.
We use 2.03mm pads with a 0.89mm hole. Even if we have to go up to a 1mm drill bit, this still leaves plenty of copper around the entire hole once it's been drilled.

We tend to stick with 0.5mm traces for single sided boards. If the traces are going to SMT components (soic or 1206-sized pads/pins) we sometimes go down to 0.38mm. The smallest trace we'd normally try to etch is not less than 0.3mm.

Also, use "copper pour" or "fill plane" where available.

Your finished board might look cool with just the traces on it, but that leaves an awful lot of exposed copper on your board for the ferric chloride to have to etch away. More copper not only means a longer etching time, it also means you're using up your ferric chloride much more quickly than you need to.

A filled plane or copper pour with clearance of around 0.8mm not only gives your board a nice finish, it means far less copper actually has be etched away. Which in turn means faster etching - and in the longer term, your etchant lasts much, much longer.

When making boards for through-hole components, we print our single-sided designs directly from ExpressPCB. This means that when the design is copied onto the copper clad board, it arrives "flipped". But since the design is for the underside of the board, not the top, this is exactly what we want anyway.

When making boards for SMT components, we want the final board to look exactly as it does on-screen. To achieve this, we print our designs from inside Robot Room's Copper Connection software. This does a great job of flipping the design before sending it to the printer - which means after the toner transfer stage, the flipped design appears the right-way-around on the copper clad board.

Shit-faced Shakespeare @theWarren at the Brighton Fringe

For a few years Nick has asked about going to see Shit-faced Shakespeare.
Between us, we're neither particularly well-read in the classics; a million years ago, I once translated Romeo and Juliet into modern-day language (with the story set between the warring families of the Uncle Joe's Mint Ball Factory and Pimblett's Pies up in Wigan). And I could just about remember enough of the Merchant of Venice from a GCSE exam in the early nineties to recount the basic outline of the story.

Which is just as well, as this year, Shit-faced Shakespeare were doing The Merchant of Venice at the Warren as part of this year's Brighton Fringe. So at least we'd have an idea of what should have been going on, even if it went completely off-piste.

As it turns out, it was brilliant. The Warren has been pretty good to us this year, dishing up first Bane and  now this (sadly, the SpiegelTent was less favourable, since the Singing Hypnotist failed to live up to his billing - sure, he may be a hypnotist, and he did, indeed sing. But that's like advertising "the whistling plasterer" and a guy in splattered overalls turns up to do a few bird impressions without ever getting his trowel out - so to speak).

Anyway, back to Shakespeare. We weren't quite sure what to expect, but the clue was in the title. At first, we thought the entire cast would be drunk and before the play started, it was explained that only one cast member had been at the booze. At first this seemed a little disappointing - we'd come to see drunk actors - plural.

But after the first scene, it became apparent just how clever the format is.
Only one of the cast is, literally, shit-faced. Which means the whole performance is chaotic, without ever falling into shambolic. The other (sober) actors keep the play running - delivering authentic, Shakespearian dialogue - while the piss-head causes mayhem.

With the other actors playing it (mostly) straight, yet incorporating the (often nonsensical) ideas of the drunk characters, you end up with something that seems vaguely familiar - yet hundreds of times funnier than anything old Shakey would dare to call a "comedy".

The sober players "riff" off the drunk's part-remembered, muddled dialogue - but each keeping entirely in character (the drunk player may occasionally slip up but the rest of the cast keep everything on track and the play continues without ever losing pace).

For our performance, it was Portia who was pissed.
This was a stroke of genius. It'd be easy to do the play with a drunken Shylock, who could rant and rave and go all Alf-Garnett on us. But Portia was always the true hero of this play. So it as always going to be a challenge, when she turned up drunk in the very first scene (as it turned out, she simply followed the other actors onto the stage when she shouldn't have even been there and tried to pass herself off as "Shylock's whore" as the cast members introduced themselves). And it was all the funnier as the actor struggled to keep in character - Portia is supposed to be strong and decisive, clever and articulate, cunning and curious; all the characteristics you'd traditionally associate with a drunk!

Shit-faced Shakespeare is a genius idea.
Not quite as genius as Bane - but another great performance from The Warren this weekend!

Saturday 21 May 2016

Bruce Bane @ thewarren Brighton Fringe

It's May and that means Brighton is a busy old place.
As well as the Artists Open Houses every weekend throughout May, we've got the Brighton Festival and the Brighton Fringe Festival going on every day.

In previous years, we've seen some real hit-and-miss productions. But we've also seen some interesting shows - stuff that otherwise we probably wouldn't have been exposed to. With the Brighton Fringe, it's a bit of a lottery.

This year - amongst other shows - we got to see Bane
It's a four-part show, but we joined the story in part III. Luckily, a brief synopsis was played out at the start of the performance, setting the scene beautifully.

Simply put, Bane isn't just the best thing we've seen at the Fringe for a long time (if ever - although the blue-men-pushing-barrels-of-fire a few years back was pretty awesome too) it's the best performance of anything we've seen, anywhere, for many a year. It's just incredible.

Yet to describe it is to do it a massive injustice.
A single performer plays all the parts, on an empty stage. No props, no staging, no costume changes. Just one guy playing the parts. And another playing the guitar. Live.

And yet, the performance is mesmerising.
You can "see" every scene - and the performance is played out like a movie; scenes cut quickly from one to another, the plot jumps around, and yet never once are you left thinking "who's that he's doing now?" At every stage in the play, you know exactly what's going on, which character is being acted out, and where you're up to with the story (something that they can't even get right in TV shows like Midsomer Murders!)

As Bane enters the Art-Deco inspired hotel via the revolving doors, you can "see" the entire layout. When we escapes through a window, you can see (and hear) the cars whizzing past on the street below. Joe Bone not only gives every character a unique voice, but puts in a performance so that even without speaking, you know exactly who is who - individual mannerisms, facial features, even just the way he stands or walks across the stage, and you know exactly who he's playing.

And all this is accompanied by an incredible live music track. It's so good, you don't even notice it. Ratcheting up the tension with spooky arpeggios, and driving the action along with rhythmic, thumping chord sequences, Ben Roe plays throughout the entire show with a spotlight - because without it, you'd probably not even notice him!
And that's meant as a compliment.

It's only when you really listen, you realise how clever the soundtrack is.
As Bane enters a lift in the hotel, the plinky-plonky musak is perfect. As the action cuts between a scene set in the kitchen of a hotel, out back, and in the dining area, up-front, the music cleverly goes from quiet to loud, perfectly setting the scene as the action unfolds.

Bane III is the third of a four part story.
After coming out of the performance we immediately booked tickets for the fourth and final part (not only because the play was so well performed, but because the characters we so believable, we just have to find out how it all ends!). And we also gutted not to have seen the first two parts.

Imagine what a live-action Dick Tracy comic would be like.
Not like the shitty Warren Beatty/Madonna film of the late 80s. Imagine a live action comic.
With over-the-top characters. Lots of fight scenes, guns and an all-action plotline. And a flawed, private eye character as the hero. A mafia-inspired KingPin and a gang of hoodlums.

This is all that.
And it just so happens to be played out by a single actor.
But played so well, you just have to see it to understand it, let alone believe it.

So if you're in Brighton on Sunday 22nd May 2016 and can spare an hour and a half at around 4pm, get yourself along to The Warren and see Bane IV. Or check out tour dates on the website (http://www.brucebane.co.uk) It deserves to be sold out every night. It's the best live theatre - probably ever.

Thursday 19 May 2016

Mixing SMT and through-hole components on PCB designs

Just  don't do it.
That's it. End of post.

It's incredibly frustrating to have spent ages laying out a PCB (after redesigning the schematics and re-assigning pins in software) and etch it, only to discover - right at the very end - that you've gone and put the through-hole components the wrong way around!

How's that happened? Here's how:

We use ExpressPCB for PCB layout.
Make no mistake - it's awesome. And this kind of cock-up can be achieved irrespective of your PCB layout software; Eagle, KiCAD and others can all be used innocently, and you still end up with a duff board at the end of it.

Normally we design our boards from the "top down" - placing components as we would with the tracks on the underside of a (single-sided) board. So if our board were to be populated with an IC chip like this:

we'd  also draw our PCB like this:

But if these lines represented the tracks on the bottom of the PCB, and we're looking at them (on-screen) as if we're looking at the from the underside of the final printed PCB, then we really should have pin one on the right and pin 8 on the left.

BUT - here's where it gets tricky. Or at least, can do it you think about it too much. Better not to do too much thinking really (although not enough thought and you'll end up creating a duff board like we managed to earlier today!)

We don't design our PCBs "mirrored" because when we print the design onto our press-n-peel and transfer it onto the copper clad board, the process of transferring it mirrors the design at the same time!

So although we should probably design our PCBs mirrored, we don't. Because the act of transferring the design onto the copper board mirrors it for us. And in doing so, our pin one (in this example) appears not on the top-left (as designed) but on the top-right (where we actually want it).

So far so good.
But then things get complicated.

Because if you want to use surface mount components (particularly IC chips) you really do want to mirror the design. The reason? Well, you're not placing the component "over" the other side of the board and poking the legs through holes to meet with traces on the underside when you use SMT.

With SMT components, you're placing the component directly over the tracks - so you want the final etched design to be the right-way-around. Which means printing it onto the transfer paper mirrored (so when it's transferred, it's mirrored again, making it the right way around).

And that's fine too, if you're designing a board using nothing but surface mount components - because Robot Room's Copper Connection has a print option which will automatically mirror any design before sending it to the printer.

But if you mix surface mount and through-hole components (as we did with this last PCB layout) you have to remember to consistently mirror either all the through-hole components, or all the surface-mount components. It's no good either to mirror a few SMT components, and a few through-hole ones and hope it all works out in the end. It never does.

And we're forever forgetting to mirror either the SMT or through-hole components when laying out PCBs with mixed technologies. Which means, when we make the necessary corrections to our last board, we'll have to reassign some of the microcontroller pins again! Which means the whole of yesterday was a complete waste of time/important learning experience.

In short - mixing through-hole and SMT in the same board design = bad idea. Just don't do it!

Monday 16 May 2016

Don't forget you can re-assign pins with a microcontroller!

Microcontrollers - PICs and Arduino/AVRs in particular - are great for quick and (relatively) easy prototyping. Stick one onto a breadboard, shove in some wires, hack a bit of code together and... ta-da! A working "thing".

Taking it a step further, once you've got your prototype down, is making a PCB.
Now, at this stage, a lot of people dedicate an awful lot of time to copying the pin-connections from the breadboard onto a PCB layout. Though it's almost always preferable to draw out a schematic first; schematics help make sure you don't miss any connections or introduce any dead-shorts - though it's quite a bit more work than going straight to the PCB layout.

With an electrical schematic, laying out the PCB is simplified - the schematic and the PCB layout software usually work hand-in-glove and the schematics can help with the layout, either through auto-routing, or by highlighting which pin connections need to be joined together.

An electrical schematic....

...enables the software to help you with your pcb layout

After spending all that time and effort designing not only a schematic, but a PCB layout, it's very easy to become "committed" to the design, quite early on. And in being so committed, it sometimes results in quite convoluted routing - particularly if any problem traces are left until towards the end!

And after committing so much time and effort, it's easy to forget that quite often your pin numbers aren't actually set in stone. Sure, if you're using an Arduino and some pre-build library (or, indeed a PIC micro and a hardware peripheral) you might be limited to which pins you can use. But sometimes - quite often - the pins are chosen by you, the firmware writer.

And quite often you, the firmware writer, doesn't give much thought to which pin(s) might lead to a simpler pcb layout - quite often you just stick to the pins in the example you've just copied off the internet (come on, don't pretend that's how a lot of us cobble together code when we're looking for a quick win). Or stick to sequentially numbered pins (how many of us start with pin3 for inputs on an Arduino, or count back from 13 for outputs? More than you might realise....)

But it's important to remember which pins you actually assigned yourself, and which you've no control over. Because shifting a few pins around in software can quite often make the PCB layout much, much easier in the long run.

Sure, it's a bit more work.
And if you're the kind of person who doesn't mind long jumper wires, or bits of multi-core tack-soldered to pins on the microcontrollers, maybe just ignore this entire post. But if you're thinking about making a few PCBs yourself (homebrew etching) or even having the boards manufactured, spending that extra time swapping pins is almost always worth it.

It's just one of those things that we tend to forget about.
Or maybe it's just me.

Thursday 5 May 2016

Scrolling text on guitar fingerboard

This was always going to be an experiment. And one that we're not entirely sure would work. But, in true Nerd Club fashion, it wouldn't be the first time we'd invested a lot of time and effort in trying something out without being sure of success from  the outset. That's probably how all the best stuff gets invented anyway. Probably.

Our light-up guitar firmware is pretty much finished. But we've still got nearly 20% programming space left on the AVR. Which means there's still time to shoe-horn in some unnecessary functionality.

So what about.. scrolling text? The idea with this was to have a scrolling message running from the head, towards the body. The text would be made up of simple bitmap glyphs 6x4 pixels wide (6x5 in the case of the letters M and W).

Each character could be described by 5 bytes but since our fingerboard is 6, not 8, LEDs high, we're only interested in the lower 6 bits of each byte.

The letter A, for example, would be described as (binary)


(if you look at this sideways, you should "see" the letter A in the positive bits of the binary values) which in turn is represented by the decimal values 30, 62, 62, 30, 0.

Then a quick bit of VB6 code "read" our font bitmap and produced array values for each letter. The final Arduino code looked a little bit like this:

const unsigned char characters[] PROGMEM =



Which allowed us to recall and display the appropriate pixels in a recurring function call:

// move all previous "pixels" along to the left
for (int i = 0; i < NUM_LEDS-6; i++) {
     leds[i] = leds[i+6];

// now decide which pattern to display on the right-most six pixels
int k=scrollText.length();
if(curr_character < k){
currLetter = scrollText.charAt(curr_character);
currLetter = " ";

// unless we decide otherwise, assume a blank/space character
byte b[2];
int p=b[0];

if(isUpperCase(p)){ k=p-65; }
if(isLowerCase(p)){ k=(p-97)+26; }
if(isDigit(p)){ k=(p-48)+52; }

// get the pattern for the current letter
k=(k*5) + col_count;
curr_col_pattern = pgm_read_byte_near(characters + k);


// now put the current column pattern onto the right-most pixels

for(int i=5; i>=0; i--){
     if((k & 128) > 0){
          leds[(NUM_LEDS-(5-i))-1] = scroll_text_colour;
          leds[(NUM_LEDS-(5-i))-1] = CRGB::Black;

// update the LEDs

After a bit of tweaking and debugging, we finally got our text scrolling along the neck.
Here's a (very) quick demo:

it's quite difficult to read, but if you focus on the left-hand edge of the display, you might just make out the shape of the letters  as they whizz by

The only thing is.... it doesn't actually look very good.
Sure, it might look fine on a small, closely or more densely populated LED matrix. But on a guitar fingerboard, where the LEDs are spaced so far apart (particularly higher up the neck) it just looks like a jumbled mess of flashing lights.

So there we go.
Another Nerd Club fail.
Another load of wasted hours on  something that doesn't work.

In fact, that's not strictly true. It does work. Or, at least, it works - functionally - how we expected it to. It's just not really suitable for this particular task. But that doesn't make it a failure. And, indeed, while quite a few hours went into developing, debugging and making it work, they were hardly wasted. We came up with an idea, executed it, and got the LEDs to flash in the sequence we determined at the start. To come up with an idea and bring it to life is never a waste of time. In this case, it wasn't the execution, but the idea that wasn't suitable.

And at the very start, we didn't know if the idea was going to work. So we built something to test the idea. And the thing worked, and proved that the idea wasn't a very good one. So in just about every respect, this one was a resounding success. Yet, somehow, it doesn't quite feel like a success....

Then again, if you're guaranteed success before you start, you're not actually creating anything; you may as well buy and build Ikea furniture and say you made it yourself!