Category Archives: Design

Kicad Redux

It’s been a few months now since I did the big switch from Eagle to Kicad, so I thought I’d post a few updates on how the process of switching has gone.

I’ve had to go back a few times to dig old designs out of Eagle, and I can’t say that I really miss any features of Eagle. I’ve gotten very used to all the little graphical glitches of Kicad so these don’t bother me as much any more. The designs have definitely gotten a lot better since switching as well.

I commented on the first post about switching I felt Eagle had a better connection between the board and the schematic, but I have to withdraw some of that. There’s a few features of Kicad which make a lot more sense now and the connection between the two isn’t as bad as I first thought.

kicad-dual-head

For example, it’s very easy in Kicad to have both the PCB and schematic up in separate windows on different displays (something I do rather constantly), and this helps make the two feel connected. Highlighting a component on the PCB side will actually cause the schematic to leap and centre that component, so you can see the context both in the board and the schematic very quickly.

Schematic hierarchies also work really well for breaking a design up into managable chunks. In the image below, I’ve buried the USB and power sections in their own schematic pages, so it’s easy to work on just the relevant parts of the board.

kicad-heirachy

 

During early PCB layout, the “get footprint” tool is fantastically useful. Hit “T” and enter a reference, and it grabs that part for moving. This makes it far easier to do the initial rough layout with parts in the right order to do things, and makes it easier to find related parts.

The workflow I’ve gotten very used to now. It’s an ingrained routine of change things in schemtic, generate netlist (when annotation usually pops up), adjust the footprints needed in the footprint assignment, and then reload the netlist in the PCB view. It’s not quite as fluid as the live connection Eagle has, but it’s close enough I’m much more comfortable with it now.

I’m very pleased with the native image to PCB import feature, although it could do with part scaling as currently this really depends on some external tools to get right. But being able to nicely import artwork into the silk as an explicit module is a big improvement over those capabilities in Eagle.

There are still things I’m not happy with about Kicad, but these are more general problems and not enough of a reason to switch back, I genuinely can’t see myself switching back to Eagle at all really.

Things that could be better:

  • You can’t just drop GND vias or even just vias in a spot, at least if you can I haven’t found how
  • The graphical glitches sometimes can be a bit misleading, is that an extra trace or just noise?
  • If you redraw a section of track, it will remove the old section only about 50% of the time. It’s not clear to me why it does or doesn’t at any given moment.
  • In a schematic, if a pin is not on the grid, you can’t connect to it. It would be nice if the wires could “snap” to the pin even if it’s off-grid
  • BOM generation is a bit of a hack and there doesn’t seem to be an easy way to generate a consolidated BOM (ie, qty 4 of part X with references R1, R2, R3, R4).
  • Refilling zones doesn’t appear to have a hot-key. Which means you are forever switching back to the zone tool to refill, and then back again. Grrrr.

All in all, I’m very happy with Kicad and have pushed out about 4 boards now using it, all of which have been just great, and significantly better than previous efforts.

w5500-beakout-instagram(another board designed in Kicad)

 

Heat

All electronics exists to convert electricity into (mostly) heat. It just happens to do something useful along the way. The progression on the design so far has been to consider digital issues first (make the circuit work at all), then mechanical (fit to the case), and now is down to thermal – what to do with the heat.

Now that I’ve started to run the prototypes in the target case I have some idea of the temp of the board, components, and how the case feels. And it’s warmer than I want.

This is somewhat of an issue since the stability of the clock is related to the temperature. If a crystal has a stability of, say, 20ppm, it is always stated with a temperature range at which that holds true. For (most) cheap crystals that’s 25 degrees. As it gets colder or warmer it gets worse.

During the design some of this was taken into consideration. Firstly, since we are aligning ourselves to GPS sources, the stability is less critical: we have a stable external reference less influenced by our local temperature. It does mean we’re limiting how long we can run without GPS sources (it’s currently in the “minutes” range, which is not far off what a $4k device does and this costs nothing like that). This is currently implemented in a coarse-grain way, we just adjust our internal clock being fed by the DS3234 output.

