Why Worry About IPC Standards for PCB Design?

When I got started creating my first boards, the last thing I was thinking about was producing a board at huge scale, or even at low volume. As a young student, the most important thing to me was getting my great ideas to work as I imagined. Once I started working in the electronics industry as a professional, I quickly realized that the alphabet soup of standards was a useful tool for designers and manufacturers alike.

Among the most important and widely accepted standards for PCB design, fabrication, and assembly are the IPC standards. The list of IPC standards for PCB design is extensive. This set of documents covers everything from plating on exposed copper, to bare board cleanliness. Manufacturers make sure to familiarize themselves with the fabrication and assembly portions of the IPC standards for PCB design, but PCB designers should do their best to understand the design portions of the IPC standards.

What’s in the IPC Standards for PCB Design?

The short answer is: everything! Every aspect of PCB design, fabrication, and manufacturing you’ve ever considered is most likely associated with some IPC standard. Obviously, the list is too long to repeat here, but some of the important design standards are covered in the IPC standards for PCB design. Before scanning through the list below, be sure you’ve familiarized yourself with some basic guidelines for PCB design.

IPC 6012: Acceptability Criteria

When designers are building a new rigid board to comply with IPC standards and ensure manufacturability, the IPC 6012 standard is the place to get basic requirements. This set of standards, as well as the IPC-A-600 standard, will tell you what a manufacturer looks for when they receive your board. These standards address solderability, conductor width and spacing, structural integrity, and substrate material requirements. Some related standards are:

  • IPC-6011: Generic Performance Specification for Printed Boards
  • IPC-6013: Specification for Printed Wiring, Flexible and Rigid-Flex
  • IPC-6016: Qualification and Performance Specification for High Density Interconnect (HDI) Structures
  • IPC-6018: Qualification and Performance Specification for High Frequency (Microwave) Printed Boards
  • IPC- 6202: Performance Guide Manual for Single- and Double-Sided Flexible Printed Wiring Boards
  • IPC-2251: Design Guide for the Packaging of High Speed Electronic Circuit
  • IPC-7351B: Generic Requirements for Surface Mount Design and Land Pattern Standards

IPC-4761: Via Plugging

If you plan to use plugged vias, or plated-over vias, then you’ll need to review this important standard for via design. You’ll need to ensure your plugging and/or plating strategy is properly designed to ensure these structures do not fail during operation.

IPC-2221: High Voltage Clearance Standards

This standard defines safe clearance distances between conductive elements in high voltage PCBs. This standard also provides requirements on material quality, layout guidelines, and much more. A related specification for flexible PCBs is the IPC-2223 standard.

IPC-2152: High Voltage Clearance Standards

The new IPC-2152 standard provides much better guidance on designing boards with the appropriate trace width to prevent excessive temperature rise. This standard also addresses the required distance between traces and distances to copper planes.

IPC-2141A: High-Speed Controlled Impedance Standards

If you’re designing a high speed or high frequency board that requires controlled impedance routing, the IPC-2141 standard contains some impedance formulas for different trace geometries. However, the equations in these standards are known to be less accurate than other equations for microstrip and stripline impedance. Read more about the controversy here.

IPC standards for PCB design flowchart

The list of relevant IPC standards for PCB design and their application areas.

Take Advantage of Constraints in Your Design Software

Complying with IPC standards for PCB design becomes much easier when you use the right design software. I’ve never met anyone that can keep track of all the important IPC standards, and it doesn’t hurt to use design software that can help ensure compliance. If you plan to produce your board at scale, you need to ensure that important IPC design specifications are encoded in your EDA software as rules and constraints.

EDA software plays an important role in ensuring compliance with IPC standards for PCB design. EDA software, specifically for circuit and PCB design, is highly adaptable and includes tools that allow you to create nearly any conductive structure and layout you can imagine. Many design choices you make might be electrically correct, but they may not comply with IPC standards, and they may not be manufacturable. However, if you choose the right design software, you can identify DFM violations and any design choices that don’t comply with IPC standards.

The best software for PCB design will include important IPC standards as editable design constraints. If your board needs to obey more stringent standards than those defined by the IPC, you’ll need to edit an existing constraint or define a new one. While this takes some up-front time, you’ll be able to spot any design choices saves you from making a costly redesign before production.

Defining clearance constraints using IPC standards for PCB design

Example of a clearance constraint you can define in your next PCB design

There are a number of other important standards that play a role in PCB design software. Some of these have nothing to do with electrical functionality of an assembled board, and instead focus on footprints, symbols, and models used for components in PCB design software. Other standards bodies, such as the International Electrotechnical Commission (IEC) and Underwriters Laboratories (UL), set standards on PCB functionality, assembly, and their incorporation in specific products.

If you want to ensure your next board will comply with IPC standards for PCB design, you can take advantage of the rules-driven online design platform in Upverter®. This easy-to-use browser-based platform is ideal for designing new PCBs from start to finish. You can easily pick an existing template from a vast range of open-source hardware projects, and important IPC and DFM standards are defined as design constraints automatically.

You can sign up for free and get access to the best browser-based PCB layout editor, schematic editor, and component database. Visit Upverter today to learn more.

USB Connector Layout in Your Next PCB

USB-A connector in a computer

I tend to lose track of all my devices that can connect to my computer via USB, and I only expect the number of devices to increase, especially as so many products become embedded. These products will need one or more USB connectors to interface with a computer or other device. Whether you are using a standard USB-A or USB-B connector, or you want to use a Mini/Micro form factor, you’ll need to place a connector on your board and route it correctly.

This is rather easy to do in most layouts as the USB signalling standards are not too difficult to work with. Let’s look at what you need to do to incorporate a standard USB-A or USB-B into your PCB. You can then apply the same USB connector layout procedures to other USB form factors, such as USB Micro and USB Mini.

USB Connector Layout Guidelines: USB-A and USB-B

The critical layout rule that makes USB work so well is its use of differential pairs for routing. If you’re routing differential pairs in your schematic, you should make sure to indicate them with “p” (positive side) and “n” (negative side) on net names. This ensures your constraint manager recognizes these lines as differential pairs in your layout. In total, a USB-A or USB-B connector contains four connections: the differential pair mentioned above, a power connection, and a ground connection (see the image below).

USB connector layout diagram

USB connector layout and pinout diagram

The connector itself is shielded, which provides protection against interference. When taken alongside the use of differential pair routing, USB interfaces have strong resistance to interference within a board and from external sources.

The connector also needs to mount to the PCB using some small mounting holes. You should check your component datasheets for applicable hole sizes. Many USB connectors recommend using the standard 1.57 mm board thickness, so you should not place USB connectors on much thinner boards. The mounting connector crimps onto the backside of the board, so no external mounting screws are required.

When creating a USB connector layout, you won’t need a ground plane directly beneath the connector, although it is a good idea to place a ground plane beneath the differential pairs, i.e., in a microstrip configuration. Whether you need an internal ground plane below your surface layer also depends on the type of interface you are using. This is discussed more below.

USB PHY Interface

What about getting data from your MCU, MPU, or FPGA to your USB connector and to an external device? Unless your processor contains a built-in USB PHY interface, you’ll need to use a bridge component to generate data to send over a USB connector. A USB bridge is an IC that receives data using some common signalling protocols (e.g., SPI, I2C, or UART), and converts the data to the non-return to zero (NRZ) signalling used in USB. Similarly, if you are building a board to receive data over USB, you’ll need a bridge component to convert that data to one of these other signalling standards.

There are a number of components you can quickly bring into your board as a USB bridge:

  • FT232RL: This SMT component is a UART to USB 2.0 bridge that will interface.
  • FT201XQ-T: This QFP component is similar to the FT232RL, although it interfaces with I2C.
  • TUSB7320IRKMR: This SMT component is more powerful and can support USB 3.0 (see below). This particular component targets applications like notebook computers. It can interface using a number of protocols, including PCIe.
  • TUSB2077A: This component provides support up to 7 USB ports.

All these components are readily available from a variety of distributors.

USB 2.0 vs. USB 3.0

The first difference between USB 2.0 and 3.0 is the data transfer rate. USB 2.0 is rated up to 480 Mbit/s, while USB 3.0 reaches up to 4800 Mbit/s. If you are working with an application that requires extremely synchronous high data transfer rates, then go with USB 3.0, although USB 2.0 is still sufficient for many applications involving streaming audio, file transfer, and plenty of other applications. Note that USB 3.0 is backward compatible with USB 2.0.

At the board level, USB 2.0 and 3.0 use different termination schemes, depending on the impedance of the PHY component. Series resistors are used for termination, but the size and placement of the termination resistor depends on the component as different manufacturers use different output impedance specifications.

