Tuesday 30 June 2015

Hall sensors and cascading shift registers

Having just taken receipt of a load of PCBs from 3pcb.com, it was a nerve-wracking couple of hours as Nerd Towers until we found time to actually solder a few up and try them out.

There was nothing to be gained by testing just one (except, perhaps, to confirm that we hadn't done the usual trick of forgetting to connect all the ground connection points together!) since all the boards share a common latch and pulse pin, and data is supposed to be cascaded from one board to the next, via the serial clock and data pins.


The boards soldered up really quickly and easily - just smear some solder paste across the pads (in a sort-of "slug trail" across them, rather than messing about trying to put a dot on each one individually) then touch the pointy tip of a hot iron to rake out any excess between the legs. Same with the surface mount 1206 resistors - a touch of paste on the pads, place the component, touch with a hot iron, fixed. Each board took just a few minutes to complete (solder resist makes such a massive difference, compared to soldering home-made boards!)

The boards were then connected together using a bit of IDE ribbon cable (a bit of forward thinking and we might have set the connecting pins at 0.05" pitch instead of the standard 0.1" and using ribbons cable would have been a doddle).

Although it made us feel dirty, we put together a rough-and-ready, using an Arduino and the IDE serial monitor, to make sure that the boards were working as expected.

All the inputs on the PISO (parallel in, serial out) shift register are pulled high through onboard pull-up resistors. When a magnet is placed near each of the hall sensors, the appropriate shift register input is pulled to ground by the hall sensor.


(at the minute we're just spitting out the raw data from the shift registers as the input pins change, but it's a trivial matter to update the firmware to make it report much more user-friendly messages, like "board A square 2, piece placed" or "board B square 7, piece removed")

So when the device boots up, all inputs are reading 0xFF (255 in decimal)
Where in the video we see board A input value go to 251, this indicates that the input pattern on the shift register pins is now 11111011 (just from the binary value we can see that one sensor has been activated).

So whenever a playing piece (with a magnet in the base) is placed over a hall sensor, the input pin goes low. Similarly, when the piece is lifted away, the input pin goes high again (and in our example, the shift register input value returns to 0xFF - or 255 in decimal).

The important part of the testing here was not just to make sure that the hall sensors were working as expected (they were) but also to be able to distinguish between the inputs on each board piece - this is proven to be working, as the firmware correctly reports the input state on boards A and B only when their input pin values are changed. It's worth noting that, in the video, only board A is connected to the microcontroller - board B is connected to board A, cascading data via the shift register(s) on each board.

In short, a successful test.
It looks like we got the PCBs right after all!

Monday 29 June 2015

More PCBs arrived from 3pcb.com

...and don't they look smart?


A boxful of PCBs arrived earlier today. And they look great! Well packaged, well ahead of schedule, and no duty to pay!


This is something we're going to have to look into quite carefully - assembled electronics obviously have a VAT element to them when they are brought into the UK (the value-added element that attracts Value Added Tax is that someone has done the work of putting a load of components together for you). PCBs don't attract a VAT element (I remember reading about this somewhere online a number of years ago) but electronics components (such as the 250 shift registered just ordered from eBay) do.

I'm not quite sure where the value-added element of a bunch of shift registers is, to make them liable for VAT. But liable they are - according to DHL at least (and they deal with this kind of stuff all the time, so you've got to assume they're applying customs and excise duty correctly).

Any way, not only do you have to pay VAT on some imported goods, but the handling of that VAT also attracts a handling charge from DHL (to which they add their own VAT). So it suddenly makes a cheap online deal look not-so-cheap!

In future, we'll bulk buy from a single supplier in a single shipment - then we're not only paying carriage once (even if it's more expensive for a larger parcel) but only paying the VAT handling charge once too!

Sunday 28 June 2015

So what's with all these double-sided boards anyway?

We're not normally a fan of double-sided PCBs.
The problem with them is they're a pain to make - not if you're a cool PCB fab house, but if you're a bunch of nerds with nothing more than a laser printer and some ferric chloride, getting a decent double-sided PCB can be a real pain. Normally we stick to single sided designs, use manual routing (rather than some, let's be honest, pretty crappy auto-router) and every now and again stick a surface mount 0R resistor in, to act as a jumper over single trace tracks.

That works fine for most projects.
Even when we get PCBs manufactured professionally, we try to stick to single sided designs. It means we get a chance to prototype the board before committing the design and getting a batch made (Steve knows only too well how often we end up with a ground plane missing, or a single connection - usually to somewhere important like the regulated 5v supply - completely forgotten about, because on the prototype we just cobbled in a bit of wire).

Single-sided boards also mean that if the layouts are published here, anyone else can have a go at creating the same thing - not everyone is willing to waste hours and hours and quite a bit of relatively expensive material, trying to get a double-sided design to work (and who can blame them!)

But this time we're adamant on a double-sided design. So why is that?

Well, we're back to our electronic board game idea. We've tried any number of different manufacturing methods, including (but not exclusively limited to)

  • each board section being made up from smaller PCB sections (makes the squares on the board too small or close together, and altogether very expensive to make a decent sized playing surface)
  • one massive PCB per playing surface (very, very expensive!)
  • multiple PCBs connected on the underside of a large playing area (no less expensive than a massive PCB, with the added hassle of having to connect everything together)
  • using large membrane switches instead of PCBs for the playing surface (too expensive)
  • using multiple small membrane switches (where the connectors go to the underside of the board, the playing surface is distorted) 
  • eliminating PCBs and wiring hall sensors to a number of microcontrollers on the underside (not nearly as expensive as having PCBs or membranes manufactured, but very time-consuming to construct)


From these main approaches, the pcb-free idea (running wires up and down the board and attaching hall sensors to them) is the cheapest. It's also the most complicated and time-consuming to build.

So we're looking for a short of half-way house. We're trying to build the smallest possible PCB to hold the maximum number of hall sensors and a shift-register (so that the PCBs can be daisy-chained to a single, central microcontroller). This should reduce the build cost (since we don't have large, vast expanses of PCB "real estate" standing empty) as well as the shipping costs (for the same reason). But also simplify the construction.

Of course, each piece still needs to be wired to the next in the chain, so it's not completely work-free. But it's a compromise between the massive amount of work needed working with just wires and the massive cost of working with just one big PCB.

Perhaps the answer lies somewhere in the middle.........


Wednesday 24 June 2015

When making PCBs...

....do you drill first, or etch?
Interesting to see that 3pcb.com do all their drilling first, then etching. We tried that when making double-sided boards and 50% of the time it worked ok, and 50% of the time it was a massive fail.


3pcb.com run a 24-hour PCB factory. Check out those manufacturing start times - they're running right through the night. And what a nice touch, showing where you board manufacturing is up to, at any point, through their website.

Then again, I guess a professional PCB fab house isn't lining up sheets of toner-transfer paper, by hand, to make their circuit boards. Or at least, I'd rather hope they weren't!

Tuesday 23 June 2015

More circuit boards from 3pcb.com

After proving that our simple double-sided board design does actually work, it was time to "pull the trigger" and get some on order from 3pcb.com

3pcb is just another name for pcbway.com and both websites use what looks like the same calculator to give the same price (the pcbs arived last time in pcbway.com branded boxes, but 3pcb is just easier to remember!)

I don't know if it's deliberate, but - like those 3 for 2 deals at the supermarket, or those 24-packs-of-crisps-for-the-cost-of-15 - their calculator seems to encourage you to over-buy. For example, 100 PCBs costs the rather reasonable price of $53 (including delivery don't forget).

But when you see prices like that and realise that set-up charges and delivery make up a large part of the total order cost, it's tempting to see how much more you can get for your money. 200 pcbs is only $78 - that's $25 more for double the volume....

So what if we rack up the numbers? A thousand units costs $260. That's a lot of money - but that's a helluva lot of boards! In the end we settled on 500 pcbs for $159. It's probably more than we're going to need initially, but since we're using them in multiples of 20 at a time, they won't last too long!


The 3pcb.com website is dead easy to use. Enter some values, if you like the price, upload some gerbers, pay by paypal. Bang - done in less than ten minutes.




There's even a detailed beakdown of the fabrication process available on the website. Because this order has only just gone in, there's not much there at the minute. But as the boards get built, you can track them in realtime and see which part of the manufacturing process they're up to. So you can see when they've gone in for etching, when the soldermask has been applied, when they've been routed and so on.

It's not really very useful information (you can't influence what's going on!) but it's nice to see so much effort has gone into keep the customer informed. We'll report back here in about a week or ten day's time when they finished boards arrive....


Sunday 21 June 2015

Etching with ferric chloride - hot versus cold

Our etching heater packed up today. In fact, it's not the first time it's happened; the previous time, it turned out to be the bimetallic strip was getting stuck and not turning the heater element on when it was needed.

This time it looks a little more serious - we've not been able to get it to come on at all. Which means etching with "cold" ferric chloride.

Now ferric chloride doesn't need to be heated in order to work. It'll still etch copper off a copper clad board. But it does take a lot longer - it's amazing the difference the heater makes. We're only etching a couple of SOIC-to-DIP breakout boards (albeit with a slightly unusual pinout)


Usually, a simple board like this would take less than five or six minutes in a 3L tank of (heated) ferric chloride (at about 40 degrees C). But this board has taken more than 20 minutes - and it's not even "fully etched" it's just about usable (we couldn't be bothered waiting for it to finish properly, to get nice neat edges).

The problem with cold etching, and leaving the board in the etchant for a longer period of time, is it's more likely to suffer from undercutting. So we've made the traces on this board a massive 0.5mm (instead of the usual 0.3mm which still feels quite chunky, even when etched "hot").

While cold etching works for very simple boards, there's no way we'd have been able to make our double-sided efforts, with their tiny-pads-for-through-hole-vias if the boards had to stay in the ferric for more than twenty minutes at a time.

We're not sure if this heater can be salvaged and repaired. But if not, it'll mean another trip to eBay - there's no way we can etch many more boards using the cold solution and expect to get usable results. Already the odds aren't in our favour - we're using a less-than-ideal printer and cheap chinese press-n-peel-alternative paper. Add into the mix a less-than-ideal etching method, and it's a wonder than any of these circuit boards work at all!

Saturday 20 June 2015

Double sided PCB with toner transfer (chinese press-n-peel alternative) success!

Well, success, sort-of.
Maybe that should be a caveat on homebrew PCB manufacturing. Everything "sort-of" works. Or, at least, on this blog anyway, with all the short-cuts and penny-pinching and not-always-using-the-best-tool-for-the-job, but making do with the cheapest....

You get the idea. It's taken two evenings and a few sheets of copper board and toner transfer paper to get the result, but we got there in the end. As Steve might say, it's a bit pikey - but it works! Of course the way to get the best result would be to email the design files over to a PCB fab house, wait anywhere between 5 and 15 days, and try out the professionally produced, exceptional quality circuit board.

But that's not what home PCB manufacturing is about. At least, not here at Nerd Towers anyway! We're about getting something that works. Soldermask? Pah! So what if it makes it a nightmare to solder? That's part of the fun, right?!

Anyway, thanks to some suggestions from Jason (and later, Steffen) and after discovering some cool functionality in the Copper Connection software we use for making Gerbers, we managed to successfully etch a double-sided board which lined up enough to be usable. So in our eyes, that's a success, right there.

First up, getting rid of the printing problems:
It was actually quite straightforward. Instead of just dumping ExpressPCB to Gerber using Robot Room's Copper Connection, we downloaded the latest version and were delighted with the printing options.


The transfer etch option prints out two sheets (for a double-sided board) with the top-most layer mirrored. This means that after transferring, the top layer is the "right way around" and the bottom layer is flipped - exactly as it needs to be. No need for exporting to PDF then flipping in Inkscrape and trying to work out which layer needs to be flipped, and messing about to get it to print properly by converting to a bitmap and all that nonsense - just hit print and let the software do the thinking for you!

Jason's suggestion was to draw a border around the PCBs on both top and bottom layers (obviously making sure they're perfectly aligned in the drawing!). Then, from the carrier sheet - after printing - cut a template and place onto the double-sided copper board. Using the template as a guide, drill holes in each corner, outside of the border.

This does mean that the PCBs are in the centre of the copper clad board, with quite a wide border around their edges (something we try to avoid, in an attempt to reduce waste and get our designs as close to the edge as possible). For now, we'll just take the extra waste as a hit, in preference for nicely aligned boards!


After drilling the marker holes, place the press-n-peel on both sides of the copper clad board at the same time, carefully aligning the edges of the paper with the guide holes.


We're using paper-based masking tape to hold the paper in place; Jason recommended using an iron to "tack" the paper in place before sending through the laminator.


Laminate as normal, fixing the toner transfer paper to both sides of the copper clad board at the same time, and etch. Keep everything crossed until the very last bit of excess copper has gone, shut one eye, stick your tongue out to one side, chant a mantra and do a little dance. Then drill through the holes and hope they line up.......


Don't look too closely, else you'll see a lot of holes are off-centre. In fact, before drilling it was possible to see that the back and front didn't quite line up. So instead of drilling exactly in the centre of the holes on one side and potentially missing the centre of the pad on the other (or, worse still, drilling through the middle of an adjacent trace) we actually deliberately drilled off-centre. The result is a board that looks pretty crappy on both sides - but functionally does what it needs to do!


And there we have it. 
Success. Sort of.

Well, not perfect, but good enough to be usable.
And, as stated at the top of this post, for us, that means success.

Wednesday 17 June 2015

Double sided board fail

Creating double-sided PCBs using toner transfer is never easy.
Getting both sides lined up exactly, while etching one side and protecting the other during the first part etch is a real pain in arse. At best, you can hope for boards that are "basically useable" but very rarely (only twice in my experience of making PCBs over about a hundred years I think) do you get a "perfect" board.

But this time, we've had a spectacular fail.

It's probably related to the Inkscape printing fail earlier, because this time not only did the two sides not line up (we could live with that at put it down to ham-fisted sausage fingers) but they're not even the right size!

Here's the first side of the board. Compared to the actual 16-pin soic component, it's the perfect size

(using the ExpressPCB-to-PDF-to-Inkscape-to-PNG-to-DTP-to-printer method, finally managed to get the pcb design onto the copper board via cheap chinese press-n-peel alternative (the bad etch in the far corner is where the board was handled before it went into the ferric chloride - d'oh!)

But on the reverse....


The print just about lines up with the first set of holes. Not perfect, but useable.
But by the time we get to the other end of a 100mm long PCB:

(the bad trace leading to the first hole is where I wiped the board with my wet finger to see if the print was misaligned, or just some debris on the board. It turns out it wasn't crud on the board!)


Not even close!
Frustratingly, the offset between the holes and the printout aren't even the same distance apart. So if the whole image was shift (as you look at the image above) slightly from the right to the left, then the holes at the other end (in the image before the one immediately above) would be too far out the other way.

If the whole thing was shifted, there's no way we can see of making this a "perfect" match. It's almost like the image needs to be printed at 101% to space the holes further apart.

Of course, it's not just these holes we need lining up. Throughout the board are much smaller, 0.5mm holes, to act as vias (in the event of a perfect line-up, or even a "good-enough" match we would normally just solder wires through these instead of messing about trying to plate through from one side to the other).

There's no way we'll be able to get our double-sided board working if this is as close as the two sides line up! So is the problem with Inkscrape, converting pdf to bitmap, or something else? Maybe one of the BuildBrighton lot have some ideas about double-sided boards........

Inkscape strange printing errors

Here's something new. While preparing to have a go at some double-sided toner-transfer pcbs, we used "old faithful" ExpressPCB to create some layouts and printed to PDF (using CutePDF).
Then loaded the images into Inkscape, and flipped them (since we're making boards for SMT components, we have to flip the image so that it transfers the right way around)


So far so good.
But when printing from Inkscape, the actual printed paper doesn't quite look right.


At first glance it appears that some of the tracks are missing. But when you look a bit closer, you can see the tracks are there - just really faint/thin. So Inkscape is using an incorrect stroke thickness. But more than that, it's also lost the white background that isolates the trace from the filled plane.

But if you look closer still, even if the tracks were the correct thickness, and were drawn on top of even thicker white lines, they're not even in the right place!

For some reason, Inkscrape has shifted some of the tracks about 5mm over to the left.
I've stopped calling Inkscrape names like, well, erm InkscRape, and even Nutscrape (which the stupid python-based export plugins fail) because it's been pretty good of late. But something is definitely not right with the printing.

Onscreen everything looks just fine.


It just looks like Inkscrape is, once again, screwing stuff up!
The only way I've managed to get a decent print out so far is to select the boards, export as bitmap at 600dpi and then print from another application, to get the boards to come out of the printer the right way around.

It's do-able. But what a pain!

Monday 15 June 2015

Making a router table from some scraps of off-cuts

The other day Aldi had one of their "get tools for cheap" days and we snagged a 1250W router for less than £25. A bargain in anyone's eyes!


We did think about the router table, but it didn't look particularly study, with everything being made from moulded plastic. And from the photos on the website, it doesn't look like it is for particularly large pieces. Far better (although not exactly safer or inline with "elf-and-safety") to make one for our new router.

So this weekend, a few hours were needed at the BuildBrighton hackspace.

We cut some 18mm ply and marked it so that there was a minimum of 500mm from the cutting head of the where the router bit would be and the edge of the board. This should allow us to easily cut and rout sheet materials up to half a metre in size.


One of the great things about having wooden workbenches is that they're pretty easy to fix stuff to. As it turns out, someone had already drilled some M7 sized holes in the bench (it looks like a pillar drill or something had previously been mounted there). So it was no bother to find a few coach bolts that were long enough to fit through both the 18mm piece and the 40mm thick worktop and make some holes in our board.

After the centre hole was drilled and some holes placed 46mm apart (centre-to-centre) either side of the main, large hole, we were ready to mount the router.


It's actually far easier to mount the router to the board, and then fix the board to the workbench in this case. But it didn't take long to mount the router and leave the cutting head raised 6mm or so through the "tabletop".

Now at this point, it's fair to point out that this isn't exactly the safest way to go about using a router. There's no guard and no fence, and no feather boards or any of that stuff. But there is a cutting head and, placed 423mm from the centre of the router (so 420mm away from the cutting blade of a 6mm wide straight routing bit) there's a piece of wood, running parallel to the bench edge.


It took only seconds to pass the 3mm mdf sheet along the fence, cutting it with the exposed cutting head, then rotating through 90 degrees and repeating, to create two, perfectly square, pieces of 3mm mdf (420 x 420mm).


The edges left a little to be desired. We tried at fast speeds, slow speeds, feeding the wood quickly, feeding the wood slowly - none of it seemed to make much difference: the cut edge of the mdf had this feathered look no matter how it was presented to the router bit.

Luckily it's nothing that a quick wipe down with a piece of sand paper can't deal with.
Now we're probably not going to use the router table for actually cutting wood (it creates a lot of dust) but as a proof of concept, we're pretty happy with this so far.

Next we need to make a number of "offset" pieces to place along the fence, to allow us to quickly and easily cut channels into mdf sheets, at equal distances apart. After all, that's ultimately what the router table was set up to do!