Secondly, the decision to use the DS3234 RTC instead of a watch crystal was driven by the fact it’s a Temperature Compensated Crystal Oscillator, that is it has a temp sensor and can tune the crystal inside it to compensate for the local temperature. Over the range 0 to 40 degrees it claims 2ppm out of the box, and 3.5ppm between -40 and +85. So even with a lot of heat it’s still significantly more stable than a cheap watch crystal.

There are some things I haven’t implemented yet which I’ll now need to consider.

The DS3234 exposes it’s tuning interface, and the datasheet mentions that with an external trusted reference (oh hai GPS) you can feed it extra offset information to further compensate for both aging and to obtain finer precision (you get about +/- 0.1ppm of control). I’ll need to add an extra step after GPS lock to tune the DS3234 against the GPS pulses, and retune it from time to time.

Once the case is closed up properly (it’s not fully closed right now), it may need some holes cut in specific places to improve natural convection. Likely places will be right under the (not very efficient, therefore a source of a lot of heat) LDO regulator. It also will likely need holes in both endplates to ensure any air that is around can get into the case.

We’re also running the main MCU at full clock rate without any regard for clocking down based on demand. While it’s a lot of work to implement, I could look at power management for the MCU by implementing dynamic clocking.

Those things can be done without changing any aspect of the board design.  But there’s board design changes I’m looking at as well.

The 1.5 board now has space for a 16x16x4mm fan in one endplate, with PWM control so we can run it as slow as possible. Like many things, it’s there if I finally decide it needs a fan, but it’s something I’m going to try to avoid. The fan is 3.3V so doesn’t need it’s own LDO (since a lot of fans are 12V, fewer 5V), but should probably have a transistor between the MCU and it to source as little current from the MCU as possible.

The LDO has also been re-arranged to make it easier to attach a small heatsink to. Ideally this will move heat away from going into the board so much, as I suspect that’s what is really causing the reported temps to be as high as they are. It might only work best with real airflow over it, but we’ll see how that goes.

There’s also some evidence the Ethernet section is drawing more power than it should do, as a result of not quite getting the front-end right. There’s fixes for that in 1.5 as well.

All in all, it feels like I’m getting into the real tail end of the project now to be considering these sorts of issues. There’s less making-it-work-at-all, and more making-it-awesome.

Production

One of the reasons I picked the Breadboard PSU as the first project to attempt to ship and sell was its simple. At the same time, its representative of what would be required for any design to be seen though to actually being in people’s hands – other designs just have more parts.

Unexpectedly this week a bunch of the PSUs sold, and more needed to be built in a (relatively) short time. This is quite different as an experience to the prototyping phase, where every build is unique and new, and the timeline is as long or short as you feel like. I’m glad that I chose something simple to start with, because I’ve very quickly found the things I need to think about for larger and more complex designs going into production.

Inventory management is important

During the prototyping phase on all of the projects I have underway at the moment, I’ve built up quite a stack of parts. Some of these parts overlap with other designs, but most are design-specific. For example, every design will probably involve a ton of 100nF power supply decoupling caps scattered all around various ICs. But this is the exception, not the rule.

For a while, “inventory management” was a pile of parts in bags. It started out in small bins, when it was mostly PTH parts which really were easier to store in little bins, but as the number of parts escalated it fell off a little. I only knew if I could build one by actually finding all the parts at the time.

Inventory management is really critical if you need to know quickly how many you can build beyond just one. One is easy. Five or ten imposes more need to know how many you have of all your components. At least twice now I’ve been caught out by problems in inventory – one part important part wasn’t tracked at all, and a second wasn’t updated properly to reflect builds completed.