The USB connector bus has an input impedance of ~90 Ohms, while the driver output impedance ranges from ~28 to ~44 Ohms, so the resistor you need for termination will be particular to the component. If you don’t include termination resistors, an eye diagram for a data stream will not meet the requirement in the USB specifications. Be sure to check your datasheets for termination specifications, especially if the component supports both USB 2.0 and 3.0.

USB 2.0 and 3.0 connector layout

These blue connectors are USB 3.0 interfaces, and the black connectors are USB 2.0 interfaces.

The USB connector layout guidelines shown here can be easily brought into your next PCB when you use Upverter®. This easy-to-use browser-based platform is ideal for designing new PCBs from start to finish. You can easily pick an existing template from a vast range of open-source hardware projects, and you can find the connector and USB bridge components you need from the Parts Database.

Sign up for free and get access to the best browser-based PCB layout editor, schematic editor, and component database. Visit Upverter today to learn more.

Project Design Walkthrough: Airsoft Tracer Unit, Part 3

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Project Design Walkthrough_ Airsoft Tracer Unit, Part 3

We are back to work on the Airsoft Tracer Unit we started in Part 1 and continued in Part 2. We are building a unit that fits on the end of an airsoft gun and exposes the dark plastic BBs traveling through to UV light, exciting the luminescent material on the BB. This will make the BB glow brightly, making it easy to see during night games, or indoors. In previous articles, we selected our top level components, prototyped, and extensively tested the photogate for detecting the BB. We also ruled out the use of an LED lighting power supply for limiting the current on the UV emitters. In the first article, I mentioned looking at using an SR Latch to hold the state of the photogate after a BB passed through, but hoped that we would not need to do that.

In this article, we’ll be writing some code to run on an LPC11U24. We will be using the MBED online compiler platform to get the basics of our code written for the project, and see if we can do away with the SR latch. Ideally, we should be capturing the edge change of the signal quite rapidly so we can also use the LED unit as a chronograph as well as for ensuring the UV emitter array is only on when the BB is traveling past it.

Microcontroller Test Setup

In Part 2 of this series, we were able to test the photogate in real-world conditions using a 3D printed holder for the light gate components, and using that, we got some traces from the test board with the oscilloscope. We could use the same setup for testing the microcontroller code, however, it’s a little cumbersome to use such a setup for testing purposes. Therefore, I’m setting up a function generator to create a square wave that will closely simulate the timing of the live test I ran. I’m using a 30Hz square wave, which translates to a pulse width of 33.3ms. The square wave is present on two channels, the second of which has a phase of 353° relative to the first. In the airsoft world, 30 rounds per second is considered to be a moderate to high fire rate, which makes this a realistic test speed. The signal going low for 33.33 microseconds (99.9% duty cycle) matches what we measured previously quite well for the highest speed rounds, and the 353° phase of the second channel gives a 613μs gap between the first and second channel firing, simulating a BB traveling through the tracer unit.

Oscilloscope screenshot showing an active low pulse on the yellow channel and similar but delayed pulse on the cyan channel
Generated signal simulating BB entrance (yellow) and exit (cyan) with difference in time between the pulses of 613.6μs 

By using a function generator, we have a ‘best case scenario’ signal that we can use to develop firmware that will prove out the concept and give us reliable timing information to work with.

Using MBED

This code is being developed using MBED, which is an online compiler (which can also be installed on a computer) that uses an open source hardware abstraction layer for ARM Cortex M0 to M4 series devices and is developed by both ARM and the community. This means the code compiled with MBED is portable across many different devices without having to change controller-specific startup code or specific registers for each device’s peripherals. This is similar to the Arduino library, but only for ARM controllers. The online compiler provides a good user experience and makes collaborating with teams easy through built-in source control. There’s a wide range of useful functions built in, as well as many libraries for specific external devices published by the community that are easy to pull into your project.

Because it supports such a diverse range of controllers, my colleagues and I have experienced frustrating bugs that tend to be very platform-specific. For example, on one microcontroller, the timer has a 32-bit implementation, thus overflows after about 35 mins, but on another microcontroller, the timer for the same function has a 64-bit implementation and doesn’t exhibit the same failure. Also, due to the hardware abstraction layer, some portions of code can take significantly longer to execute than if you had used the register/peripheral directly with controller-specific code. The very slight delay this introduces is a common aspect of all hardware abstraction libraries (like Arduino), and is just something you need to work with for the convenience of the library. The platform-specific bugs do eventually get fixed when reported, but it can be a little frustrating when you come across one, and switching to another microcontroller can resolve the issues.

That being said, the bugs are few and far between, and code quality in MBED is generally very high. The platform allows rapid prototyping and evaluation of many microcontrollers to optimize cost, and makes development easy. Although the code for this project is going to be quite simple, timings need to be fairly tight to ensure the UV emitters turn on quickly and don’t stay on too long after the BB has exited the unit. The emitters generate a lot of heat, and we are doing away with current limiting, so to save them from premature failure we need to keep them on for the shortest period possible.

Software Requirements

In part 1, we looked at the overall specifications/requirements for the device, but didn’t go into details for the firmware. This is a very simple device, so it’s software requirements are brief.

Required Functionality:

  • Detect first photogate transition to low level signal.
  • Turn on UV LEDs while the BB transits the tracer unit.
  • Detect second photogate transition to low level signal.
  • Turn UV Emitters off when BB exits the tracer unit.
  • If the exit hasn’t been detected after 700μs, turn the UV emitters off.

Future “nice-to-have” functionality would include a Bluetooth chronograph with memory, allowing you to look back at velocity consistency at the end of the game.

Initial Test Code

We can implement this code in one of two ways:

  • Using a loop to poll the input pins to look for a state change.
  • Using interrupts to execute code when the pin experiences the changing edge we are looking for.

I’m going to go down the interrupt route, as the amount of code we need to run when the interrupt fires is very small, so implementation is going to be very easy. My main concern is whether the interrupt will be raised by the LPC11U24 microcontroller, and makes its way through MBEDs code to my user code quickly enough. If the delay is too long, it might make this infeasible.

A polling loop is an effective way to implement this functionality too, but if we have some code that will take a long time to run inside the loop, such as future Bluetooth functionality, it could block loop iteration for long enough to cause the microcontroller to completely miss the signal transition from high to low. On the other hand, with an interrupt, that long-running code will be paused while the interrupt is handled, and then execution will continue once the interrupt service routine is complete. This allows us to still perform any long-running tasks we may need in the main loop without having to worry about losing a pulse as a BB passes through the light gates.

Programming the LPC11U24

I’m starting out my code with the mbed_blinky template. This code just flashes LED1 on the dev board on and off every 200ms.

The first thing I like to do is set up some definitions for the pins I’ll be using on the microcontroller. This makes changing between dev boards easy, and makes it very clear where all the connections go if you pick the project up again at a later date, or are designing the schematic to go with the circuit board.

#define PIN_GATEONE P0_7 // p21
#define PIN_GATETWO P0_17// p22

#define PIN_LED2 p15 // for oscilloscope to watch

#define PIN_LEDOUT P1_8 // this is LED1
#define PIN_STATUSOUT P1_9 // this is LED2

I’ve defined my pins for both gates, a signal for my oscilloscope to watch, a status LED that will be flashed by the main loop, and another that will flash in time with the oscilloscope watch pin.

In a larger project, I’d have all the definitions in a separate header file to make it so I didn’t need to scroll through all the definitions at the start of the file. It makes it a lot easier to move pins around as you’re routing a circuit board to have all the definitions in one place with recognizable names, rather than having to hunt through multiple areas of code to change pin definitions.

Next, we need to define the IO objects. There are two interrupts for the light gates, and 3 digital outputs for the LEDs. That’s all the project requires—it’s nice and simple.

InterruptIn gateOne(PIN_GATEONE);
InterruptIn gateTwo(PIN_GATETWO);

DigitalOut led(PIN_LEDOUT);
DigitalOut led2(PIN_LED2);
DigitalOut status(PIN_STATUSOUT);

After this, we have two very simple functions to toggle led and led2 on or off depending on the interrupt that gets fired.

void triggerIn() 
    led = led2 = 1;
void triggerOut()

    led = led2 = 0;

triggerIn is for the first gate, with the BB going into the tracer, and triggerOut is for the second gate, where the BB is going out of the tracer.

Finally, we get to our main()function. This is going to turn all the LEDs off immediately on boot, and then configure the interrupts to trigger on the photogate edges.

int main() 
led = 0;
led2 = 0;
status = 0;

