Palawan: Part Selection and Schematics
When starting a project, the first step is obviously to decide what it should do. Do you want to do a light blinker or a laptop? Maybe you have something prototyped already on something like an Arduino, and you’d like to move to Mass Production (MP). Either way, entire industries have been built around deciding what to do. Once you’ve selected something, then the physical work begins.
The next few steps are also important, and are frequently overlooked, particularly in classroom situations where they are pre-selected. Oftentimes each step is taken care of by a team of people in a large company, but as hackers and small business owners, we’ll have to orchestrate everything ourselves.
In this article, we’ll cover Building your BOM, Selecting your Parts, Planning Pin Mappings, Creating Footprints, and Designing Schematics.
Building your BOM
Your BOM – or Bill of Materials – is a manifest of all the parts that go into your project. When you select parts, they will go on the BOM. When you fabricate the board, the board itself will sometimes go on the BOM. It’s usually a good idea to put items like Firmware on the BOM, just so you don’t forget that they exist. The BOM is one of the pieces of data that you will give to the assembly house, or if you’re assembling boards yourself it’s a good shopping list for parts to buy. If an item doesn’t make it onto the BOM, it doesn’t exist in your project.
Fortunately, BOM generation is part of every circuit board designer. Fancier ones can plug into inventory management systems, and some will even tie in with companies such as Digikey to automatically order parts as you add them to your project. Most will produce a spreadsheet file for you to send, and making sure you have all the parts to go on the board is left as an exercise to the designer.
In Palawan, I’m using Altium, which produces BOM files natively.
Part Selection
When selecting parts, there are three very important factors to look for: ease of placement, cost, and obtainability. Everything in your BOM must be considered against these three requirements, and if any one feature isn’t met, then look for a different part.
Jellybean components such as resistors and capacitors are, for the most part, the same. Unless you need something really exotic, you can usually specify “ANY”, meaning the factory will just buy whatever is cheapest. It’s usually not worth it to fake resistors, since you can tell pretty quickly if they’re open shorts.
It’s important to make sure the parts you pick can be placed by the assembly house (or yourself). If you do LQFP parts, or something without any chip leads, you may find your parts don’t make good contact. This will result in some of your boards not working, leading you to wonder if it’s your design or the assembly process that’s causing the failure.
Similarly, if you can buy two parts that do one thing, or one part that does two things (but is more than twice expensive!), consider getting the two parts. FPGAs are frequently like this, where an FPGA and a CPU is far cheaper than an FPGA+CPU combo.
Finally, make sure you can actually get the part you’re after. Unobtanium is no good. There’s no point in specifying a chip that is no longer being manufactured, or one that is close to its End of Life (EOL). If the part that you want has a Minimum Order Quantity (MOQ) of 100,000+, you may be out of luck as well, unless you can find a reseller who can give it to you in smaller quantities. A good rule of thumb is that if it’s on Digikey, you’re safe.
A good way to protect yourself against unobtanium is to have two (or more!) sources for exotic components. If you need a specific type of inductor, find two different vendors who make similar ones and allow for either part to be placed. This usually means getting creative when you design the PCB footprint, but will save yourself a lot of headache when the email comes saying the manufacturer has gone out of business.
As always, these are guidelines and not rules. Palawan will break a few of these where it’s really important. The CPU will come from NXP, and has no second-source. It will have a four-position switch from a particular vendor, but that will get redesigned once I see what surpluses the market has. I do intend to have an antenna connector, but it will be an alternative to the PCB antenna that I will try out.
Planning Pin Mappings
Microcontrollers have power pins and user pins, and while power pins can only be used as power, user pins frequently have many different options available. For example, one pin may be able to be used as an I2C clock line, as a serial pin, or as an I/O pin. When designing your product, it is important to understand what options are available, and choose functions that match your need.
There are multiple schools of thought on how to do this, but the easiest seems to be to open up a spreadsheet, grab a beer, and do some reading. As you go through the datasheet, take note of what a pin is set to when the chip starts up, how much current it can source or sink, whether it’s 5V tolerant, whether it has a pull-up or a pull-down available, what polarity is used, and that the thing you want it to be used for can actually be done.
This is where a lot of mistakes are made, and why it’s important to do multiple runs of a board. For example, the original run of Orchard had a GPIO port expander connected to a pin on PORTB, where it would drive the pin HIGH when an event was available. When the first runs of boards came back, we quickly discovered that PORTB was, in fact, the one bank on the chip that couldn’t fire an interrupt. That meant that we couldn’t put the CPU into a low-power state and wait on events, we had to constantly check the level of the port expander Event pin. The next revision of the board moved the Event pin to PORTA.
Another mistake happened more recently, where it was discovered that the pin that had been wired up to the “Chip Select” line on a SPI display happened to be connected to the one GPIO on the CPU that was Input-Only. Any attempts to set the pin as an Output were ignored, but that was not at all obvious. Again, the problem was fixed on a subsequent board revision.
With Palawan, I’m mostly using GPIOs, so I have a much easier time in assigning pins. I’ve noticed that there are a lot of ADCs available, which gives me the idea that I can perhaps wire them up to outputs that will let me read volume sliders, analog joysticks, or levers. There are also some capacitive inputs available, which I have no idea how they work. I’ll be sure to break them out anyway when I design the board, because they might be fun to play with.
Creating Schematic Footprints
Footprint creation is a tricky subject, and varies between software packages. There are many packages available, each with its own quirks. Hopefully your software has good tutorials.
Much of the software has built-in libraries with pre-designed footprints for simple things like resistors, capacitors, .1" headers, test points, and power. Unless you’re doing a very simple circuit, they won’t have all of the footprints you’ll need, meaning you’ll have to create your own.
The good news is that schematic footprints can look like anything, and in fact some of the basics differ from region to region. For example, schematics designed in the US tend to use sqiggly lines for resistors, while European schematics use a rectangle. Both parts have two “pins”, and are functionally the same. Whichever one you use is a matter of choice, though it’s considered good form to stick to one or the other.
When you design your footprint, you can usually identify a particular behavior for a pin. For example, input, output, power, analog, or something else. This can provide a first level of design verification, to make sure you don’t wire a power line into an analog line. These features are mostly advisory, so it’s alright if you get them incorrect for now.
It’s important to have the schematic pins have a 1:1 correspondence with pin numbers in the datasheet, but it’s not important to have them physically near each other. You can, for example, draw the power pins so they’re all together, even if they’re physically far apart. Frequently this will neaten up your schematics.
You may need to create additional pins for features that don’t actually exist. For example, some power chips have a “flag” under them that’s a large exposed piece of metal. This metal should mate with the ground plane on your board. Or maybe you have a board connector that has a metal shell that should be connected through a capacitor to ground. For either of these scenarios, you should create a virtual pin on the schematic and annotate it as such. Both of these are the case with Palawan, where the CPU has a large ground flag on the bottom, and the USB connector has ESD protection to the groundplane.
Designing Schematics
Schematic design can be relatively easy (low-speed digital) or mind-bendingly hard (high-frequency RF). Hopefully the thing you want to is easy, so you have less to worry about.
The #1 thing to do is see what others have done. There are many existing board designs out there, so see what they do. The datasheet or reference manual for any complex parts you have should contain reference schematics with a do-whatever-you-want license attached to them. The vendors want to sell parts, so those schematics are free to use and are guaranteed to work. You may need to adapt them to your situation, but they’re an excellent starting point.
Your board will contain mistakes, so lay it out defensively. If you aren’t sure whether a signal should be high or low, design it to allow either option, and put down zero-ohm resistors. It costs nothing extra to lay down empty pads, but will save you a lot of headache later on when you discover that pull up should have been a pull down.
Palawan shares the same CPU core between the Tx board and the Rx board. When laying out the schematic I referenced both Orchard and the NXP datasheet and sample layouts. I created three sheets in total: One “MCU” sheet with a bunch of dangling nets, one “USB” sheet that describes the USB connector on the Rx board, and one “Input” sheet that describes the switches and pads for the input board. This way, any changes that need to be made to the MCU need to be made only once.
I also want to try a microstrip PCB antenna, but I’m not sure of how the performance will hold up. To hedge against this, I’m going to put down a pair of zero-ohm resistors, and specify in my BOM to only populate one of them. One resistor will go to a section of the board with the antenna printed on, and the other will go to an antenna connector. If the printed antenna doesn’t work, I have a fallback plan that I can move to by simply moving that zero-ohm resistor.
Next Time
These steps have gotten me to the point where I have a BOM, some parts to order, and a schematic with footprints. It’s important at this point to describe your schematics to someone, even if they have no idea what you’re talking about. Have a think about it. It’s easier to change things now, and harder to change them once you’ve started layout.
Next time we’ll go over PCB footprints, PCB layout, output generation, and sending off the request. That will get us to the point where we have physical goods, and then the hacking can begin.