Some of this comes from the fact upstream part suppliers probably won’t sell you one of a part, but often if you want good prices you’ll need to buy 10, or 50, or 150 at a time anyway. And they’ll get used at different rates, so you need to track the build usage carefully as well.

Plastic stencils last; stencilling jig needs work

I’ve only ever used plastic stencils for assembling my mostly-SMD boards, and had some concerns about how long they would last. It turns out more than long enough, and now I have a cheap source to make them (Ponoko) I’m less worried about exactly how long they’ll last. Still, I’ve gotten sixteen builds out of the first stencil and they’ve effectively cost a buck for each stencil, so it’s a good run.

The more significant problem with the stenciling approach is the jig I use is .. primitive. I’ve just used spare boards I had from prior prototypes to form something to wedge the target board in place, and it does the job, but only just. It would be easier with something more purpose cut to surround the board as much as possible. One option is to get something laser cut by Ponoko but I’ll need to figure out how close their material thicknesses will get to a PCB thickness.

Frypan works, reflow oven nicer

Despite how primitive the frypan cooking method for board soldering is, it actually does work, and I can manage to get a few boards at a time being soldered up. The reliability has been reasonable so far, although we’ll see how these turn out in the field. The main problem is actually the need to watch it. A controlled oven I could put a set of boards on a tray, stick them in, and just run the cook profile.

This will mean I might have to step up efforts to work on building a reflow oven myself. A full commercial one is both far too large, too expensive, and probably not a lot better than a hacked up toaster oven, but something with control is better than none.

SMD parts are great for production

It feels very strange to be so in favour of surface mount parts, but they are so much easier to solder together a bunch of components than PTH by hand with a soldering iron. I had already come to the conclusion SMD parts made things easier in general, but it wasn’t until I realised I was spending 33% of the build time on just a single PTH component that it really hit home how much easier.

There are still some challenges, getting tiny parts orientated out of the tape they often come in is a pain, and tweezers are a bit prone to too much force causing the part to fly off and disappear to never be seen again .. but those are mostly going to come down to practice. I’ve also ordered a cheap vacuum pencil to see how that works for part pick-up and placement, as a sort of poor human pick-and-place machine.

Production is confidence-building

Lastly, production builds confidence in two ways. Being able to reproduce a build and have them pass basic QA tests first time, every time, gives you a lot more certainty about the way something has been designed. It works, so your understanding of how it works looks a bit better each time.

Having other people using your builds is also helps out a bit with motivation to build other things. It’s fun, no doubt about it I have enjoyed all the things I’ve built whether they worked or not, but it’s a very nice feeling having new devices you made, put for the first time into an anti-static bag, all clean and ready to be used by someone else.

Final revision no really!

I think the number of times I’ve said “this is really the final revision” is now too numerous to count, but honestly this time I think it’s fairly close to final. (That’s downgraded from yesterday’s remark to people that asked,  where I said “actually is final”.)

The most recent scare with the design was what looked like a short in the antenna cable causing various things to reset and may now be damaged. It’s unclear to me exactly what happened, but we’re no longer getting a stable consistent GPS lock. The antenna is active – it has 3.3V fed up into it to power an LNA in the weather-sealed puck antenna – but there’s no current limitation on what’s fed up this path.

The datasheet for the GPS has a large example circuit to provide hints to the GPS chip that either the antenna is disconnected (only works for active antennas), or has a short and automatically disables the power into the antenna. But the design is far more than I really need, and takes up enough board space I’d have to do some serious rearrangement. It’d be nice to use the GPS chip’s LNA control line and reporting antenna modes, but the main thing is just limit current and suppress shorts.

I’ve generally ignored putting any significant additional current limitation into the design because none of it is exposed to any external connections. All the failure modes of any of the parts would just result in the board being tossed rather than fixed, and none of them actually are subject to external connectors – except now realising the antenna is directly. (The ethernet jack does have power going into the internal side of the transformer, but since it’s internal side a broken cable plugged into the jack doesn’t cause more power to be drawn.)

