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.