// Interrupt configuration
// Rising edge for end of BB transit through the gate

// Falling edge for start of BB transit into gate.

while(1) {
status= !status;

The main loop is simply going to flash the status LED (LED2) on and off every 200ms.

Compiling the code is all done online, and programming is as simple as dropping the downloaded hex file onto the LPC11U24’s USB flash drive and hitting the reset button.

Oscilloscope screenshot showing the two pulses from the previous figure and the microcontroller response on the magenta channel
Introducing channel 3 (magenta) with the microcontroller response

It looks like it’s doing what it’s meant to do. There is a bit of a delay as we’d expect, but what’s most worrying to me is it seems to be jittering around a lot.

Oscilloscope screenshot showing pulse width and delay overlay on top of the previous figure
The oscilloscope provides us with pulse width data and delay data. The microsecond deviation is worrying.

Using the oscilloscope to measure this jitter, we can see from the falling edge of channel 1 (yellow) to the rising edge of channel 3 (purple) that we have an average delay of 19.73μs. However, the deviation is unacceptably high at 7.79μs. The total deviation of the pulse width is only 3.38μs, which I find interesting. The code should have highly repeatable results, so the delay and pulse width should be rock solid. The oscilloscope is in high-resolution mode, so we can detect as small as 97.14ns of deviation from the function generator pulse.

After some investigation, I removed the status LED flashing, and more importantly the 200ms wait call. Even though the code should essentially be paused during the wait call, it appears the wait state perhaps takes longer to interrupt than executing code does!

Similar to the figure above, but with more consistent delays and nanosecond deviation levels
All the delay and width measurements are now in nanoseconds!

Simply removing the wait call from the code gives us an absolutely stable pulse width and delay between the edge transitions. It’s actually significantly more repeatable than my new function generator is on average, which is quite encouraging for the code.

Improving the Code

We now have something that can switch on and off if the timing is right, but it’s fairly easy to get this code into a bad state. While the code is reading the signal reliably, messing with the function generator outputs (such as turning one off) makes it unhappy. It’s a valid proof of concept to show the interrupts are stable, however the code wrapping them is not, and it needs a few extra checks and balances in place.

bool triggeredState = 0;

I’m going to introduce a global variable to determine if the LEDs are active or not. I could check the led/led2 variable, but a global bool is going to execute a few nanoseconds faster, as well as make the code more readable and maintainable.

bool triggeredState = 0;

I’m also going to need to implement some code to ensure we don’t have the LEDs on for more than 700 microseconds, so we’ll need a Timer and a couple of timestamp objects.

Timer sysTime;
us_timestamp_t gateStartTime;

The Timer and gateStartTime are global. We’ll also add a local timeCheck variable to main(), which would also make the code more legible and maintainable even though we don’t strictly need it given the implementation.

us_timestamp_t timeCheck;

Now that we have the variables set up, we need to start the sysTime timer in the main() function, so I’ll do that right after we set the LED outputs to be off.


Next, I’ll relocate the contents of the interrupt routines into new functions so we can call them safely from other locations in the code. Because of the way MBED implements the interrupt service routine, we could call the ISR directly. Nevertheless, I feel it looks cleaner to have the ISR serve the single purpose of just handling the interrupt. If we were implementing the ISR directly with the microcontroller GPIO peripheral, it would need to be in it’s own single purpose function too.

void ledActivate()
led = led2 = triggeredState = 1;

gateStartTime = sysTime.read_high_resolution_us();

void ledDeactivate()
led = led2 = triggeredState = 0;

The ISR then gets changed to first check the triggeredState variable before calling these functions.

void triggerIn() 
if (!triggeredState)

void triggerOut()
if (triggeredState)

Finally, our main loop gets changed to be a check to see if the UV emitters have been on for longer than they are allowed.

// check for missed second gate
if (triggeredState)
timeCheck = sysTime.read_high_resolution_us() - gateStartTime;

if (timeCheck > LED_TIMEOUT)
triggerTransitionRead = 1;

This will check the definition LED_TIMEOUT which is set to 700. If the LED outputs are on for longer than 700μs, the LEDs will be deactivated.

Oscilloscope screenshot showing active low pulse on the yellow channel and no pulse at all on the cyan channel and the finite response we expect on the magenta channel
Response is as we expect with the exit signal on channel 2 (cyan) removed.

With the device programmed, and the second channel on the function generator disabled (simulating the second gate missing the BB entirely), we now have a 716.8μs pulse. If we needed exactly 700μs, we could definitely optimize this further, however the code is doing exactly what it needs to at this point.

Oscilloscope screenshot showing no pulse on the yellow and magenta channels and an active low pulse on the cyan channel
It’s also as we expect with the entrance gate pulse (yellow) removed.

As we’d expect from the code, with no start pulse on channel 1, there is no reaction from the microcontroller.

Oscilloscope screenshot showing _ on the yellow channel and _ on the cyan channel and _ on the magenta channel

Finally, with both function generator channels enabled, our pulse is as we’d expect to see—switching on with the first pulse and off with the second.

Long Term Testing

I wanted to make sure we wouldn’t run into any overflows anywhere, so I left the setup running for around 9.5 hours, or 1,000,000 pulses. At the end of the period, the scope looked exactly as I left it, with everything functioning nominally. For the next 24 hours, I would switch on or off a channel on the function generator every time I walked by it, and at the end of the 24 hour period the device was still functioning well.

It appears that, for this project, MBED is going to be the perfect mix of functionality, ease of use, and speed of development. We also ended up not needing any latching of the signal, as the microcontroller is very capable of catching the pulse from the light gate, which will simplify the electronics further.

One Final Change

In the first article in this series I mentioned that I wanted to use the LPC11U12FHN33 microcontroller due to its compact size and low cost. The code I’ve compiled for the LPC11U24 *should* work on the LPC11U12 just fine, however, MBED have mentioned in several forum posts that you should really only use firmware for the exact chip configuration that is on the dev board, including the packaging, or weird things can happen. A friend of mine had this issue recently, in which he had compiled code that worked great on his dev board, but exhibited some strange behavior in his product which used a different package. I certainly can’t blame MBED for this, as most compilers would want you to select the exact part number you are compiling for. That being said, the LPC11U24 in the /401 package on the dev kit has a fairly large footprint—larger than I’d like to use on the circuit board for this.

As we’re only making a couple of these, the extra cost per unit is fairly negligible for a microcontroller upgrade when we are installing over hundreds of dollars (USD) worth of LEDs on the boards. I also have the MBED supported Embedded Artists LPC11U35 breakout board, which features a QFN package microcontroller instead of the QFP on the LPC11U24 dev board. This package change saves a significant amount of board real estate.

So after a quick change of target board in MBED and a switch of the input/output pins, the code is compiled and running on the LPC11U35 instead.

Oscilloscope image showing the response of an LPC11U35 instead of the LPC11U24
The response of the LPC11U35 instead of the LPC11U24

What I find very interesting about the code running on the LPC11U35 is that somehow, we have a much shorter period between the interrupt and the output pin state change. Both microcontrollers offer a 50MHz max speed and are running on a 12MHz crystal oscillator and, ostensibly, have the same architecture internally.

Well, whatever the cause, I’ll happily use this as an excuse to switch to the LPC11U35! A 24 hour test run with the LPC11U35 was also highly successful.

Next Time

We now have the test firmware completed and working reliably. We’ve selected our final microcontroller, and all of our electronics are tested (other than the basic linear regulator used to drive the microcontroller, which doesn’t need any prototyping). We’re finally ready to start on the PCB design in Upverter.

In the next article, we’ll be tackling the schematic capture, PCB layout, and output generation of the manufacturing files to send off to a PCB fabricator.

How to Choose ADC ICs for Your Next Project

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - How to Choose ADC ICs for Your Next Project

Whether you are sensing temperature, humidity, distance, or any other input from a sensor, chances are you will need an ADC to convert the incoming analog signal to a digital signal. Digital signals are easier to process and transmit around a board. When you are designing a data acquisition system from scratch, choosing the right type of ADC is an important task as it will impact the system’s performance and budget. Here’s how to choose ADC ICs for your next PCB and what you need to know about their different operating parameters.

How to Choose ADC ICs

One might argue that platforms like Arduino have a built-in ADC, so why bother with another ADC in the system? The ADC in an Arduino is a 10-bit IC with 4.9 mV step size. For low level signals, you might need a higher/lower resolution or a different step size. In either case, your optimum solution may be to design your own board with an ADC and a microcontroller.

In today’s components market, there is a huge number of ADCs available, each with different topology, resolution, power consumption, price, and other performance aspects. The following figure should give you a good idea of the difference between bandwidth and resolution in different types of systems. This should give you a good idea of the frequencies you’ll be working with and the resolution required for accurate digital conversion in a number of applications.


Resolution vs bandwidth for different applications [Image source]

It is tempting to think that picking an ADC with the highest possible resolution is the best choice for your system, but this is not always the case. While it is true that you need to consider the resolution of your ADC, you also need to understand the range of frequencies it can reliably convert into a digital signal. This is your bandwidth. As an example, if you want to measure distance or proximity (shown in the teal box above), your sensors will likely produce signals in the 1 Hz to about 20 kHz range. The bandwidth of your ADC will need to cover some portion of this signal range if you want to gather accurate measurements.

Types of ADCs

There are many ADC architectures for high precision applications, including Flash, high-speed, and sigma-delta. The choice of architecture is usually determined by the resolution required and the rate at which the input signal is sampled. This actually brings up another important point regarding ADCs; the sampling rate for your ADC needs to be at least double the largest frequency you want to sample.

The most common architectures for imaging, measurement, and data acquisition systems are sigma-delta, successive-approximation register (SAR), and pipeline ADCs. A general distribution of resolution vs. sampling rate is given in the following figure, which provides an idea regarding which ADC best suits a given system.


Resolution vs sampling rate for various ADC architectures [Image source].

This figure tells us something important: there is always a trade-off between resolution and sampling rate. Hence, reaching high resolution is more challenging when you are trying to sample a higher frequency. Let’s look at each ADC topology to understand how this works:

Sigma-Delta ADC

These ADCs work well for high precision (16-24 bits) and sampling rates of a few hundred Hz. There are two important processes used in a sigma-delta ADC: oversampling and noise-shaping. Details on implementing each of these signal processing steps are outside the scope of this article.


Successive approximation register (SAR) ADCs are by far the most popular ADC used in data acquisition systems. They have resolution of 8 to 16 bits with sampling rates up to several MHz. They also have small form factor and low power consumption.

Pipelined ADC

These ADCs are more popular for sampling high frequencies, which can range from a few MHz to hundreds of MHz with resolution of 8 to 16 bits. Some applications include imaging and video systems, high precision RF measurement systems, and Ethernet or wireless transceivers. Pipelined ADCs suffer from initially low latency (i.e., response time), but afterwards they have high throughput.

Placing an ADC in Your PCB

Once you’ve decided on the type of ADC you want to use in your board, you will need to carefully place it in your layout. If you properly designed the ground plane for your board, you’ll have separated your digital and analog portions into different sections. Note that, when working with low frequencies, it is appropriate to place a notch between the two ground sections, but make sure the entire ground plane remains an unseparated copper region.

You’ll need to place the ADC so that it overlaps the split between the digital and analog ground regions. This is appropriate as modern ADCs generally separate the analog and digital pins onto different sides of an ADC. This allows you to route your analog lines to one side of the ADC and the digital output on the other side. It is best to place the ground pins on the ADC as close as possible to the connection between the digital and analog sections of the ground plane. This helps prevent transient noise from the digital side of the chip from interfering with the analog side.

Now that you understand how to choose ADC ICs, you can start with your resolution requirements. One important thing to consider at this point is power consumption. If your design will run on a battery, then you might need to consider sacrificing some resolution to conserve battery life. The output will have some delay, so latency of your ADC should be tolerable. Some applications have severe area constraints, so you might want to use a single ADC in a time-shared fashion rather than multiple ADCs. This will mean a reduction in sampling frequency, but it cuts down on area and power. Also, check the voltage compatibility of the ADC and your microcontroller.

Upverter® gives you an easy, browser-based platform for designing boards from start to finish. You can easily pick an existing template from a vast range of open-source designs and you can also choose from a vast library of verified components. These standard design features are accessible from anywhere by multiple collaborators.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.

Ethernet PCB Layout in Your Design

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Ethernet PCB Layout in Your Design.jpg

Ethernet is the traditional technology for connecting wired local area networks (LANs), allowing devices to communicate with each other via a standardized protocol. Since it is a local area technology, it is used mostly for networks operating within a single building. You can use Ethernet to connect your new board to the internet, where you have the freedom to save, retrieve, and visualize your data in a browser.

For some designs it is essential to have some level of remote connectivity for data transfer, monitoring, and sometimes for firmware upgrades. Connecting your project to a LAN allows you to tunnel into your board via SSH and modify software when required. Adding Ethernet to your board requires following some particular routing standards and choosing the correct parts for your board.

Design Considerations for Ethernet

Low cost PLDs, like simpler FPGAs and MCUs, typically need to communicate with an external Ethernet controller via SPI. This external controller provides medium access control (MAC), which is governed in its own firmware, and it acts as the physical layer (PHY). This integrated MAC/PHY then connects to the RJ45 connector using a standardized routing scheme. This is shown in the image below.


Ethernet controller for connecting your device to Ethernet [Image source]

Although the MAC and PHY blocks can be integrated into an external Ethernet controller, some newer MCUs include their own integrated Ethernet controller. This means you won’t need to use an external controller IC. Make sure to check the specifications of your MCU/FPGA before searching for an Ethernet controller IC.

Some examples of Ethernet controller IC are the ENC28J60, W5100, W5500, and many others. The RJ-45 connector can also be packaged in a single device, known as Mag-Jack. Using one of these components eliminates the need to design your own magnetic termination circuit. It should be noted that the Ethernet protocol standards clearly state that you must use a transformer on the Ethernet port in order to provide isolation and to remove any DC bias on the signal.

The image below shows an example of a simple RJ-45 Mag-Jack breakout board. The connector on this board includes the magnetic termination circuit required to isolate the connector. This board can be easily soldered to a standard header on an existing MCU board or on a shield board.


RJ-45 Mag-Jack breakout board

When creating an Ethernet PCB layout, the designer needs to choose the maximum data rate, physical media (i.e., which type of cable), and duplex mode. In embedded systems design, one of the most common speed choices is a 100Base protocol (100 Mbps); anything faster is unnecessary as MCUs are not equipped to handle higher speeds. Going to a GBase (1 Gbps) protocol requires a faster processor and controller. Most development boards that include this level of processing power will already include Ethernet; BeagleBone Black and Raspberry Pi are great examples.

Sometimes, it makes more sense to use 10 Mbps, depending on the speed of other devices in your LAN. This will definitely bring a cost advantage, and you might not notice the difference in communication speed unless your network has heavy data traffic or you need to transmit large amounts of data to/from your device. For example, if you are implementing Ethernet external to the MCU, Microchip’s ENC28J60 10 Mbps Ethernet controller is slightly lower cost than their ENC624J600 100 Mbps controller.

Using Ethernet Shields

If you are working with development board like Arduino or Raspberry Pi, then this task becomes easier. Raspberry Pi already has an Ethernet port where you can directly connect the cable. Here is an excellent tutorial for connecting Raspberry Pi to Ethernet.


Connecting Raspberry Pi 3 Model B to Ethernet

Arduino doesn’t have a direct Ethernet port, but there are shields available on the market that you can connect to your Arduino board. These shields are basically Arduino-compatible boards that have similar layout and contain an Ethernet controller (either Wiznet W5100 or W5500), and an the RJ-45 Mag-Jack. If you are looking for something cheaper, you can easily find small Ethernet modules for around $10. These modules are small in size, but they have limited speed (10 Mbps). Before you buy one, make sure to check pin compatibility and voltage levels. There are a lot of libraries available that can be used and many examples to help get your design up and running.

Ethernet PCB Layout for Your Own Board or Shield

If the available boards do not suit your specification or you need to meet certain area (footprint) or power constraint, then you might want to design your own board or shield. Signal traces from the controller to the RJ45 connector should be routed as short as possible on a single layer, and traces should be routed in a straight path. Try not to bend a trace by more than 45 degrees.

If your MCU/FPGA does not include the PHY layer, and you are not using an integrated Ethernet controller, the MCU/FPGA will act as the MAC layer and will need to communicate with an external PHY IC to drive signals over the RJ45 connector. Routing between the MAC and PHY layers uses MII or RMII routing, depending on the speed you are working with. Once you understand how signals are triggered in each layer, it becomes rather easy to route traces between the various components.

Upverter® provides a great library of reliable components where you can easily find the parts you need for your Ethernet PCB layout. If you are looking for an Ethernet controller, you can find the ENC28J60, W5100, W5500, and other controllers in the parts database. You can find the SI-60062-F, J0011D01BNL, or JXD1-0001NL RJ45 connectors, all of which have built-in magnetics. Here is a great example of an Ethernet controller module with W5500, which you can use as a template.

As a cloud-based PCB design tool, Upverter gives users the ability to share their designs, control revisions, and store design data in a secure online repository which is accessible from any location. You can browse thousands of open-source designs in Upverter’s projects database and pick one to customize for your new design. 

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.

Choosing and Adding a Display for Arduino Projects

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Choosing and Adding a Display for Arduino Projects.jpg

Many projects that collect data of some kind can be made more user-friendly if a display is added directly to the device rather than using a serial or HDMI monitor. This can also act as an input device if a touchscreen is used. There are a variety of display options available on the market, and Arduino shields are available which provide an easy way to interface with a display for Arduino projects. Let’s take a look at what you can add to your next Arduino project. 

Liquid Crystal Display

These are the most common type of displays used in simpler projects. They are simple to operate, consume a small amount of power, and are very cheap. They usually include an array of characters, with some displays having a backlighting option for ease of reading in low light. It is possible to attach them directly to an Arduino, but they use many pins on the board. An I2C adapter can be used to control the display with only 4 pins.

These screens more desirable than a 7-segment display as they can display a large variety of characters. There is a LiquidCrystal library that you can use to control the LCD, although you will need a different adapter if you are using I2C. Here is a video tutorial on how to set up and use this type of display.


A 16×2 LCD display that can connect via I2C

7-Segment Display

These are simple displays with 8 LEDs (7 lines and 1 dot) that work pretty much like any LED, where a forward bias will light up the diode. Different numbers or characters can be formed by selectively lighting the segments. They are available in either common anode or common cathode configuration. A good tutorial for using these simpler displays can be found here, where you’ll learn how to interface this display with an Arduino board. These displays come in a variety of sizes ranging from single digits to an array of characters. If you just need to display numbers or a small number of letters (for example, with a door keypad or a timer), then you can give your project a cool retro feel with 7-segment displays.


7-segment display (single and array)

5110 Display

These displays were used in old cell phones, where the background was grey and the font was simply a darker shade of grey. These are monochrome LCD displays with 84×48 pixel screen size. These cheaper modules can display text (even multiple lines, depending on the library being used) and images. Although the refresh rate is slow for animations, they work well for simple text display. This display usually comes with a backlight. It has a CMOS LCD controller and these displays only run at about 0.5 mA when on without backlighting. They also have a sleep mode, making them convenient for battery-operated devices.


5110 LCD display from Adafruit

OLED Display

If you are looking for something more than a 5110 LCD display, an OLED display can be a good option. At first glance, they look like the 5110 display, but they are significantly better. While the standard screen is 0.96” in monochrome with 128×64 pixels, they are available in a variety of sizes and colors, offering a versatile display for Arduino projects. Their refresh rate is also higher than many other displays. They can communicate with Arduino using I2C, so they do not use a lot of pins. These displays are usually thinner and lighter than an LCD, and they provide higher contrast than an LCD because no backlight is required. The price for these displays is slightly higher than a typical LCD.


OLED display for Arduino projects


Thin-film-transistor (TFT) LCDs are a step up in quality when your project requires a sophisticated display. They are available with or without touchscreen capabilities. They provide high resolution and can display thousands of unique colors. Often they have an SPI interface that integrates naturally into Arduino boards. They consume more power than other displays, but the display quality is better and they come in a similar price range. They usually come with a shield for easy integration. Touchscreens can be especially useful for cases where projects need user feedback and input.


TFT LCD that connects to a standard header

The TFT LCD shown above connects to a standard header with pins, but more advanced TFTs can connect to an Arduino or other board with a flex cable. These boards can’t connect directly to a standard Arduino, but they can connect to a standard or custom shield board. Make sure to check how your display connects to your Arduino project as you may need to purchase or design a specific shield.

E-paper Displays

As the name suggests, an E-paper display (commonly found in E-readers) is intended to have the same look as natural paper. They differ from LCD and OLED displays in that they do not emit light, but rather reflect it, making the display very comfortable to read. Another great aspect of these displays is that they can store data for a long period of time without consuming power. This means they can display text or images after they are turned off, making them perfect for low power mobile Arduino projects. Here is a tutorial for using them with Arduino.


E-paper display

Use a Shield to Add a Display for Arduino Projects

Any of these displays can be a great addition to a new Arduino project. The choice of the best display depends mostly on the display quality you desire and your intended budget. They usually have a shield or can be interfaced directly to the Arduino header pins. Many projects may require multiple components, rather than just a display. It may be better to design a custom shield that can be used to interface with more than one component.

If you’re interested in designing a custom display shield for your Arduino board, Upverter® provides an easy, browser-based platform for designing new PCBs from start to finish. You can easily pick an existing template from a vast range of open-source hardware projects, or you can import Arduino shield templates from Eagle libraries, available from Sparkfun or Adafruit. You can then proceed to lay out the design and make your own shield.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.

Desktop PCB Design Software vs. Online PCB CAD Tools

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Desktop PCB Design Software vs. Online PCB CAD Tools.jpg

Anyone who is reading this article has already designed their own PCBs in the past, or intends to in the near future. Whether you are a professional or a hobbyist, every now and then the question of which PCB design application is most suitable for your application will come up. And the answer to this question is…it depends!!!!

As far as personal choices go, everyone wants different things from their design software, and everyone has a different level of expertise with their software. Sometimes, the choice of an appropriate PCB design package is governed by your available resources and the required investment. Today, we can divide available software into two categories: desktop applications and online PCB CAD software. Let’s take a look at both categories and their advantages, difficulties, and some popular applications in each category.

What’s the Difference Between Desktop and Online PCB CAD Software

As its name implies, desktop applications must be installed on your local machine. Once you do download and install the software, there is no need for an internet connection to use this software. Online PCB CAD layout tools do not need to be installed on your local machine, although some online tools provide an optional desktop version. This allows users to access the software on-demand. Users don’t need to worry about installation, keep track of their file structure, or worry about constantly compiling and downloading component libraries. However, users must have internet access to use the software.

Who Benefits from Desktop PCB Design Software

Some of the most popular desktop design platforms are Altium Designer, CircuitMaker, Eagle, KiCad, and OrCAD. These are heavy-duty software packages that come with a ton of features; you’ll normally need a license to run a full-featured version. While most of these are Windows, Mac, and Linux compatible, some might need Wine to allow the program to run on a linux-like platform. Once installed, one doesn’t need the internet to work on projects, but usually any work will require frequent data storage, sharing, retrieval, and occasional software updates.

All design data is stored locally on your computer’s HDD or connected storage. You can use some cloud-based storage platforms like Dropbox or Google Drive to save and backup design data. There is some version control software also available, which is preferable to manually transferring data every time you make changes to your design.

Another aspect which users must consider is data sharing. Whenever you are working as part of a team on a complex project, everyone needs a way to collaborate seamlessly on multiple portions of a design. Desktop applications cannot provide these capabilities without expensive addons or third-party software.



Desktop vs. Online PCB CAD tools

Online PCB CAD software

Web-based PCB design software is popular among the open hardware community. All you need is a browser that is compatible with your software and a decent internet connection. The leading names in online PCB CAD tools are Upverter, EasyEDA, and Multisim. Users need not concern themselves with software updates, but these platforms provide different features and disparate levels of support.

All the data is stored in the cloud and can be easily accessed from anywhere in the world. This gives designers freedom to share their data easily without using a separate cloud storage platform. One doesn’t need to worry about version control either because each design version is stored on the cloud.

Perhaps the most important benefit of using online PCB CAD tools is the ability to collaborate. This is where online tools stand out from desktop software. However, not all online PCB CAD platforms provide collaboration features. If you are working on a complex project as part of a team of designers, then you’ll need to ensure that the platform you want to use provides collaboration and data sharing features your team needs to track issues in new designs and make changes to a schematic or layout.

Collaborating in Upverter’s Online PCB CAD Tools

Upverter is an online PCB CAD platform that sets itself apart from other platforms. Here’s some of what makes Upverter different:

  • Import and sharing features. You can import an existing design (Altium, OrCAD, Eagle, etc.) or choose from a great selection of open-source designs from the community. You can design your schematic, layout and choose from a vast library of reliable components.
  • Collaboration and sharing. Collaboration for remote teams is easy in Upverter. Users have access to team-management and advanced access controls, providing multi-level permissions, instant notifications, and version control. Designers do not need to trouble themselves with hitting ‘Save’ each time they change something—Upverter automatically saves design changes in a Google Docs-style interface.
  • Customizable constraints. Upverter has an easy-to-use yet powerful constraint manager that allows users to customize DRC and DFM requirements. The constraint manager also reports violations in real-time so that you can fix errors before you send your board off for production. You can also prioritize rules, enabling you to manage multiple constraints targeting the same object. These constraints can then be examined in a final design review before you move to manufacturing.
  • 3D viewer. Upverter gives you a 3D preview of your layout directly in your browser.


Constraint Manager Upverter

With the online PCB CAD features in Upverter®, anyone has the ability to create custom projects from a unique browser-based design interface. The schematic design and PCB layout tools can help you take your design from start to finish and prepare for manufacturing. These standard design and production planning features are accessible from anywhere by multiple collaborators.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.

Building a Thermal Camera: Part 1

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Building a Thermal Camera_ Part 1.jpg

I have a couple of upcoming projects where a thermal camera would be very handy. These days, there are some amazingly feature-rich and relatively low-cost thermal cameras that can plug into your phone available on the market. Many of those utilize FLIR’s Lepton sensors, which are quite affordable for thermal sensors. Simply buying a thermal camera is a little boring. It’s considerably more fun to build one yourself. The commercial thermal cameras I’ve seen using FLIR Lepton sensors don’t appear to be using the latest revision, the Lepton 3.5, which is ratiometric and of higher resolution, thus giving better range. I don’t necessarily need the ratiometric output or the higher maximum temperature for my applications, but the high resolution is definitely welcome. In this article, I will be discussing what a thermal camera is, and how to build one instead of settling for a ready-made commercial one. As with my other projects on this blog, we will be going through the process of making the project together. I find this approach more purposeful than me finishing the project on my own, then writing just the successful steps, as it allows us to learn from mistakes together, and in turn, to understand why the final component choices and design decisions are better than their counterparts.

What is a Thermal Camera

We’ve briefly discussed thermal cameras, but what about regular ones? A typical camera, like a digital SLR or the camera in your phone, has a sensor that is sensitive to visible light and also extends a bit into near infrared and ultraviolet. These cameras process the sensor signal using bandpass filters to block the infrared and ultraviolet, and then a bayer array to allow software to determine the red, green, and blue levels of each pixel. You can therefore modify a regular camera to see just infrared—which gives some very interesting pictures. Note that because the camera is now only seeing infrared, the picture is black and white and has no colour information.

IR ImageNear Infrared photo of green foliage, Source: Mark Harris

Thermal cameras can’t see visible light at all—they see infrared—but not the infrared your typical camera’s sensor can see. A thermal camera sees radiated heat, which consists of long wave infrared. If you’ve felt heat radiating from a hot surface, or sat in outdoor seating at a restaurant that has heat lamps, that heat is long wave infrared. A typical camera is sensitive to 800-900nm infrared, which is why you can see the infrared LED in your TV remote with your phone’s camera. Thermal cameras see 10,000-14,000nm wavelengths instead. This means they can’t use a regular CCD or CMOS sensor, and until recent decades, the sensors needed to be chilled to near absolute zero to have any sensitivity at all. The Microbolometer array that makes up the camera is sensitive to heat, so building a camera that can see temperatures lower than ambient was a challenge until recent decades.

Because thermal cameras, like the near-infrared camera, only see one band, or ‘color’, its output is also interpreted as black and white. That being said, the FLIR Lepton, and many other thermal cameras can apply false color to thermal images allowing a greater range of temperatures to be displayed to the user. Typically, you will see this effect as ‘cold’ colors such as blue being used for lower temperatures, and ‘warm’ colours such as orange, red, and white being used for higher temperatures.

What is a Thermal Camera Useful For?

Thermal cameras are widely used for military and security applications. Although this was their traditional market, dramatically lower costs in recent years now allow for a wider range of commercial uses. When you’re evaluating the first prototypes of your new circuit board, for example, a thermal camera can show you which components are hot, and reveal how well heat is dissipated through your board. If you’re dealing with many watts of thermal dissipation for amplifiers, radios, power supplies, or motor drivers, a thermal camera can help immensely. Furthermore, if you’re trying to reduce your circuit board size, a thermal camera will quickly show which areas are not dissipating heat, and therefore can be removed. On the other hand, if your board is running much hotter than expected, you can still use a thermal camera to quickly see which areas of the board are not removing heat as efficiently as you had planned. Even if you are not trying to optimise the thermal capabilities of your circuit board, a thermal camera can allow you to rapidly analyze which components are overheating or performing badly when stress testing a board. This can allow you to see that a MOSFET or inductor in a power supply might need to be changed out for something more efficient, for example. Ultimately, using a thermal camera can save a lot of time glueing temperature sensors or thermocouples to every component you think might get hot, and looking through graphs of the component performance under load.

Other Components for the Project

In addition to the FLIR Lepton 3.5 sensor, we’re going to need some other components so we can read and display the image. As far as projects go, building a thermal camera is quite simple if you use components that are a little expensive instead of trying to cut on costs.


The FLIR Lepton 3.5 has a resolution of 160×120 pixels, which means we ideally want a display with that many pixels, and not a lot more. To make software development easier, it would be great not to have to deal with scaling the image. For my project, I want something fairly compact, so a big beautiful display that needs image scaling isn’t going to suit my requirements in any case.

A friend has been using a lot of cheap SPI displays featuring the ST7735S controller, which look really amazing in his devices. Given the price of displays using the ST7735S controller, it’s difficult to justify using anything else for a prototype.

On an online marketplace, I found a number of 1.8 inch 160×128 pixel displays, either on a breakout board or just the display. These will be perfect, as I can use the breakout board for testing, then integrate the display into a 3D printed enclosure to save space. These displays are also readily available at electronics prototyping/maker supply sites for similar prices, which are much easier to order from if you are in North America rather than the United Kingdom.

I generally don’t like buying displays and such from online marketplaces, as I’m never quite confident about what I’m getting. I’m only willing to take that risk for this project based on my friend’s good experience. The breakout board I have purchased claims to be an SPI display, but the pins are marked as SCL/SDA, which would make it I2C, yet it also has a chip select pin. During the next article in this series where we build the project on a breadboard, things could get interesting when trying to interface with the display!


Now that the display and the sensor are defined, we have an idea of what sort of processor capabilities we might need. I’m only going to be building one or two of these cameras, so the cost of the microcontroller is mostly irrelevant compared to the cost of the thermal camera module. I’d really like to store the whole image frame in RAM without having to use external RAM on the microcontroller, so I’m looking for a controller that has enough RAM for a basic application, plus 128x160x24bits of memory – 491,520bits (62,440bytes) + application. This will allow me to do my own color scheme on the data if I want, or perform any transforms I want to add down the road. The x24bits is for the 8 bits per red, green and blue colour channels.

I’d like to use a microcontroller supported by both the microC Pro for ARM compiler and the online MBED compiler, as I’m not sure which I will use for this project yet. It would also be great if I already have the dev board for it, which means I’m looking at STM32 controllers, as the NXP LPC and Kinetis boards I have which are MBED compatible are not supported by microC Pro. STMicroelectronics tend to incorporate far more RAM and flash in their ARM Cortex controllers than anyone else, which is great for an application like this.

I’m using the STM32F413 as a starting point for another project on the blog, so let’s use that as the starting point for this project too. It’s got 320 kilobytes of RAM, which would allow me to double buffer the image and do all sorts of processing on it if I wanted to in the future. As the code written for the STM32F4 is compatible across the series, we can switch to a cheaper option after we have the firmware developed and have a clearer idea of the memory requirements. This is one thing I really like about STMicroelectronics ‘cheap dev boards’ philosophy: it allows very easy testing of multiple controllers for your project, typically at a lower cost than a single board from a competing vendor.

Thermal Camera Breakout

To save time making a PCB just to mount the thermal camera module on, I would really like to find a breakout board for the FLIR Lepton 3.5. A breakout board should have the multiple voltages the camera module requires taken care of, and just give me the signals I need. When the Lepton series was first released, it caused a lot of excitement and there were several breakout boards available. Sadly, it seems to be much harder to find one now.

I managed to find a breakout board in stock on Digi-Key, however it appears to be a last time buy item. Sparkfun and others, which sold breakout boards for the Lepton, no longer seem to stock them either, which is a bit disappointing. The breakout board predates the Lepton 3.5, however, after digging through the datasheets it appears that the entire Lepton series is pin compatible, just varying in the SPI command set as new capabilities and higher resolutions have been added. 

The most readily available dev board for the Lepton series at the time of writing is a very cool board that has an onboard STM32F4, which turns the thermal camera module into a USB webcam. As neat as this is, it’s not much use to me for building my own camera system using the Lepton on a breadboard!

Coming Up Next Time

Once the selected components are delivered, we’ll start evaluating them to ensure they are the right choice before commiting to a PCB using them. This will give us a high probability of success on the first revision of the circuit board, as well as confirm that each pin we used on the microcontroller is valid for our purposes. We’ll also get to the bottom of the interesting markings on the display board, and determine if it’s bright and clear enough for our little thermal camera.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.


How to Choose a Voltage Regulator for Your PCB Design

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - How to Choose a Voltage Regulator for Your PCB Design.jpg

Unless you are working with a purely AC system, your PCB will need to receive stable DC voltage to operate properly. A voltage regulator circuit provides the necessary DC voltage with fixed magnitude, even if the input voltage (line) or the output current (load) changes. Some circuits are more sensitive to voltage fluctuations than others, and some power lines are noisier than others. Any designer should understand how to choose the right voltage regulator for their board. Let’s take a look at the different types of DC regulators and go through some factors to consider when selecting a voltage regulator.

Types of Voltage Regulators

Voltage regulators are normally placed on the output from a full-wave rectifier circuit in order to remove the remaining ripple waveform. There is more than one way to classify a voltage regulator, but for the moment we will stick to linear and switching regulators. These regulators can be added to a layout relatively easily and provide reasonably stable output voltage for most applications.

Linear Regulators

Linear regulators use a BJT or FET to stabilize the supply voltage and are controlled with an amplifier. The amplifier compares the output voltage from the regulator to a precision reference and changes the transistor to maintain a constant output voltage. Linear regulators always step-down the output voltage (i.e., input voltage > output voltage). Linear regulators with low drop-out voltage are called low dropout regulators (LDO). Linear regulators provide the following advantages:

  • Low Noise: As there is no switching involved, these regulators generate low noise and are best used for powering sensitive circuits. In contrast, switching regulators are inherently noisy as they switch frequently in order to maintain the output voltage.
  • Low power: When properly designed, linear regulators can operate with quite low quiescent current. Switching regulators use complex feedback systems and end up using higher quiescent power. When operating as LDOs, these regulators can have very high efficiency (~90%).
  • Low cost: Linear regulators are less costly, and they are easy to add to a layout. They do not require too many components and filters. Usually, a capacitor is placed across the output to help regulate the output voltage.

linear-regExample linear regulator circuit

Switching Regulators

A switching regulator converts an input DC voltage to a more stable DC output with a power MOSFET or BJT switch. The output from a switching regulator is usually filtered and used to reduce switching noise on the output voltage. There are three types of switching regulators: buck (step-down), boost (step-up), and buck-boost (can provide step-up or step-down). Switching regulators provide the following advantages:

  • High efficiency: Since switching regulators work in either off or on mode, they tend to be more efficient. They can provide 90% or greater efficiency, which is very difficult in most linear regulators unless they are designed to as LDOs.
  • Step-up configuration: Linear regulators can only step down the input voltage, but a boost switching regulator can step-up the voltage. This is particularly useful in the case where a large voltage is required for a short period of time (e.g., the backlight in a camera).
  • Thermal performance: Linear regulators are less efficient, which means they tend to dissipate more heat and need a heat sink. Most switching regulators do not need heat sinks.

The buck and boost characteristics can be controlled with a PWM waveform, which makes this regulator ideal for use in applications where specific voltage levels are required. For example, you can use the PWM output from a microcontroller to power another circuit with a specific voltage level. There are many different ways to build a switching regulator IC, and we can’t possibly show every possible circuit. If you are interested in learning more about specific circuit layouts for switching regulators, take a look at the datasheets in your parts library.

Important parameters for choosing regulators

One question I often see on forums is how to choose a voltage regulator for different applications. There is no single answer to this question. You should consider the following characteristics when looking for a voltage regulator; note that these aspects apply to both linear and switching regulators:

Output voltage

If you need a step-up regulator, then you will have to use a switching regulator in boost configuration. If you are using multiple supplies in a system, typically one regulator is used for each supply. Regulators usually supply a fixed output voltage, although there are some regulators available on the market which you can use with some adjustable settings.

Efficiency vs. Noise

Switching regulators provide higher efficiency than linear regulators, but they generate more noise. Unnecessary electronic noise can interfere with other circuits when the regulator outputs high current. If you want your product to hit the market, it can be more difficult to receive EMC certification. If other circuits on your board are sensitive (e.g., purely analog components), then it’s better to choose a linear regulator.

Selecting a regulator with high power losses can make it almost impossible to meet efficiency goals. Linear regulators are less noisy, but they are very inefficient (except LDO), meaning some power gets converted to heat. If your regulator will run at high current, you should include heat sinks on the board. If you don’t have room on the board for a heat sink or if power dissipation is a concern, then a switching regulator might be a better option.

shutterstock_744239These 7805 linear voltage regulators from Fairchild include a heat sink on the back of the package.

Transient response

When output current changes quickly, there is a small spike at the output. The voltage regulator takes some time before it switches back to the same voltage. This is called a transient response. The transient response is usually a function of the output capacitance and load current. A fast transient response ensures that the regulator can deliver the required power. Check your component datasheets and look for the recommended bypass capacitor you should include on the regulator’s output.

Voltage Regulator Layout Considerations

Once you have chosen the right voltage regulator for your design, you’ll need to place it in the proper location on the board. In general, you will need one capacitor between output and ground, and one between the input and ground as close to the pins as possible. You should also carefully design traces so that they can carry the required current without overheating.

If you take a look at some of the open-source projects in Upverter’s™ project library, you’ll find some good examples of regulator layouts that you can use as a reference for your next project.

boost-reg-boardBoost converter control board from James Fotherby, created in Upverter.

A good layout tool makes it easy to design schematics for your board and capture it as an initial layout. Upverter® provides a huge library of reliable components that you can easily add to your schematic and layout, including a huge range of voltage regulators and much more. As a cloud-based tool, Upverter allows users to easily share their work, control revisions, and access their data from anywhere.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.

Project: Environmental Control System, Part 1

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Project_ Environmental Control System, Part 1.jpg

A while ago, I reached out to a YouTube channel which I support on Patreon to ask if the user  required any custom electronics for his projects. He recently got back to me and we have a new project! We’re going to build an environmental monitoring and control system. He is building an experimental Mars base in the middle of the desert, and needs a custom system to monitor and control carbon dioxide (CO2) levels inside, primarily in the area he will be using for growing crops. The plants will consume CO2 as they grow, and animals (such as humans) living in the habitat will produce CO2 as they breathe. If CO2 levels rise too high, it could become dangerous, so air will need to be pumped through CO2 scrubbers, and if CO2 levels get too low, then CO2 will need to be released from a tank.

These were his only requirements, but I thought it would be fun to also include traditional environmental sensors, such as temperature, humidity and index of air quality. Furthermore, to display readings, it would be nice to use a 5-7” TFT capacitive touch screen to give something big and beautiful to look at.

Our specifications and requirements are fairly broad, which gives a lot of leeway for creativity as we go through the design. As with my other project articles, we will be planning and building this as we go. When mistakes are made we will learn from them together, and we will go through the thought process together when we encounter scope creep or find we need to modify the design.

Requirements and Specifications

Required functionality:

  • Read CO2 levels from the atmosphere.
  • Maintain CO2 levels utilizing CO2 scrubbers and tanked gas.
  • Display current and historical CO2 levels on a display.

Nice to have:

  • Temperature monitoring.
  • Humidity monitoring.
  • Index of Air quality monitoring.
  • Networking for multiple sensors in multiple areas of the habitat.

Part Selection

The most critical part of this design is whether or not we can find a CO2 sensor that will meet the requirements. Everything in the design relies on being able to sense CO2 levels accurately and reliably. The other sensors are more because I love collecting data, and it makes sense to build a full environmental monitoring system.

Carbon Dioxide Sensor

As usual, I start out at DigiKey because I’m most experienced with digging through and filtering DigiKey’s data. The other major suppliers all have great filtering mechanisms too, however, as I’m most familiar with DigiKey, I look at them first.

I’m looking for a gas sensor, so naturally we’re looking in the Sensors, Transducers > Gas Sensors category for in-stock parts that have an Active part status. If I need to make more of these devices months or years down the road, I don’t want to pick a part which is already obsolete or not recommended for new designs, and may not be available once current stocks run out. I’m filtering for anything that includes CO2 as a gas type parameter, then sorting by price.

Sensirion – SCD30

The cheapest result I found is the SCD30. Its datasheet looks pretty good, and it’s an I2C based sensor which is fantastic for getting accurate measurements from. This is definitely a good candidate; I’ve used Sensirion sensors in the past, and they left quite a positive impression on me. They have been easy to interface with and performed to the advertised specifications.

The dev kit for the SCD30 is quite expensive. While not necessary, a dev kit can provide a nice working implementation that is good for attaching a logic analyzer to if there are difficulties getting your own code to work with the sensor.

Amphenol – T6713

With a bit of a jump in price, the T6713 is a nice shiny gold sensor that’s a bit smaller than the SCD30, and works over a wider temperature range. It has higher precision, and has a self calibration routine built in to ensure optimal accuracy as long as the ambient carbon dioxide levels drop to around 400ppm a few times a week. Amphenol also have other types of sensors that do not need self-calibration, but are not as accurate.

My main concern for this sensor is it’s advertised high power consumption. I haven’t been told to optimize for power consumption, but if it does become a requirement in the future, it could rule out this sensor, especially if real world current draw is as high as the advertised figures. My experience with gas sensors in the past makes me feel as though turning the sensor on just to make a measurement will not give me as accurate readings as leaving it on all the time, because gas sensors typically like to be on all the time to run calibration routines and to keep the sensor elements activated. I don’t know what the internals of this sensor are, or if the calibration data is stored in non-volatile memory internally, so I can’t be sure my past experience applies to this sensor. When selecting parts, you typically try to reduce engineering risk, and get your new project off the ground as quickly as possible. This can very much make past experience with similar sensors influence the choice of parts in your newer projects.

A secondary concern for this unit is the self calibration, which also makes it accurate. With the sensor being installed in a closed habitat, it could completely skew the calibration data. The sensor is expecting levels to drop to the global average of around 400ppm, and uses the low point of its readings in a given period as a calibration reference. If we are artificially creating a low point by using CO2 scrubbers, or the crops that are growing consume CO2 bringing the levels below 400ppm, it could take the calibration too low. Likewise, if the environment never reaches 400ppm in a week, with elevated CO2 levels continuously present, it could easily skew the calibration to a higher percentage. The CO2 levels being too low is not great for the crops, and likewise, the CO2 level calibration shifting too high could be very dangerous to anyone living in the habitat. With this in mind, the sensor will need to be tested in an elevated CO2 level environment for at least a week to see what happens to the readings.

The dev kit, on DigiKey at least, is cheaper than the sensor itself. This is not the case at any other supplier, so perhaps it’s a temporary glitch. The fact the dev kit is cheaper than the sensor is pretty exciting, STMicroelectronics do this a lot with their ARM dev kits which makes them really affordable to start a project with. I love this model, as it makes trying out a device so much easier than dev kits costing hundreds of dollars, and makes it much more likely for a device to end up being used in my product.

Based on the dev kit prices, I’m going to give the Amphenol T6713 a try in this project. If it doesn’t meet the expectations, I’ll switch to the Sensirion SCD30 as my second choice. As we’re only building a couple of these units, the unit cost for the sensor is far outweighed by software development time. I’m providing this device for free, but my time still has value to me.


I rarely use a microcontroller outside the ARM Cortex range, so I’m looking for an ARM Cortex M0 or M3 which has a dev kit (ideally one I already own), lots of RAM for graphics, USB and a decent number of pins for running a parallel display.

For this project, I feel as though MikroElectronica’s IDE might be the best option, due to the VisualTFT option for designing user interfaces quickly. So the microcontroller I choose needs to be supported by mikroC PRO for ARM. For dev kits I already own, this means I’m looking at a controller from STMicroelectronics, as I already have most dev boards they produce.

The cost of the microcontroller is pretty negligible in terms the total cost of this project. So as mentioned before, ST’s habit of offering an expensive microcontroller on a cheap dev board is definitely going to encourage me to use an over-the-top option for a microcontroller just for ease of use. If I was planning to build hundreds or thousands of these units instead, I’d be looking to optimize for price.

Since I’m not certain of my processing requirements, I’m going to start with an STM32F413 dev board, and look at switching to another processor if I find I need more or fewer resources as we go through the breadboard stage. The code compiled with mikroC will work on any supported platform, and could also be ported to a PIC or AVR just by switching IDE.

I specifically mentioned fewer resources as there are some interesting options for displays which could heavily influence the amount of resources required.


As with the microcontroller, I need to find a display that has a controller supported by MikroElectronica’s VisualTFT software. The options cover the vast majority of the displays on the market, so it’s not particularly restricting to a choice.

MikroElectronica’s store has a good range of displays at reasonable prices, so to keep things simple for this project, I’m just going to order a display from their range. Again, we’re not optimizing for component cost on this project, we’re optimizing for minimal development time. Using a display that has a good datasheet and is known to integrate well with the development environment will potentially save me a significant amount of time over choosing a display from an online marketplace which would save me 20-30% of the cost of the display, or a 10% reduction in the total project cost.

I mentioned earlier that perhaps we will not need much memory depending on the display option. Well, the FT813 display controller is the reason behind that. It’s a display controller that allows you to build up a user interface, including touch screen capabilities, via SPI. One feature that really attracts me to the FT813 is the integrated ability to draw a bar graph. It might not seem like a huge deal, but when displaying environmental data, being able to offload the render and display of historical data could save a lot of programming time and a lot of memory.

So with that in mind, we will be using the FT813 display option from Riverdi, a European company that builds displays in Europe. They have a nice model with a bezel, and capacitive touch that has caught my eye, the Riverdi Display 5” UXB.

If we end up finding a reason not to use that, then a display based on the SSD1963 with capacitive touch would be the next choice. The TFT Proto 5 Capacitive touch screen display is only a few dollars cheaper and works over a parallel connection. A quick look through the SSD1963 shows that we’ll need to build the image in memory to send to the display the old fashioned way. This would need 9,216,000 bits of memory if we buffered the entire frame at once! Since we won’t find a microcontroller with that much memory on-chip, we would have to either implement external memory, or render line by line. This is where VisualTFT could come into play, allowing us to take care of a lot of the rendering effort with very little engineering effort.

Environmental Sensors

On my nice-to-have list, I have a few environmental properties to monitor, and after looking through sensors, I finally found the recently released Bosch BME680. It’s relatively cheap, and has all of the functionality I want built into one tiny package. Compared to other sensors that implement an Index of Air Quality output, this is but a small fraction of the cost of just an IAQ sensor. I’d be very interested in this device purely for the temperature and humidity sensors, and while I always love playing with a new sensor, having IAQ seals the deal for me. If it doesn’t work out the way I’m hoping for, I have a bin of temperature/humidity modules that can stand in for it. Then, we can skip the IAQ metric if we find during breadboarding that this device is a pain to deal with. Nevertheless, given that it’s from Bosch, that’s pretty unlikely.


I’m skeptical of the need for wireless networking on this device. It would be great to have a network of sensors throughout the habitat that can monitor the environmental conditions in each ‘room’ and use fans and ducting to shuffle air around. This would allow high CO2 air to be shuffled over to the crops, and low CO2 air from the crops to be moved out to where the high CO2 air is coming from. In reality though, I feel as though this ducting could impact on the available space within the habitat, as well as add a lot of complexity to the installation. The habitat is going to be relatively small, with very small openings between each room that would be negatively impacted by having ducting in the opening. A more practical alternative would be to simply have a couple of fans just slowly moving air around the entire habitat continuously.

Due to these reasons, adding some form of sensor networking is very low on my priority list. There is no internet or cellular connectivity in the desert location where the sensor will be operating, so logging to a nice cloud platform is out of the question. Therefore, I’m going to leave networking in the nice-to-have column, and if a reasonable use case can be made for it, we will investigate modules for it in the future.

It’s very easy to design a technical solution to a problem with very simple means, so before we head down that route, I want to ensure it’s necessary, no matter how fun it is to build networks of sensors!

Top Level BOM

Now that we have finally selected all the components, we will begin to test them in the next article using a breadboard. Our high level BOM of components to test is:

  • Amphenol – T6713
  • STMicroelectronics STM32F413
  • Bosch BME680
  • Riverdi Display 5” UXB based on FT813

As we test these components, we will determine whether they are suitable to be used for our environmental monitoring system or not. If the devices we test do not meet our requirements, then we will order alternative components to test instead. Then, once we have finished all the testing, we can proceed to schematic capture and layout.

Next Time

In the next article, we will use breakout boards and the dev kit for each of the high level components to determine whether they are going to meet the requirements of the project. This process should get us a fairly good skeleton firmware prepared as well as confirming the choices for each component. We will know what pins on the microcontroller we are going to use, which will ensure the PCB we design has a very high probability of success on the first iteration of the design process. In the meanwhile, if you want to gain more insight into why I made my decisions in this specific order, you can feel free to check my Guide to Starting a New Project.

You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.