Instead, I’ve decided to just add a simple PTC fuse to the power input side of the antenna, limiting it to 125mA which is comfortably more than any active antenna should need, but should blow fast enough to prevent significant damage to the board. Whether I add some remote control of that power using a MOSFET or some sort of reporting of the failure to the GPS or MCU I haven’t decided. It depends on how much board space I need. A PTC fuse is small enough to just throw one on there without much concern.

(PTC fuses are tiny resistors which have a Positive Temperature Coefficient, that is as they try to carry more current they heat up, and a high enough current/temp will result in a very high resistance, enough to stop the current flowing. They reset themselves by cooling down. Their self-resetting nature and simplicity makes them useful for this sort of case. PTC fuses are commonly used in external power ports such as USB.)

Hopefully, that’ll reduce the risk of a short! Soon it will be ready!

Pushing pieces around the board

Time for a brief update on various projects.

NTP Server is fairly close to final. I didn’t manage to knock off actually committing to the 1.4 design I have, but it did have a few tweaks. Primarily fixed up the positioning of the RTC crystal so it’s lying flat instead of vertical so it’s a bit more secure.

I’ve also finally decided that I won’t switch away from the MCP2200 USB Serial bridge on this revision. There was some consideration of switching to a mega 16u2 and using LUFA (an open-source USB stack for AVR MCUs) but I still have a stack of MCP2200′s and they basically are a known quantity.

2.0 also had a bit of a touch up, as I try to figure out what I want from it. The intention with 2.0 is fit into a larger case with a bit of a display. It’s also likely to have some end plates out of plastic cut by Ponoko. The short term plan is prototype the end plates quickly and figure out if the display design will work at all before actually getting the PCB made. (Cut plastic from Ponoko and one case is vastly cheaper as a loss than a stack of PCBs!)

Still undecided is the core platform choice. The easy path will be XMEGA A3 or D3, building off the progress on 1.4. The harder choices are either switching up to A1 (given the utter failure to get any A3′s shipped to me, I suspect not) and seeing how badly 0.5mm TQFP goes, or if I’m going to do that going back into the rabbit hole of ARM Cortex M3 choices (ie, LPC1768/STM32F107/SAM3S, or one of their newer friends). Now there’s going to be a SAM3S based Arduino, could be a good starting place.

LUFA AVR ISPmkII Clone project is still in the shuffling pieces around. Since I’ve gotten myself a real AVR ISPmkII the primary reason for building the project would be getting comfortable with LUFA for other projects. It’s also a simple enough board it would be an okay base for either a live demo of SMD soldering or a tutorial, which I’m attempting to get accepted for the Arduino miniconf at LCA2012.

The big issue at the moment with the board is whether it’s really useful to others (the same issue I had with the Breadboard PSU project) and the slightly harder to solder 0.65mm TSOP logic level shifter on the design. It’s required to ensure it can be used on a wide variety of AVR chips (since, they vary in target voltages), but I’ve had grief with parts that fine before.

Design loops

As usually happens right after I get a new hardware build underway, and completed, I seem to find myself with the schematics and PCB layout open and with new ideas. This tends to happen after each build because I find myself only thinking about how it’s laid out when I get out the tweezers and solder.

This tends to be the way I find I develop these boards. It’s very focussed on one side of the design (usually split very sharply along hardware/software lines) and then will shift sharply into the other side. The last few weeks have been entirely about software (redesigning the way ethernet TX works, arbitrary UDP send, and a DHCP client). Now it’s all about the hardware, which parts I’m using and why.

So another round, and another set of ideas. It’s now clear there will be a new design of the Hardware NTP Server board, and it may be a significant set of changes as it looks like the open source toolchain has matured enough to make using the XMEGA line of microcontrollers an option.

I think each time I do a new hardware design I swear this time is the final version.