Shrink that prototype

This is a follow on to my last post which was about building a prototyped lithium charging ESP8266 (ESP12) breakout board along with some power management firmware features. Having had reasonable success with the stripboard prototype, the next step was to create a PCB version of this project. PCBs are everywhere and although over time I’ve fiddled around with attempting to fix TVs and stereo systems with varying levels of success, I’ve never designed and created a PCB of my own so this was a completely new discipline to me.

I set myself the goal of trying to make this board as small as possible for no other reason than small is beautiful. I knew that it’s possible to hand make a PCB but I also knew the end result would end up a lot larger (and a lot less pretty) than a machine fabricated board and repeatability would also be a problem. So with the idea of a hand made board dispensed, I set about finding a PCB shop and choosing PCB CAD software.

Choosing PCB CAD software

Also known as EDA (Electronic Design Automation) and ECAD (Electronic Computer Aided Design) software. Everyone likes free but Eagle CAD isn’t really free however there’s a freeware license where restrictions include it being limited to designing small(ish) 2 layer boards for non-commercial purposes. The other package that caught my eye was KiCad which is completely open source and unrestricted. There’s a decent comparison matrix of EDA software here. I settled on Eagle for this project but I’m sure I’ll give KiCad a try in future. Things I did find nice about Eagle were:

  1. A large user community which means lots of support for part libraries and scripts
  2. Lots of tutorials available
  3. It was reasonably easy to get started with for me with no prior Eagle experience and limited electronics knowledge

From what I read the general workflow seems to be similar in most PCB CAD packages:

  1. Design a schematic by including supply voltage(s), components and wires etc.
  2. Layout and route a PCB from the schematic created in step 1

I found this sparkfun tutorial very useful as a starting point for Eagle: https://learn.sparkfun.com/tutorials/using-eagle-schematic

Choosing a PCB shop

I started reading this PCB shop comparison guide here and also read a bunch of “arduino create a PCB” and “esp8266 create a PCB” type threads to get a feel for what other people were doing in this area. Following that I’d reduced down to two:

I put together a quick and dirty board design in Eagle approximating the target size of my PCB and sent it to both for a side by side comparison.

With OSH Park I was able to directly upload the Eagle .brd file and get immediate feedback after a minute once their system had performed some basic sanity checks on my design.

With Gold Phoenix I had to work out how to generate gerber files from Eagle, zip these up and submit these to the Gold Phoenix website - a process which is a little bit clunkier than OSH Park but I did get feedback the next day once a human had reviewed what I’d sent.

I’d heard great things about the quality of boards from OSH Park on twitter and also on http://www.esp8266.com/ and the pricing between these two were so close for a small order, I settled on OSH Park - job done.

Schematic recap

PCB smd parts (mostly)

A wrong turn

Having previously prototyped the design of this lithium charging esp8266 breakout board on stripboard, putting the schematic together in Eagle was pretty much straight forward - the trickiest part was choosing components matching the specs of what I needed each with the desired and correct footprint size / package for the PCB.

Once the schematic was built, all that was left to do was to layout the components on the board in a semi-neat way and route all traces. Not having done this before I spent a fair amount of time on this stage taking care of the important things including performing many design rules checks (DRC) and electrical rules checks (ERC) along the way in an attempt to head off any problems early. OSH Park provide an Eagle DRC check script and it’s recommended this is used at board design time if using OSH Park and Eagle.

Top tip: print your PCB on paper at 1:1 size to check if real physical components exactly overlay the footprint of the pads / holes on the PCB

A word of warning: the sparkfun page here describes how to setup the Eagle UI to make things easier to use. They also include an Eagle setup script in that page called “spk.scr” which can be used to configure the Eagle UI. This is a useful script however there’s a problem with it: this script switches off layers 25,26,27,28 by default and some library components do drop text onto the tNames layer which will get hidden by this script because that layer gets switched off. This means that if you’re not careful and super alert, there’s a danger you can end up with a PCB silkscreen disaster when the board is later printed at the fab shop because you weren’t aware of all silkscreen text that will be printed.

In the end I edited this spk.scr file on local to avoid this problem reported the issue to sparkfun tech support but as it stands, this problem is still present on their website.

After about a day of playing around all looked good, I was happy with my creation, OSH Park validated the board design seemingly with no issues and I placed an order for 3 boards:

At this point I was excited to have got as far as getting my PCB order in progress and so triumphantly posted to twitter: https://twitter.com/iD8266_1/status/761649736214515713.

Surprisingly that tweet gathered a fair amount of interest including comments from a bunch of good guys highlighting some mistakes I’d made and missed when I was laying out the board:

  1. The ESP8266 antenna was positioned over copper / traces / the ground plane which would result in reduced WiFi signal strength
  2. A possible problem with plated slots on the DC jack
  3. Concerns about use of 0805 footprint smd components being too small to solder by hand

Well that was a bit dire :) My initial excitement wore off quickly and I realised I’d done things in the wrong order..really should have posted the tweet before placing the order. Never mind you live and learn and as it turned out shortly after, I realised I’d made another silly mistake by positioning the TP4056 board rotation the wrong way around. The v1.0 attempt was a disaster of my own creation before it had been delivered and it would be fit for nothing other than soldering practice when it arrived. Undeterred I battled on. v2.0 would be flawless..

Getting it right

The next day I continued on with re-laying out a v2.0 version of the board in hopefully the right way keeping in mind the things I’d learnt from the first early fail. I spent about another half a day switching things around including moving resistors and caps to the underside of the board and of course moving the ESP8266 antenna off the board completely. I decided to stick with the small 0805 footprint components for the moment and also stick with the plated slots on the DC jack and wait for the v1.0 board to arrive before making any further changes. It made sense to wait and see what the v1.0 board looked like in real life to see what else I could learn from that before placing the order for the v2.0 version.

A week or so later the v1.0 board arrived and I saw that OSH Park had done a great job with the DC jack plated slots - hurray a minor win! In fact they’d done a great job overall. The board was very pretty, well manufactured and of very high quality. Shame it wouldn’t actually work. Looking at physical v1.0 also made me reasonably happy with the size of the 0805 component footprints; admittedly they’re very small but doable by hand with a magnifying glass.

A very nice surprise

Along the way, it turns out that OSH Park had been following the tweets going back and forth. Drew Fustini (@pdp7) from OSH Park got in touch, he said he’d been enjoying the tweets about the design of this board and he very generously gave me a $30 voucher to use for my next order and also offered a possible free upgrade to OSH Park swift service if it was available when I placed my next order (worth another $89). Fantastic! This totally took the sting out of the v1.0 fail.

I stared at my v2.0 board layout in Eagle for another hour or so racking my brains for anything that might be not quite right. I tweaked the silk screen here and there and then pulled the trigger on the second order this time paid for with the $30 voucher. Fingers crossed again:

The final build

The 2nd order did get upgraded to OSH Park swift service free of charge and the v2.0 board arrived in record time - 7 working days from when the order was placed. The board looked good and I had all components ready to go so it was time to solder.

I took my time and probably spent about 4-5 hours soldering all of the components onto the board one Saturday afternoon starting with the smallest components first working up to the largest. The small 0805 resistors were tricky to solder and to be honest I’m not proud of how they actually look close up but amazingly I didn’t fry it all into a useless heap of junk and at the end of the day the board did actually work:

What next? The plan now is to continue testing this board (v2.1 needed? not sure) and to find some sort of enclosure for this thing to live in, perhaps an IP rated box for external use.

I also want to test some external I2C devices connected to the ESP8266 to see how this board holds up to hungrier power requirements so some firmware extensions will be needed too.