Adding PCB ESD Protection to Your Design

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Adding PCB ESD Protection to Your Design

Electrostatic discharge (ESD) occurs when two objects with different net charges come very close together. At a close distance, the electric field between these objects becomes very large and causes the medium between them to breakdown. In PCBs, a discharge usually originates when the user touches the board, or when metal held at a high voltage nears a conductor on the board.

Usual activities like plugging cables in/out, pushing buttons, or using a screen or keys can result in electrostatic discharge. This discharge can cause a high current pulse in the system that can damage ICs and other components on board. PCB designers need to be aware of some simple strategies for PCB ESD protection in their design.

Components for PCB ESD Protection

There are some components that can be added to your board from your parts library to protect against voltage spikes due to ESD. These components are usually grouped together as ESD suppressors. Here are some components you can use for ESD protection in your next design:

TVS diodes

Transient voltage suppression (TVS) diodes can be used to fix the voltage on a line to a safe level. A TVS diode is actually an array of diodes arranged in such a way as to provide very high impedance to normal range voltages. TVS diodes can be constructed in a loop arrangement (shown below) using two p-n diodes and a Zener diode. You can also use a back-to-back diode without forming a loop arrangement, or you can use an integrated circuit that provides TVS.

When a voltage surge occurs across the TVS diode, the diode will provide a path to ground for current before it can damage any components on the protected line line. The loop arrangement below causes current to dissipate to ground as to moves around the diode loop.

ESD1TVS diode for ESD protection

Capacitors

Capacitors connected to ground act like a high impedance source for any DC voltage, while they act as a short circuit for high frequency voltages. By strategically placing capacitors with the proper value on sensitive nodes, voltage surges can be discharged to ground safely. This method can potentially make the node respond slower and might cause a distortion of digital data. For this reason, capacitors are not normally used for PCB ESD protection in high speed designs.

ESD-Aware PCB Design Strategies

Placement of the ESD Suppressor

After choosing an ESD suppressor that is compatible with the electrical characteristics of your circuit, the next important consideration is its placement. The placement should be done such that IC receives the lowest possible voltage surge if ESD occurs. For moderate frequency signals and for typical ESD pulses, PCB traces act like inductors, meaning their impedance increases with frequency (ωL). The circuit with the TVS diode above now looks like this:

ESD4
Effect of line inductance on ESD

From the figure above, we can clearly see that the diode will be triggered quickly when L2>>L1. This will also mean that most of the current will get steered away from the protected line and L2 will also dissipate any ESD left on the protected line. This means we need to place the TVS diode as close as possible to the location where ESD might occur. There should be minimum inductance on the ESD suppressor connections to the line or ground. The energy of ESD pulse decreases as the trace length increases, so the trace length between the ESD suppressor and the protected IC should be as long as possible.

Limiting EMI from ESD

ESD produces strong voltage pulses that can produce electromagnetic interference (EMI) on other nearby signal lines. The primary source of radiation is between the ESD source and the suppressor, which acts as an antenna. If possible, you should keep the suppressor area away from other circuits and unprotected traces, otherwise they can carry the ESD signal to other ICs. Even without considering the inductances of each line, the protected and an adjacent unprotected line can act like a capacitor, which allows the voltage surge to pass between the two lines. The following figure illustrates how an ESD pulse can couple to an unprotected line:

ESD3ESD coupling to nearby traces because the two traces act like a capacitor

Vias Between the ESD Source and Suppressor

If there are any vias between the ESD source and suppressor, the via can also cause coupling to an unprotected line. Ideally, there should not be any vias between the ESD source and suppressor, as it increases the length of the line, causing more inductance on the line. This has two detrimental effects:

  • It will increase the ESD pulse energy in the protected line
  • It will increase the signal generated by the unprotected line through EMI

If the designer has no choice but to add a via, then they must make sure the protected line and suppressor are on the same side of the board, and the source is connected to the protected line only after the via (Case1 in the figure below). The worst possibility is that the source and protected line are on the same side, while the suppressor is on the other side; this should be avoided (Case2). In this case, it is best to use another via to connect the protected line after the ESD suppressor rather than connecting the ESD source directly to the protected line (Case3).

ESD-viaHow to add a via to reduce the impact of ESD on a protected line

Proper Ground Routing Can Reduce ESD

We saw earlier that we need to reduce the trace inductance between the source and the TVS diode to direct the voltage pulse away from the IC which we need to protect. The earlier image assumed that the suppressor has a good ground connection. In reality there might be some inductance between the ESD source and the TVS diode, or between the TVS diode and ground; this is shown in the figure below:

ESD2Parasitic inductance on the suppressor can direct more ESD voltage back to the IC

We can lower L3 by placing the TVS as close to the source as possible. In order to reduce L4, we need to connect the TVS ground pin directly to the ground plane using a via. If a direct connection is not possible, then use multiple vias in parallel on the trace that runs to the ground plane. You should make the drill diameter on each via and pad size larger to increase the surface area (to combat the skin effect). A ground via on a TVS suppressor should be filled with non-conductive material to keep the surface area large.

It is a good idea to incorporate ESD protection early so that you don’t need to make any last-minute changes to a complex layout. If you’re looking to create your next schematic and layout in an easy-to-use online PCB design platform, Upverter® provides these tool and many more,  allowing your to design boards from start to finish. As a cloud-based tool, Upverter allows users to share their designs, roll back to previous design versions, 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 Design Walkthrough: Airsoft Tracer Unit, Part 2

Get Started with Altium Upverter, Sign Up Now.

Upverter Expert - Project Design Walkthrough_ Airsoft Tracer Unit, Part 2.jpg

We’re back to building our airsoft tracer unit which we started in Part 1. If you’ve forgotten what happened in part one and don’t want to re-read the whole article, we were building a fancy array of UV LEDs that are activated by an airsoft BB traveling past a light gate, and are switched off when the BB reaches the other light gate. On this project, we’re going with the attitude that ‘if it’s worth doing, it’s worth overdoing’. So while most commercial tracer units use under 2 watts of UV emitters, and the most expensive are about 6 watts, we’re throwing over 170 watts of UV emitters into the tracer unit. This massive amount of UV light will make airsoft tracer BBs glow, as they have the same chemicals as ‘glow in the dark’ powder and paints. This makes the BB easier to track in low light or dark conditions, such as inside a building or after dark. In Part 1, we defined our project parameters and requirements, then selected the high level components we thought might work well for the project.

Now that you’re all caught up on the project, welcome to Part 2. In this article, we are going to prototype the project on breadboards to ensure all our component choices are valid, and determine/tune the values of several resistors and capacitors that are going to be critical to detecting the fast moving BB traveling past our light gate. I was hoping to also make a start on the software to see if we can exclude some of the components we chose in Part 1, and get the rudiments of the system functioning. However, I’m having a hiccup with one portion of the design which we will discover as we go through it in this article, so that will be covered in Part 3.

As I mentioned in Part 1, I’m building this project article by article—by taking the approach of having you follow along with me as I design the tracer unit from start to finish, as that allows more learning opportunities as we discard components, discover that parts are not optimal, and make mistakes along the way. This is not a writeup of a completed project, but a writeup of the journey to get there.

The Photogate

Since we cannot control the LEDs without the photogate, it is probably the most critical portion of the project. Therefore, I’m going to start by building the amplifier for the PIN diode, which we are using to detect infrared light at the photogate. The PD15-22B/TR8, which is the PIN diode we selected for the surface mount PCB, isn’t available in a through-hole package, nor is the OSRAM SFH 4641-Z IR emitter. To be able to prototype, I’ve chosen parts with comparable specifications to work with instead.

Testing the Diode

My first step is to check that the PIN diode is going to respond nicely to the 950nm IR emitter. To do this, I set my lab power supply to limit the current to the emitter to 20mA, and then connected the PIN diode directly to the oscilloscope probe. Operating in the photovoltaic mode, the diode acts a bit like a really bad solar cell, generating a small amount of voltage as it is exposed to light that it is sensitive to.

WavingLED

Waving the IR LED back and forth over the photodiode showed the response on the oscilloscope, so all looking good so far! You’ll notice the amplitude of the voltage is low, with 5mv/division on the oscilloscope.

Next, I wanted to see how fast the photodiode could respond in photovoltaic mode. For many applications, the photovoltaic mode is going to be sufficient, however, it’s relatively slow due to the capacitance of the diode junction. The voltage created by the light needs to charge the junction as if it were a capacitor, so the voltage has a rise time that is far less than instantaneous. To test this, instead of powering the IR emitter all the time and breaking the beam as we would in the final product, I added an N-Channel MOSFET to the breadboard. The MOSFET will control the IR LED with my function generator, thus enabling me to dial up any frequency I want and see what the response is. Channel 1 (below) on the oscilloscope is connected to the LED leg, and channel 2 (blue) is connected to the photodiode.

60hz

With a simple 60Hz signal, we can confirm everything is working before continuing on to more applicable frequencies.

slowresponse.jpg

Switching the IR emitter with just a 1kHz signal, we can already see significant effects of the junction capacitance. The rise time is around 212us, which for many applications might be fine, but is inapplicable in ours as we need to capture a much shorter signal. 

In the UK, we have joule limits for the energy of the BB as it exits the replica firearm. The highest joule limit is allowed for bolt action rifles, and equates to 500 feet per second with the lightest commonly used BB (0.2g). At 500 fps, we can expect the BB to occlude the light beam for about 20-40us. The actual period of time will depend somewhat on the exact implementation, but this ballpark figure should give us an idea what rise time to aim for. With a rise time an order of magnitude higher than this, photovoltage mode will not work for this application.

In part 1, this was already expected, so we designed a circuit to use the photodiode in photoconductive mode. As the junction is exposed to light, it is able to conduct current in the reverse-biased direction. As the junction conductance is directly correlated with the amount of light hitting it, the junction capacitance has no bearing on the rise time. We can use this conducted current to determine how much light is hitting the sensor instead of using the induced voltage. To do this, we need a transimpedance amplifier to convert the current into a voltage.

Soldering Op Amps to Breakout Boards

The op amps were also only available in surface mount, however, as they are in the common SOT-23-5 package, I have used breakout boards for them. If you’ve never tried soldering a relatively small and fine pitched component to a breakout board, it’s quite simple, even with thick solder and a wide chisel tip on your soldering iron. I use a 2.4mm wide chisel on my soldering iron for soldering even 0.4mm pitch and 0201 size components, so don’t feel as though you need anything more than a temperature regulated soldering iron to work with small surface mount parts.

You’ll only need a soldering iron, a flux pen and a set of tweezers. You can read more about my suggestions for these over on the Altium blog in my Kitting Out an Electronics Lab article. The breakout boards I have are from Sparkfun, and the pads look a little tarnished, so the flux is just going to make soldering to the pads much faster and easier.

DSC_1038_DxO_web

First, I will wipe some flux across all the pads on the board, then tack down one pin in the corner, ensuring that all the other pins are well aligned on their pads. To do this, I hold the component with curved tweezers onto the board, and bring in the freshly cleaned and tinned soldering iron tip. The solder on the tip will transfer onto the pad and lead, with the flux you already added to the board ensuring that the solder on the iron tip flows well. 

DSC_1039_DxO_web

At this point, you can add a little more flux to all the pins if you want. Continue soldering each pin with a one second long tap from the corner of the soldering iron tip so just the pad and leg of the part make contact. If you have a small bit of solder on the tip, it will transfer over to the pin and pad nicely, without shorting any of the pins. If you do short adjacent pins, you can add a little more flux and then use the soldering iron to wipe it away. The surface tension of the solder will cause some of it to pull away on a clean iron tip, and the flux will ensure it doesn’t oxidise and flows well.

DSC_1040_DxO_web

To ensure the breakaway headers get soldered on straight, and you don’t melt the plastic if you take too long, you can mount the pins into the breadboard and drop your breakout board on top. Then, just solder as normal. If you are worried that the pins of your breakaway header are tarnished, or that the breakout board is, you can add a little bit of flux here too. Make sure you’re using no-clean flux though, as you don’t want a sticky, mildly corrosive flux stuck between your header and the board.

Building the Circuit

I then built the circuit on the breadboard using the schematic the Analog Devices website calculated for us. However, to make prototyping easier, I’m using multi-turn pots, which I pre-set using a multimeter for the resistance in the schematic, instead of using exact fixed value resistors. I’m using an LM317 to create my 2.75V positive rail from a 5V supply generated by my lab power supply. I wanted a higher voltage coming into the breadboard for the IR emitter to run off, so I could use a larger resistor than if I powered the board with 2.75V. I didn’t have a close match to the correct current limiting resistor for the IR LED with 150mA at 2.75V. 

I’m using a Texas Instruments TPS60403 inverting charge pump to create the -2.75V supply for the op-amps. You can read more about negative voltage in my article on the Octopart website. The op-amps need very little current, so the 60mA charge pump is more than sufficient.

DSC_1033_DxO_web

To test the PIN diode, I’m using the MOSFET set up for the function generator and IR LED that I mentioned earlier. This will give me a continuous pulse of light that I can watch with my oscilloscope along with the amplifier output to see the response of the amplification circuit.

first1khztest.jpg

For the first test, I tried it out at 10kHz just to see if it would be better than the 1kHz signal we had previously. Clearly, the signal is looking much more square, but is looking pretty wavy! After a bit of poking around with the oscilloscope probe, I found that the noise was coming from the inverting charge pump, the output of which looked exactly like the flats of the blue waveform. Clearly, it needs a lot more capacitance than the datasheet suggests, needing around 40uF before the signal looked better.

As a note on the oscilloscope probes, this is a brand new oscilloscope for me, and I found out much later on in testing that the attenuation switch moves rather easily. It was set to 1x initially, but by the point of this screenshot, it had moved to 10x attenuation, so the voltage levels are all 1/10th of what they should be. This caused much confusion as to why the amplifier circuit just wouldn’t go above about 370mV no matter what I did! So lesson learned, check the test equipment settings before blaming the circuit, especially if it’s not test equipment you’re familiar with. You’ll see the attenuated voltages from here until almost the end. I wanted to keep the oscilloscope screenshots as they were taken rather than go back to replicate them with the probe set correctly, as I did say I would show all the goofs in this series!

Now that we verified that the circuit is amplifying the signal, it’s time to clean it up. I’m moving the oscilloscope probe between the two amplifier stage outputs to see the response. It’s an iterative process of first looking at the output of the first amplifier stage and turning the multi-turn pot’s adjustment until the output is looking as square as possible, then going to the second stage and turning the resistor between the stages until the signal looks as good as possible, and finally turning the feedback resistor for the second stage. This is repeated many times and at several frequencies well beyond what we expect the circuit to see in order to get the best tuned values we can.

25khztest.jpg

Now, at 25kHz, the response curve is looking about as good as it can. The small spikes on the trace are caused by some interference from the LED magnifying lamp I’m using as a light source on my workbench. I’m not sure if it is conducted through the power lines, is radiated electromagnetically, or if the LEDs are emitting some infrared light which is influencing the photodiode, either way, it doesn’t have any bearing on the actual circuit’s functionality.

Running my function generator with a 35% duty cycle, 5kHz square wave gives a 39.36us pulse for me to work with. This closely replicates the time of the BB traveling through the light gate, and should give a good indication of the signal edges the microcontroller will have to work with.

39usTest.jpg

It looks pretty good, and it was right about this point that I realized the attenuation switch on the probe had shifted earlier on during testing! This looks exception, and we have a 2.7-3.3v signal depending on how much light is hitting the sensor, and if I cover the sensor + led with a white box or not (amplifying the light).

Once the resistor values were well tuned, I switched out one of the capacitors as well, so I need to measure the multi-turn pot resistance and then re-draw the schematic for later reference. The schematic doesn’t need to be a perfect drawing, mine is just on a post-it sticky note giving me something to refer back to later.

While writing this, I’ve realised that since the LED will always be on and the BB will block the light, the signal here is the inverse of what we will expect in the actual tracer unit. This doesn’t really matter, however, as our edges look good on both sides.

DSC_1037_DxO_web

This could be a good stopping point for tuning the circuit, however, these resistor values don’t represent real-world sourceable values. I also need to build a second amplifier circuit so I can test fire a BB between two sets of gates, so I’ll build a second circuit with the values of resistor I have on hand.

real-values.jpg

Here’s a slightly lower duty cycle 5kHz signal with the circuit implemented using commercially available resistor values. I’ve also dropped the capacitance of the inverting charge pump which is also noticeable.

DSC_1041_DxO_web

The commercially available resistor values give us a good leading edge, but a poorer trailing edge. This will still be more than acceptable for triggering a microcontroller interrupt as far as I’m concerned. However, it will be interesting to see what it looks like when a BB travels past, as we may need to change resistor values to sharpen up the trailing edge.

Mock Suppressor

The final circuit boards of this project will be integrated into a mock suppressor attached to the replica firearm. For now, I need a way to mount the IR emitter and photodiode to the rifle to see what it looks like on the scope when a BB passes through. I designed a quick attachment for the end of a rifle barrel to hold the IR emitters and photodiodes a known distance apart. We said in the last article that the battery would determine the minimum length of the suppressor at 80mm, so I used that length with the photogates 6mm in from either end. 

suppressormockup

I wasn’t sure how straight I’d be able to get the part pressed onto the end of the rifle, so I made the bore through 12mm in diameter, as I didn’t want one of my very limited IR emitters or photodiodes to be damaged by a BB impact if I didn’t get the unit on straight.

DSC_1048_DxO_web

There’s nowhere to mount any UV LEDs, nor is there any intention to. This is just to test the photogates we are building against real-world conditions to ensure the amplifiers are going to be able to catch the passage of the BB.

DSC_1052_DxO_web

I printed the mock suppressor in PET-G with 0.3mm layers to reduce the print time. This gives a bit of an ugly print but it’s only the function we care about at this point of the project. I used hot glue to attach the IR emitter and photogate into the 3D printed adapter, then wired them up to the breadboard so we can start testing. I tried to keep the wires short enough to not allow much noise to be picked up, or have any odd effects on such a small signal from the photodiode, while still being long enough to manipulate the rifle attached to it without constantly disconnecting the cables that are just pushed into the breadboard.

45bb.jpg

My first test is with a 0.45 gram BB, which is the heaviest I have and therefore will travel the slowest. It’s worth noting I’m running the IR emitters at only about 40mA current, rather than the 150mA they are rated for, and that the emitter and photodiode are about 18mm apart. In the final board, the emitter and diode will be much closer, and I will most likely drive the emitter at a higher current. This will give a larger voltage range, allowing for clearer readings. As channel 1 (yellow) is looking a bit low voltage in my current temporary setup, there may also be some hot glue over the photodiode! Those are things that can be optimized and tuned on the final board, but at this point, I’m most interested in the response curve looking like something a microcontroller will trigger on.

32bb.jpg

My next heaviest BB is a 0.32g, and that is definitely traveling faster.

20bb.jpg

Finally, we have the 0.2g BB, which is traveling quite fast. How fast?

20bbspeed.jpg

If I add cursors to the oscilloscope display we can see the travel time is 444 μs to cover the 68mm distance between gates. That’s () 153.2 m/s or 502 feet/second. It sounds like it’s in the right ballpark area for a 0.2g BB, but to make sure, we can check with a 0.45g BB.

45bbspeed.jpg

The 0.45g BB covers the 68mm in 695us, which means it’s traveling at 97.84m/s or 321fps. This is the rifle I regularly play with, and I know I shoot at 320 fps ± 3 fps, as we must perform a chronograph test prior to playing to ensure our guns are safe and legal.

doublefeed.jpg

When testing the 0.2g BB, I accidentally double fed the gun, putting two BBs down the barrel at once. I thought this was actually pretty interesting to see, as having two BBs come down the barrel could definitely cause some issues in software if we get a second pulse on the first photogate before the second photogate has been triggered. I would have thought the two BBs would travel with the rear BB pushing the first one out, however, it looks like they were separated by at least the gate distance as they went down the barrel. This is definitely an edge case which we will need to account for in the firmware. We will need to ensure that a second pulse coming through the first gate before the second is triggered will not cause a race condition or leave the code in a bad state. This is the sort of event that real world testing highlights well, as using a function generator to provide the pulses will never cause these events to happen.

At this point, I’m happy with the performance of the photogate and know that it will perform well on a circuit board with perhaps some minor tuning of the feedback resistor values.

LED Power Supply

In part 1, I was very unsure of the LED power supply. I chose the TPS92691 LED driver as it has good performance characteristics for driving an LED, but with the soft start, it looked questionable whether or not it would be able to be switched on and off fast enough for the purposes of this application. I bought the TPS92691 evaluation module to give me a chance to try it out before committing to the design. If the part doesn’t work the way we want it to, and we commit to a PCB using that part, it will mean a revision of the PCB at the least.

As the UV emitters we’re going to use in the project are not particularly cheap, wouldn’t be easy to use in a breadboard or solder wires to, and emit light of a frequency that is rather harmful, I bought a pack of cheap white LEDs from an online marketplace that have similar current draw and forward voltage. They will make great stand-ins for the UV emitters.

My first test was to connect the eval module up to the LEDs and just switch the power supply on and off. The LEDs lit up very bright and current regulation was good. Once I knew the board was functional, I added an N-Channel MOSFET to a breadboard to allow my function generator to bring the shutdown pin to ground, disabling the driver. This will make it possible to rapidly turn the driver on and off by connecting a function generator to the gate of the MOSFET.

DSC_1045_DxO_web

At 5Hz, also known as ‘Disco Mode’, everything was working great. How about a higher frequency?

tpsdrv100hz.jpg

At just 100Hz, far below the speed we will need, the driver failed to either switch fully on or fully off. It was stuck in a limbo state of soft start and capacitor drain. 

DSC_1046_DxO_web

I had suspected this would be the case, so I shifted the MOSFET from pulling the shutdown pin to ground to instead pull the LED string to ground.

tpsdrvledgnd.jpg

That did not go as I had hoped. The driver is very confused by the lack of load with a sudden appearance of load. It gets itself into a state of doing a massive voltage spike to its maximum output voltage around once per second. It has no real correlation between the function generator’s signal and the LED power, and the ramp time is so long (almost 20ms) that it rules the TPS92691 out as an option for powering our LEDs.

The development kit for the TPS92691 was not cheap, but it was well worth the cost as a fully populated and useless circuit board would have been substantially more expensive.

Next Steps

I suspected the TPS92691 might not do what we needed when I was purchasing components. I had hoped it would but planned for it not to. I also picked up an STMicroelectronics STEVAL-ILL063V1 evaluation board, which was relatively cheap. I don’t know that it will do any better than the Texas Instruments part did, but it’s worth a try. This is a much simpler driver and evaluation kit, so I speculate that perhaps being less feature-rich it might cope with my less mainstream usage a little better.

The evaluation kit has VIN, GND, DIM and the LED positive and negative terminals. Given the simplicity of the terminals I’m going to jump straight to testing the board with the LEDs connected to the dev board and FET.

I powered up the evaluation board with the LEDs connected, and they are shining nice and bright. Now that the kit is proven to be functional, it’s time to try toggling the MOSFET from the function generator.

functiongen20hz.jpg

Before we get to that though, I just wanted to share the scope screenshot with no power connected to the evaluation kit. You’ll see why in the next screenshot.

noisy.jpg

Not only does the evaluation kit not react well to even 20Hz of control, but it’s also generating a significant quantity of electrical noise. The noise could potentially be dealt with in-circuit, however, it’s well beyond what I’d want to try to deal with on a very compact circuit board next to extremely sensitive signals (such as those from our photodiode). The fact that the driver doesn’t work as we wanted is slightly irrelevant at this point.

We’re now two dev kits down, and I don’t hold a lot of hope that a traditional LED driver will be able to react to the rapidly changing loads as we need. At this point, I have to ask myself, do we even need current regulation? With a maximum pulse time of around 640us, the LEDs should not be getting to the point of overheating. Essentially, we will be running pulse width modulation on the LEDs, with a pulse of the BB travel time, and a period equal to the time between shots leaving the gun. 

Obviously, we could easily add some crude current limiting with an LM317 or an LM334, or even more efficient current limiting with some op-amps and transistors, however, those solutions all add thermal loads and board space requirements I’m not sure we require to the project. I typically chase an ideal solution and use more components than are strictly required to make a functioning circuit, so I’m curious to try the other approach of issuing the bare minimum possible. 

Current limiting has always been so critical in running powerful LEDs in products I’ve worked on that it’s very hard for me to consider running these LEDs without some form of current limiting. Therefore, I’ve set up an experiment with my cheap LEDs to run overnight: for 10 hours, I’m going to pulse the LED on for 640us, and off for the rest of a 20ms period, which should give me 1.8 million LED flashes. If the cheap LEDs survive 1.8 million unregulated flashes, I feel as though I can safely run the UV emitters without any current regulation. While the forward voltage of these LEDs is the same as that of the UV emitters, the current is about only one third of the UV LEDs’. The higher power UV LEDs, however, will have a PCB to sink heat into. To be safe, I’ve set the LEDs on a ceramic dish and left them run unattended. The LEDs definitely need to run unattended as the pulse intensity and rate are headache-inducing after just a couple of minutes.

The Next Day

Exactly 10 hours later, the LEDs are still fully functional and only slightly above the ambient temperature. These are very cheap LEDs and I’m not sure if that makes them more or less robust than a relatively expensive UV LED. I’m going to take the gamble and skip the constant current supply, keeping in mind that if things don’t go well then we will need to revise the design after the first prototype circuit boards have been assembled. 

I ended up spending a couple of days reading technical journal publications and white papers trying to find what actually causes LEDs to fail, specifically UV emitters, and the research was fairly frustrating. The vast majority of literature on failure modes of LEDs and non-visible light emitters (IR and UV) are more focused on the entire lifecycle and degradation over tens of thousands of hours of usage. I’m more interested in the effects of doing bad things to the LED, like giving it too much current. It appears that LEDs are not particularly fussed about overvoltage, where most can handle significant ESD events in the forward direction but fail almost instantly if reverse biased. There are some mentions of overcurrent damaging the silicon through electromigration which is broadly classed under electrical overstress. I feel as though the short pulse duration and the extremely long period between pulses are going to be fine for this application. Even if my friend shoots 3000 BBs a day, which is a lot, we’re looking at around 2.04 seconds of total LED on time if his gun is slightly broken and the BB takes 680us to travel past the LEDs (I expect it will be under half this time). If he played one day per weekend, it’s just 106 seconds per year, or a bit under 18 minutes per decade of LED on time. 

So this has quickly become an interesting engineering trade-off, for me at least. By not utilizing current limiting, we could be drastically reducing the expected lifetime of the UV emitters, but at the same time, a decade of use is only going to be 18 minutes of total on time for emitters rated for tens of thousands of hours of use. Furthermore, as the battery depletes and its voltage exponentially gets closer to the emitters’ forward voltage, the current draw of the LEDs will also drop off exponentially.

Next Steps

The next article should be a lot shorter as we look at the firmware for the project. We’ll be trying to capture the photogate response with a microcontroller interrupt. I’ve had some issues in the past with platform-specific bugs using the MBED online compiler platform that could affect this, if I run into any issues I’ll switch compiler as it’s not worth the development time on a one-off project to fight bugs in platform libraries.

Once we have the very basics of the firmware designed, we’ll be getting into capturing the schematic, PCB layout, and finally building and using the project!

There’s still lots of interesting decisions to be made, and the fun of the hardware design and testing to come. I hope you’ll continue following along as we continue the project build.

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.

Using PWM for DC Motor Control

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Using PWM for DC Motor Control

Average DC value for different duty cycle

DC motors convert electrical energy to mechanical energy, and the speed of a DC motor is directly proportional to the value of the input DC voltage. The direction of rotation depends on the polarity of the input voltage. In many applications, you may want to control the speed or direction of rotation, and you can use pulse-width modulation (PWM) with an H-bridge as an easy technique for controlling speed and direction. In this article, we will examine what is PWM and how to use PWM for DC motor control.

What is PWM?

There are many types of modulation schemes that can be used to periodically change some aspect of a digital or analog signal (frequency modulation, amplitude modulation, phase modulation, etc.). As the name suggests, PWM is a type of modulation in which the width of the pulse is changed without changing the frequency (i.e., the repetition rate) of the signal. The amount of time the signal is in the HIGH state is called the duty cycle. As we will see, this quantity is fundamental in using PWM for DC motor control.

Using PWM causes the average DC value of the signal to change when passed through a low pass filter. If such a signal is fed to a DC motor, we can change the speed of the motor by changing the duty cycle of the PWM signal. The change in pulse width is created by increasing the on-time (HIGH value) of the pulse while reducing the off-time (LOW value) by the same amount so that the frequency of the signal is constant. Increasing the on-time increases the average DC voltage value of the signal, and vice versa. The following figure shows the variation in the average DC value with duty cycle.

Average DC value for different duty cyclesAverage DC value of a PWM signal for various duty cycle values.

A simple relation to calculate the average DC value is

pwm-eq1

where, V(REF) is the value of logic high. This allows analog control of a DC motor via digital signal, making it possible to use microcontrollers to drive DC motors. A microcontroller can change the pulse-width dynamically, providing an instant or steady change in the corresponding DC motor speed. We can see how output voltage changes dynamically with duty cycle:

pwm2DC motor speed vs. duty cycle

Amplifying the PWM output

Unfortunately, it is not possible to use the microcontroller output to drive a DC motor directly as the current is typically too low to drive the motor. In addition, all DC motors have a start voltage that guarantees the motor will begin moving in any orientation. In many cases, the output from a microcontroller might not be strong enough to start the motor.

Usually, a PWM signal is used to drive a BJT or FET switch that connects the DC motor to a high supply voltage. The voltage reaching the DC motor supply in this case becomes

pwm-eq2

The circuit for making this connection between the PWM output and the DC motor is shown below:

Schematic for a MOSFET driver circuit for using PWM for DC motor controlSchematic for a MOSFET driver circuit for a DC motor. Image source.

Using an H-bridge to Control Direction

If we need to control the direction of the motor, we need to reverse the current through it and the most common way to do it is using an H-bridge. The H-bridge contains four switches in a bridge type configuration with motor in the center.

PWM4An H-bridge for motor control

By selectively turning on different switches, we can change the direction of the current and hence the direction of motor rotation. This can also be used to put a sudden brake to the motor or let the motor freely run until it stops due to friction. Closing switches S1 and S4 will rotate the motor one direction, and vice versa when S2 and S3 are closed. The motor will break when you close switches S2 and S4 with the other switches open, or when you close S1 and S3.

If you like, you can digitally control the direction of the motor by placing transistors in the above H-bridge circuit in place of mechanical switches. For example, when transistors at S1 and S4 output HIGH, the motor will conduct in the same way as if mechanical switches were closed. The same can be said for the remaining switch configurations.

Using PWM for DC Motor Control in Your Next Project

Now that you have a fairly good idea of how to use PWM to drive a DC motor and construct an H-bridge for an additional degree of freedom, you can easily build a digital circuit for directional control and to amplify the input voltage to start the motor. This requires a PWM source and 5 discrete transistors. You can also use a microcontroller (such as those built into an Arduino) to generate a PWM signal and numerically control the duty cycle. If you don’t want to build the directional control circuit yourself, you can use a 298N dual H-bridge DC motor driver. An example of this project can be found here.

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.

PCB Design for Manufacturing: What Every Designer Should Know

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - PCB Design for Manufacturing_ What Every Designer Should Know

You’ll want to make sure your boards can hit the production line by following PCB design for manufacturing guidelines

PCB design for manufacturing refers to a large set of design processes, where the goal is to ensure your PCB layout is fully manufacturable. Some people like to bifurcate DFM into design for fabrication (DFF) and design for assembly (DFA), but DFM spans all of these issues. Following important DFM guidelines will help you avoid redesigns and move to production quickly.

In today’s consumer market, getting a product out in time is key to grabbing a customer’s attention and remaining competitive. If you’re an entrepreneur about to release a new product, your time to market can give you a major advantage over your competitors. Any troubles during manufacturing will require a rerun through the manufacturing process and extend the time to market. By following the DFM guidelines for PCBs, you can reduce the chances of failure and increase your yield. Let’s take a look at the DFM guidelines every designer should know so that your next layout can pass DFM review with flying colors.

Why is DFM Required When My Design Already Passed DRC?

This is the very first question a designer will ask when given set of DFM checks along with the usual design rule checks (DRC). The difference here is that DRCs are a set of electrical rules that are intended to ensure design functionality. DRCs look for existing design issues from an electrical perspective, while DFM identifies any features in a layout that can’t be fabricated with standard PCB manufacturing processes.

DRC errors normally manifest themselves during the PCB layout phase, while DFM issues might not come up during a DRC. In other words, a given layout could pass your DRCs, but that doesn’t mean it will be manufacturable. Traditionally, manufacturers took it upon themselves to fix DFM problems in your layout, but this can create new problems as designs become more complex. As a layout designer, you should actively avoid DFM issues when creating your PCB layout rather than rely on a manufacturer.

Important PCB Design for Manufacturing Considerations

There are some DFM defects that you should check in any design. After some practice, you’ll learn to identify many of these problems quickly as you build your PCB layout.

Acid Traps

Acid traps in a PCB are basically acute or odd angled spaces or small features in your design that can cause acid to pool during etching. The residual acid gets caught in these areas and doesn’t get washed away. As a result, the copper around these areas starts to erode, creating open or high impedance connections. With smaller and thinner trace, it is easier for residual acid to form an open circuit.

Solder bridge between two pins
Acid trap created due to an acute angled trace routing

Some software has built-in DRCs for this particular issue. If yours doesn’t, then manually watch for potential acid traps and make sure to remove all odd trace angles on square pads.

Islands

These are free floating areas of copper on plane layers. Any copper pour that is disconnected from ground can also qualify as an island. If these areas are large enough, they might act like an antenna, causing noise and other interference within the board.

islandIsland creation due to disconnected copper

Solder Bridges Between Pins

High pin-count ICs have tight pin pitch. Therefore, it is essential that solder mask be included between pins in the PCB layout. The solder mask can act like a dam that prevents a large blob of solder from falling between pins and creating a short.

Solder bridge between two pins
Solder bridge between two pins on an IC. Image source: sparkfun.com.

Copper-to-Board Edge Clearance

Much of the PCB manufacturing process is automated. The copper-to-board edge clearance is the space where automated equipment grips the board and transports to other processing equipment. If there is insufficient space, then shorts can be created when current is applied to the panel during the electroplating process. The space requirement depends on the equipment being used for board transportation. Be sure to contact your fabrication house to get these specifications.

Thermal Paste Masks on Heat Sinks

Heat sinks remove heat from an electronic component through direct contact with a metal or thermally conductive paste. If the paste mask opening is too big for the heat sink, the molten solder might cause the component to float off the pad during the soldering process. This can create lots of wrong connections. Try to divide the paste mask opening into several small ones.

Cold Solder Joints or No Solder Connections

Any vias on a pad can cause solder paste to wick through the via suring assembly. This will result in a cold solder joint or an unsoldered connection. Therefore, you should check how close a via hole can be to a pad. Via-in-pad is normally use in HDI designs, otherwise the via will be connected to a pad with a small trace. If your tool doesn’t check for this, makes sure to do this check manually based on your assembly house’s requirements.

Insufficient Annular ring

An annular ring is the area of copper pad around a drilled and finished copper plated via. The primary purpose of an annular ring is to create a strong connection between a via and the copper trace. There should be enough copper around a via to form a solid connection between the copper traces and the via in a multi-layer PCB. If the drill size is larger than the size of the pad being drilled, the pad can disconnect from the via barrel or the internal signal/plane layer. You can learn more about annular ring requirements in this article.

 

Appropriate drill size for a given annular ring
Appropriate drill size for a given annular ring. Image source: pcbway.com.

Your PCB Design for Manufacturing Checks and Your Design Software

It is always a good idea to use a PCB design platform that provides important DFM checks. Don’t forget to contact your fabrication house and ask them about their DFM requirements. Taking care of these problems early can prevent an unnecessary redesign and improve the quality of your finished board.

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 Design: Complete IoT Temperature Logger for Beginners, Part 1

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Project Design_ Complete IoT Temperature Logger for Beginners, Part 1

I have a confession to make for this project: I love collecting data, storing it, graphing it, and getting as much of it as possible. Altium Upverter® has a lot of users who are relatively new to circuit board design, which is fantastic, so I wanted to create a beginner project to introduce less experienced makers to my love of collecting data. We’re going to build a wireless temperature logger that will store data in a web platform, which we will build ourselves, thus allowing us to graph temperature over time, as well as allowing us to see the current temperature where each sensor is.

Embedded programming can be intimidating, especially when it involves wireless networks and web requests, so we’ll be making use of the excellent .NET nanoFramework to make development and debugging incredibly easy. I’ve wanted to use the .NET nanoFramework in a project since writing the article on high level programming languages in embedded projects on the Altium blog. This is a perfect project to use a high level language for, as it keeps the code very simple, easy to debug, and makes what could be the very complicated task of interfacing with a WiFi network and accessing the internet with it much simpler. Not to mention, using the .NET nanoFramework will make us able to rapidly write and test firmware for the device as we prototype it, and refine that firmware on the circuit boards we design and build without much stress.

If you’ve never built a website before, you might be a little worried about the idea of building a web platform to log the data we collect. Don’t worry, I have set up the guide for that part of the project to be easy to follow, and put two different paths that you can follow depending on your preference, and that will result in the same functionality and appearance: an ASP.NET Core with WebAPI based platform, and a PHP based platform. Both are built on open source technologies, and both will run on Windows, Mac or Linux. We will be using this web platform in a range of IoT projects in the future, so we will be building it to be extensible and operable with multiple sensor types. Everything in this project will be open source, and you will be able to freely use it and modify it for personal or commercial use.

Following along with this project will give you an excellent starting point for future projects that need to collect data, log it to a remote server, and present it to an end user. Whether you’re building an industrial asset tracker or agricultural crop monitor, you’ll be able to use this project as a starting point for your hardware, firmware, and web design.

Specifications

The specifications for this project are broad, but very simple. As I mentioned in my Guide to Starting New Projects, typically for the projects I write about, I state the overall goal of the project, then proceed on to component selection. However, we have a few different segments that make up this project, so we can break down the specifications a little more precisely.

Hardware

The hardware for this project needs to be able to connect to a wireless network, take temperature readings, and send those readings to a website. It would also be very nice to display the temperature reading on a screen as well. The final hardware should also be in an enclosure for protection, which we can 3D print to suit the board we design.

The temperature sensor within the device should be as accurate as possible, and capable of reading from -30°C to +50°C.

Firmware

The firmware for the device will need to store temperature readings locally, but not necessarily in non-volatile storage, so if there are technical difficulties with the network or website, we don’t lose data that was unable to be submitted at the time of recording. 

The firmware should take temperature readings at regular intervals and both display the current temperature on the display and upload the reading to the website.

Web

The website should have a dashboard that is able to display the current reading for each device, as well as a graph of the temperature for the past day. Each device should be able to be viewed individually, showing the full temperature history it has recorded.

Users should be able to register for access to the portal, as well as login. User registration should require email validation to be completed prior to the user being able to login.

An admin user should be able to add new devices to the system as well as edit or remove existing ones. The recorded data types should be configurable through the web interface rather than hard coded, so additional device types can be added in the future. 

Component Selection

Given the relatively simple nature of the device we’re building, there are not very many component decisions we need to make. That being said, this project does need some components so let’s take a look at what we might need.

Microcontroller

As I’ve already made the decision to utilise the .NET nanoFramework for this project, our choices for a microcontroller are limited to those that the community has built support for. For this project, the ESP32 looks to be exactly what we need, it’s very low cost, has integrated WiFi, is supported by .NET nanoFramework, and offers options for a pre-certified module version of the microcontroller. There isn’t much point looking into other options when the ESP32 has so many great features for this project.

We’ll start off with the ESP-WROOM32 based DEVKITC for the ESP32, which should give us everything we need to prototype the device.

Display

There are many different types of displays we could utilize for this project, from the humble 16×2 character display up to a nice touch screen TFT display. However, this is a simple project with simple goals, so I want to use the 1.8inch 128×160 pixel color TFT display based on the ST7735S controller that I’m using in the thermal camera project that you can find on my blog. I haven’t tried using this display with the .NET nanoFramework before, but it is a SPI display so it should be a good choice. 

Temperature Sensor

The key component in this device is of course the temperature sensor. There are many routes we could take for a temperature sensor—on the budget side of things there are thermistors, moving up to analogue temperature sensors with built in compensation. From there, we can start looking at low cost digital temperature sensors which use I2C or SPI to communicate with the microcontroller, and on into the premium grade digital temperature sensors.

I feel given this project is beginner oriented a basic digital I2C sensor is going to do the job nicely. These generally give far more precise readings than an analogue sensor, as the conversion is completed by the sensor itself, along with the algorithm to convert the analog voltage into a temperature measurement.

A sensor such as the very simple TMP102 will do the job very nicely. If you want to take the project to the next level, you can optionally implement a temperature and humidity sensor such as the Si7021 which is very popular. 

Power Supply

Our device is going to need some form of power, as this project is beginner oriented, we’re not going to delve into making this a battery powered IoT device. The component options we’ve selected would definitely support being battery powered, however we just want to keep this project simple. As such, I think a simple micro USB connector will be adequate for powering the wireless sensor. If we need to make it portable, an external battery pack/power bank would suit our requirements.

For prototyping purposes, this means we don’t need to order any extra components, as the microcontroller dev kit is also USB powered, and we can utilise the supply from it to power our sensors.

When we layout the PCB, we will need a 3.3v voltage regulator to drop the 5v from the USB line to a usable level, however there are a myriad of low cost linear voltage regulators that will do the trick.

A linear regulator has no engineering risk as far as I am concerned, as such, it’s not something I would include in my prototyping BOM. If we were designing and building this device for a client or mass production, it would be helpful to include the LDO at this point so that it could be considered from a budgetary point of view.

The High Level BOM

Our major components for the device are now selected, and we’re looking at utilizing:

  • ESP32 wireless microcontroller
  • ST7735S based display
  • TMP102 temperature sensor

I’ll order the dev kit and breakout board for the sensor, and while we wait for those to arrive, we will get started on a web interface to receive the data.

Next Time

In the next article in this series, we’re not jumping into the electronics, as we need to build the web platform first. To test the electronic design, we’ll need to have a web API to call in order to prove the connectivity portion of the design. We will start with the ASP.NET based platform, as the code created for that can be reused in the .NET nanoFramework code we’ll be running on the ESP32 microcontroller. The PHP based IoT portal will follow at a later date, as the project progresses.

After the ASP.NET IoT portal has been created, we will get back to electronics. We will prototype the temperature sensor design on a breadboard to prove out the schematic and firmware prior to designing a PCB in Altium Upverter.

If you’re not interested in building the IoT portal yourself, the complete code will be available on GitHub for you to use if you want to follow along with the hardware development of this project, or use it for any other project you have in mind.

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.

When and How To Use a Decoupling Capacitor in Your PCB

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - When and How To Use a Decoupling Capacitor in Your PCB

Do you know how to use a decoupling capacitor? 

You’ve probably read about decoupling capacitors in datasheets or technical notes, but the function of these capacitors is rarely articulated properly. Aside from looking at advice in datasheets, it helps to know what a decoupling capacitor does and how to use a decoupling capacitor correctly.

Demystifying Decoupling Capacitors

Any ripple or noise that is output from your power supply can cause major performance degradation in ICs. A digital IC can suffer a reduction in noise margin, and an IC used to drive a downstream component can see increased clock jitter if there is noise on the power bus. Analog ICs typically specify a power supply rejection ratio (PSRR), which defines degradation in the output due to noise from your power supply. These problems are worse when the supply noise is concentrated at a higher frequency (i.e., a higher PWM switching frequency). This is one reason why voltage regulators are used in a circuit board.

Even if you use a regulator, noise on the supply can still affect digital and analog circuits. One of the most common ways to reduce noise is to place a capacitor very close to the IC. This capacitor is called a decoupling capacitor and it acts like a charge reservoir. The capacitor is meant to cancel out any current fluctuations on your power rail so that they do not affect the voltage seen by an IC. Once completely charged, the decoupling capacitor opposes any change in the voltage across it by providing discharging if the voltage drops, or vice-versa. Understanding the decoupling capacitor, its placement, and how to choose them is the key to getting the best performance from your design.

When working on a schematic design with ideal power supplies, it is easy for new designers to forget that the real-world power supplies are often far from ideal. When there are a large number of gates in an IC switch, a large surge in current can cause the IC’s supply voltage to change significantly. Consider a digital design with thousands of transistors switching simultaneously. This leads to a current spike that can cause the output voltage from the regulator to drop. This also causes a large current to flow through to ground that causes an inductive voltage drop, known as ground bounce.

How To Use a Decoupling Capacitor

The following figure shows one of the most effective decoupling techniques, which uses two parallel capacitors.

decouplingPlacing two decoupling capacitors in parallel

A large electrolytic capacitor (typically 10 to 100 μF) must be placed no more than 2 inches from the chip. The purpose of this capacitor is to act as a large charge reservoir, which keeps the voltage across the IC’s power and ground terminals constant.

The smaller capacitor (typically 0.01 to 0. 1μF ceramic capacitor with low effective series inductance) should be placed as physically close to the power pins of the chip as possible. The purpose of this capacitor (sometimes called a bypass capacitor) is to short high-frequency noise on the power rail to ground. This small capacitor has a smaller time constant, thus it reacts faster than the large capacitor (in other words, it has higher bandwidth), but it has lower charge capacity.

The large capacitor, despite being slow, has a large charge capacity. Taken together, these capacitors help provide a smooth supply for the chip. They also provide a low impedance path to ground for any higher-frequency noise, hence any noise generated within one IC does not propagate to other ICs.

Here are some tips for connecting decoupling capacitors to an IC:

  • When multiple capacitors are placed on the same supply pin, make sure that the smallest capacitor is closest to the IC, and place the rest of the capacitors away in ascending order. When placed close to the IC, the smallest capacitor will provide the fastest short for high-frequency noise.
  • Devices with multiple power pins usually need to have at least one capacitor per power pin. Be sure to check the component datasheet for the manufacturer’s recommendations!
  • For this scheme to work well it is important to connect all decoupling capacitors to a low-impedance ground plane with a large area through a via or short trace.
  • Always make sure you are placing the smallest decoupling capacitor on the power pin itself and not on a net tied to logic “HIGH”.

Types of Decoupling Capacitors

Note that a decoupling capacitor is not a specific type of capacitor. In theory, any capacitor could be used for decoupling. Electrolytic capacitors are excellent candidates for use as large decoupling capacitors as they are cheap, available in a wide range, have high capacitance-to-volume ratio, and have a broad range of operating voltages. Electrolytic capacitors are polarized and reversing the polarity can damage the component. Care must be taken to ensure you have placed the capacitor with the correct polarity. They also have high leakage current, but for most basic applications they work very well.

shutterstock_731355235Different types of capacitors

Aluminum electrolytic capacitors are designed to handle high frequency switching pulses. Solid tantalum electrolytic capacitors generally have smaller operating voltage and smaller available capacitance values, but they have a higher capacitance-to-volume ratio. They are more expensive and should be used carefully.

Ceramic or multilayer ceramic (MLCC) are among the best candidates for high frequency filtering because of their small size and low losses. The performance of these capacitors varies widely with the type of dielectric being used. The X7R type is preferred as the capacitance does not vary with the input voltage. Multi-layer ceramic capacitors are also popular because of their low inductance design.

In general film capacitors are not used for decoupling applications because they are generally wound, which increases the capacitor’s parasitic inductance. Here is a good article for calculating the value of a decoupling capacitor.

Placing a Decoupling Capacitor on the Board

Ideally, you would place a decoupling capacitor on the opposite side of the board as the IC as it can be placed right below the SMD pads (see the right side of the figure below). This provides a shorter path to ground and frees up space for fanning out traces. In most situations, you will place all the capacitors on the same side of the board with the decoupling capacitor as closely as possible to the power/ground pins. An alternative option with the IC, capacitor, and other components on the same side of the board is shown in the left side of the figure below.

cap_placementStrategically placing a decoupling capacitor on the board can free up board space

When placing these capacitors on the layout it is important to make sure that the capacitor you are placing is a verified component with a correct footprint. Upverter® provides a vast library of verified components, including ceramic capacitors with low ESL, aluminum electrolytic capacitors, and tantalum capacitors that you can use for decoupling. Upverter’s browser-based platform also provides schematic design and layout capabilities for designing boards from start to finish.

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.

PCB Grounding Techniques: To Do and What Not To Do

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - PCB Grounding Techniques_ To Do and What Not To Do

One of the most common questions we see from many designers is how to properly ground their PCBs. This includes ground plane design, placement of grounded vias, and other important techniques to reduce noise in a PCB. The fact is, grounding is the foundation on which we build our systems, and a thorough understanding of PCB grounding techniques is essential.

shutterstock_40722217

Ground loop formed by two trace connections

We normally talk about signal integrity in terms of high speed and high frequency signals, but any PCB needs to have a stable ground to ensure signals are clean and noise-free. Proper grounding comprises routing return signals to a ground point, and properly designing ground planes. Let’s take a look at some PCB grounding techniques and ways to ensure proper grounding throughout a board.

What is a Ground?

This might sound like a simple question, but the distinction between different types of grounds is fundamental. An electrical ground is a conducting body that acts as a common return path for the current from various devices. Usually it is referred as the zero-potential node and all the other voltages in the system are referred with respect to this node. Following are the different types of nodes that are referred to as grounds-

  • Floating grounds: A floating ground is simply a large reference conductor in an isolated system. A floating ground is not physically connected to earth.
  • Earth ground:This is literally a physical connection to the earth. This acts as a safe return point to deplete surplus current.
  • Chassis ground: The electronics in a PCB cannot connect directly to an earth ground (this normally happens through the power supply), but the metal chassis can act as a good ground. This is usually used to ground the body of an enclosure as a safety measure.
  • AC ground: These are low impedance ground paths that block DC return current. This is normally created by connecting to a ground plane through a capacitor.
  • Virtual ground: These grounds can be found in negative feedback circuits at the inverting end of operational amplifiers. Connecting 0 V to the non-inverting input will pull the inverting input 0 V, and this value is usually held constant through feedback. This is an unstable node and cannot be used as a return path for other circuits.

PCB Grounding Techniques and Your Layout

Ground Plane

Any large piece of copper on the PCB connected to the ground is called ground plane. In a two-layer board, this is usually spread across the bottom layer, while traces and components are arranged on the top layer. In a multilayer PCB, one of the interior copper planes is normally dedicated to a ground plane.

If the ground plane doesn’t entirely cover a complete layer, then you should always make sure you do not create any closed rings in your ground plane as this makes your ground plane susceptible to electromagnetic interference (EMI). Note that EMI can be induced in the ground plane from other components on the board or from external sources. The conductive rings act as an inductor, and any external magnetic field can induce a voltage/current in the ground loop.

Similarly, placing unnecessary traces between the ground pins of two components creates a ground loop. This is an especially potent source of noise between digital circuits that mimics the behavior of ground bounce. It also creates an effective inductor that increases susceptibility to EMI. Each component must be connected to a solid ground plane individually to avoid ground loops.

ground_loopGround loop formed by two traces connecting to a ground plane

When using a chassis ground, you can avoid ground loops by placing a void in the ground section that connects to the chassis, as shown below. The use of a capacitor provides an AC ground point. This is an ideal situation for electrical equipment that will run off of wall power and needs to have a return directly back to earth.

Chassis-ground-connectionElimination of ground loop antenna

Ground Vias

In a multilayer board, ground planes on different layers are connected through vias. These connections help you access the ground plane anywhere throughout the PCB. Vias also help reduce the ground loops in the system. They provide a shorter return path for the current through a low impedance ground point.

Sometimes, pieces of copper may resonate at 1/4 the frequency of the current flowing through it. This is one reason that you should try to route the shortest possible connections between components using controlled impedance techniques. Placing grounded stitching vias at appropriate distances can help eliminate these oscillations as they provide a capacitive path back to ground. As a rule of thumb, these ground vias must be placed at 1/8th of a wavelength or less from the relevant conductor.

Ground Planes in Your Stackup

In a multilayer PCB, the arrangement of power, signal, and ground layers in the stack has major effects on signal integrity and will influence your routing strategy. It is important to keep a ground plane near signal planes in order to minimize the current’s return path. In a 4-layer board, the power and ground planes are normally kept on the inner layers, while signal traces and components are placed on the outer two layers.

Analog and Digital Component Arrangement

Components should be arranged on the signal layer close to the ground so that the return paths are short and traces coupled to ground. If the PCB contains analog and digital components, then the ground connections must be placed very carefully. The analog and digital sections of the board should be physically separated, but they still need to connect to the power supply return path.

mixed_signalMixed-signal ground connections

Some might suggest completely splitting the digital and analog ground and then connecting them using a ferrite bead, but this can create more EMI and noise problems than it solves, especially if you are working at very high frequencies. A good way to connect these sections is to place the power supply return path between the two planes so that return currents from either section will not enter the other plane. It is important to note that no traces should not be routed over a gap between two ground planes as this creates long current return path that is highly susceptible to EMI. The space between the ground planes can be used to place mixed-signal components like ADCs.

Designing a high-performance PCB requires attention to detail, and grounding is just one of many design aspects that require your attention. One rule of thumb to follow here is “grounding before routing,” meaning you should consider the location of ground connections in your PCB before routing signal traces. It is important that you do not leave any floating planes on your PCB and connect them to ground instead. Layout editors have design rule check (DRC) features that will inform you of any floating net.

No matter which PCB grounding techniques you need to implement in your PCB, Upverter® provides a high quality PCB editor with excellent routing tools to design boards from start to finish in a browser-based interface. You’ll also have access to real-time DRC tools to help avoid any rework in your layout. Upverter’s browser-based platform gives you access to your work 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.

Which Types of PCBs are Best for Different Designs?

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Which Types of PCBs are Best for Different Designs

As part of our best practices and information for new designers and hardware startups, we want to give new designers the information they need to choose the right PCB for their next project. Any PCB is intended to provide a physical support for an electronic system and its components. The complexity of different types of PCBs varies widely, depending on the function of different circuits. If you’re designing a PCB for the first time, we’ll show you the different types of PCBs that will hopefully provide inspiration for your next project.

Rigid PCBs

As the name states, these boards have a rigid substrate which prevents bending or warping. These are usually made of solid, rigid material like fiberglass weaves, but more demanding industrial or automotive applications may require ceramic or metal core substrates. With the number of layers ranging from one to more than ten, they are the most common type of PCBs on the market.

Single-sided PCB

Just like its name suggests, a single-sided PCB consists of a single layer of conductors and components. There is usually a solder mask over the copper layer, and silk-screen can be used to mark the positions of different components. Despite the low-cost, the utility of these boards is limited because of the design complexity limitation. Due to only one surface available for connections the area of the board can grow very fast to accommodate all the components and connections.

Layers in a single-sided PCBSingle-sided PCB

Double-sided PCB

Double-sided PCBs are similar to single-sided except the conducting layer is on both sides of the substrate. Now the connections can run on both sides of the PCB, hence it occupies a smaller area or can have more complex circuits. The connection between top and bottom layer is made using plated holes called “vias”. These boards are used for moderately complex circuits. It is generally not a good idea to try and design high-speed or high-frequency PCBs on double-sided boards as grounding and power distribution can be a real challenge, especially as the number of components increases.

double_sidedLayers in a double-sided PCB

Multilayer PCB

Multilayer PCBs have several layers of copper separated by insulating laminate materials. Connections between layers are also made using vias. Typical multilayer boards start with four layers, and the layer count grows for more complex (and costly) boards. The extra planes can be used for routing, power distribution, and grounding planes, which helps to reduce crosstalk and electromagnetic interference (EMI). A four-layer board is usually a good place to start for a moderately complex board that will run at high speed (faster than TTL logic) and/or high frequency (usually hundreds of MHz or higher).

Layer stack in a multi-layer PCBLayer stack in a multi-layer PCB

Flexible PCBs

Rigid-Flex PCB

Rigid-Flex PCBs are a middle ground between one of the previous types of PCBs and a flex PCB (see below). These boards are best used in applications where a board requires precise molding to its enclosure or when different sections of a board need to move with the enclosure. These boards are also useful in small spaces where a standard connector will not fit in the enclosure. These boards can be found in pacemakers, digital cameras, and cell phones.

Layer stack in a multi-layer PCBRigid-Flex PCB from RayPCB

Flex PCB

These boards are not really boards; they are fully flexible PCBs that can be molded into nearly any shape without affecting circuits present on different layers. The substrate is usually made from polyimide with copper or other malleable metal used for conductors. These boards are more expensive than the other types of PCBs due to the additional fabrication complexity.

Rigid-Flex PCBFlexible PCB

Which Type of PCB is Best for Your Design?

The answer to this question really depends on the application in which your board will be used, your production budget, and the level of complexity of your circuits. One rule of thumb that will aid in your decision is this: if your new design works properly on a breadboard, you can expect your circuits to work as designed no matter how you layout your PCB.

For designs that run at high speeds and or frequencies, single-layer or double-sided boards are typically unsuitable, and you’ll want to start with a four-layer PCB. Here are some other points to consider for different types of PCBs in certain applications:

  • PCB for medical devices have severe area constraints therefore require dense routing with compact footprint. Multilayer PCBs are therefore quite common in medical and other advanced applications.
  • Industrial applications usually have high current requirements than in other applications. PCBs used in these cases have a thicker copper layers compared to normal PCBs.
  • Automotive and aerospace PCBs must withstand strong mechanical vibrations, hence flexible PCBs can be used for such cases.

No matter which types of PCBs you want to design, Upverter® provides the schematic design and PCB layout tools you need to design boards from start to finish in a browser-based interface. If you are preparing a complex PCB with multiple layers, Upverter gives an easy EDA teamwork platform for a live multi-user collaboration and real-time design rule check (DRC) features.

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.

Top PCB Design Guidelines for New Designers

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Top PCB Design Guidelines for New Designers

PCBs are sometimes seen as an over-glorified way to wire up electronic components. However, once you understand the complexity of advanced PCBs and the importance of enforcing some order to your components on a single board, you’ll realize the importance of creating a PCB for your new device. If you’re a new designer, it can be difficult to find a good set of guidelines for getting started designing your first PCB.

We want to give new designers some important PCB design guidelines to follow when building a new board. The guidelines below are not strict PCB design rules, but are suggestions that might help save you a lot of rework. You might not need to follow all of these guidelines for every design. At the end of the day, you are the master of your design, and with some practice, you will know what works best for your project.

Top PCB Design Guidelines for Beginners

Once you have validated your design idea with a breadboard, individual components, and what seems like a couple hundred wires, it is time to move start designing your own PCB. The most important considerations for a successful PCB design are that it should be manufacturable, functional, and reliable. The design tool you use can help ensure manufacturability by allowing you to checkyour layout against standard design rules and constraints.

Schematic Design

The first step is to start designing a schematic for your board in the tool of your choice. This process is rather easy as you are placing connections between the components. The design tool you use should include a schematic capture tool as this allows you to generate an initial layout from your schematic. It’s good to have a detailed schematic that gives you access to different component specifications, such as pin-out, names, and ratings. Once you finish your schematic, your schematic capture tool will create the initial layout, and you can then start making real connections on a PCB.

Placing Components

A PCB is like a piece of real estate; some areas carry higher value than others. Placement of each component depends on its individual importance. Precision; sensitive analog parts must not go to the edges and they should be kept away from any areas on the board with fast digital components (i.e., TTL components). Similar parts should also have similar orientation on the board as this aids routing between components. All surface-mounted components must be on the same side of the board, and all through-hole components must be on the top layer of the board.

Power, Signal, and Ground Routing

Once you have tentatively placed your components (this might change as layout is a dynamic process!) it’s time to start connecting them together with copper traces. If you have a multilayer PCB, make sure to keep power and ground planes symmetric and overlapping. This helps prevent any bending or stress development on the board. If you have only two layers, then you will need to have thick power and ground lines able to withstand the heat generated by the total current flowing through your board.

The two methods for connecting functional blocks of electronic components are star configuration and daisy chaining. It is highly recommended that you not daisy chain the power lines to different functional blocks in a PCB. Instead, use a star configuration to connect power rails to different portions of the board. This is a basic requirement for ensuring ICs receive consistent voltage during operation.

PCB design guidelines for power routingDaisy chaining should be avoided

Signals on the top and bottom layers of a two-layer PCB should run orthogonal to each other to avoid inductive coupling between them. For a multi-layer board, the same strategy should be followed for signal lines on adjacent layers. You should only break this guideline if there is a copper plane between the signal layers.

routingOrthogonal routing of traces on a two-layer PCB

Bypass Capacitors

Each PCB that contains digital components will have some areas with high switching activity and greater current consumption. Voltage and current spikes will occur when these digital components switch. These voltage and current spikes occur due to a large rush of current into a circuit during digital switching, sometimes called ground bounce. These voltage/current spikes can couple between different traces, known as crosstalk.

This problem can be solved using capacitors between the power and ground pins on a digital component. If you look at manufacturer’s guidelines for different components, they will often recommend a certain capacitor size which you can use to compensate for ground bounce.

Isolation

It is also important to prevent coupling between digital and analog traces during switching using isolation. With mixed signal PCBs, it is important to keep analog and digital grounds separate in order to keep digital signals from interfering with sensitive analog components. This does not literally mean using two different ground planes; this can mean placing digital and analog components over different areas of the same ground plane. The DC bias signals should also be shielded from any coupling with digital signals. A good way to do this is to run two ground lines run on both sides of a trace carrying an analog signal or DC voltage. This simple design choice is known as shielding.

shieldingSignal or bias shielding

Thermal Issues

While designing a PCB, you should also consider heat management. First, you should look through your component datasheets for thermal resistance and power consumption values to determine which components will likely be producing the most heat and reach the highest temperature. In addition to heatsinks or cooling fans on hot components, there are some simply layout choices that help keep temperature low.

If more than one component will produce a large amount of heat, then it is best not to place these components in one location, otherwise hot spots might form. Circuits that are very sensitive to temperature changes should be placed farther away from these blocks. There should be at least 2-4 vias for each layer transition near high current paths. This helps conduct heat away from the surface layer and helps reduce inductive and resistive losses.

Signal integrity

This is a huge area of PCB design, however there are some simple ways to ensure signals in your board do not get distorted during operation. Signals should be routed directly between components over the shortest possible path to reduce loop inductance. You should also avoid running parallel tracks over long distances as this increases capacitive coupling. If tracks need to cross, this must be done at a right angle to reduce coupling capacitance. These guidelines will help suppress crosstalk and reduce susceptibility to electromagnetic interference (EMI).

Verification

To ensure your PCB meets functionality and reliability criteria, it is important to check the design for any rule violations. Electrical rule checks (ERCs), and design rule checks (DRCs), are two very important tools that should be performed once you have laid out your board. The right design software can run these checks dynamically (i.e., as you place components and route traces). This helps you identify design errors that may not be obvious from a visual inspection. Once you have verified your schematic is correct and your layout complies with all design rules, you are ready to think about producing your board.

Choosing the Right PCB Design Tools

There are many PCB design tools in the market. A good tool is the one that provides easy integration between schematic and layout, a vast library with reliable components, and provides easy platform for collaboration and sharing. You should also be able to generate documentation for a manufacturer. This includes Gerber files, assembly drawings, and a bill of materials for your components.

Upverter® provides schematic design and PCB layout capabilities for designing boards from start to finish. Its browser-based platform gives you access to your work from anywhere and makes it easy to collaborate. Upverter’s cloud-based platform verifies part designs, removing the risk of symbol and footprint errors so that you can manufacture your designs with confidence.

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.

Range/Obstacle Detection with Ultrasonic Sensor Projects

Get Started with Altium Upverter, Sign Up Now

Upverter Expert - Range_Obstacle Detection with Ultrasonic Sensor Projects

The choice of sensor is a challenging and crucial part of any project. The performance, cost, and size of your project depends greatly on the sensor you choose. Range, obstacle, and level detection are very common tasks in many applications, and many sensors are available on the market for range detection or obstacle detection. Compared to other sensors, ultrasonic sensors are cheap, easy to use, and robust. This makes them a favorite entry-level sensor for hobbyists and professionals.

HC-SR04 module for ultrasonic sensor projects

The HC-SR04 module for ultrasonic sensor projects

How Ultrasonic Sensors Work

Compared to an optical sensor, and ultrasonic sensor’s output and sensitivity is independent of ambient light, color, texture, and transparency of the target. Because these sensors operate beyond the range of human hearing and vocal spectrum, the sensitivity is also independent of most ambient noise sources.

All ultrasonic sensors determine the distance to an object by measuring the time required for ultrasonic waves to reflect from a target. This is similar to SONAR, but off-the-shelf ultrasonic sensors can be used in any environment. These sensors produce high frequency sound waves which reflect off an object or obstacle in their path. The ultrasound receiver captures the reflected waves, and you can then calculate the total distance to the obstacle based on the speed of sound in that medium. This requires specifying the speed of sound in your calculation (approximately 331 m/s at atmospheric pressure and ambient temperature).

shutterstock_205582693
Ultrasonic sensor measurement principle

First, the total travel time (T) between transmission and reception of the signal is measured with the system, and the distance (D) between the sensor and the target can be estimated using the following relation:

ultrasonic_eq

where Cs is the speed of ultrasonic waves in the medium. The factor of ½ is due to the fact that the wave travels double the distance between the transmitter and receiver.

Getting Started with Ultrasonic Sensor Projects

If you’re thinking of including range detection capabilities to your board, the prepackaged module shown above will interface directly with an Arduino board or other microcontroller board. As most transducers emits at 40 kHz and above, you only need to supply a low frequency analog signal or a stream of digital pulses to trigger the transducer. Given the low frequencies used in these systems, you can easily implement an ultrasonic sensor in your board without worrying about EMI or other signal integrity problems.

Advantages of Ultrasonic Sensors

Linearity is one of the important performance parameters for any sensor, and ultrasonic sensors have linear output response over a broad range of input power. Ultrasonic sensors can be reliably used for range detection indoors or outdoors. The performance doesn’t fluctuate with variations in the ambient lighting. They are also robust and can be moved quite often, hence they are suitable for mobile applications, such as collision avoidance for robots moving at low speed.

Mist, smoke, or dust also do not affect the performance of these sensors. The color and texture of the target doesn’t matter either as long as the target has a hard surface, which means ultrasonic sensors can even be used for mash structures. Soft structures will have reduce the intensity of the reflected wave, making them more difficult to detect at longer range. The response of the sensor has a small dependence on temperature, but these sensors are still more stable against temperature changes than infrared sensors.

Challenges in Using Ultrasound Sensors

The primary challenge involving the use of ultrasonic sensors for range detection occurs when the target surface is of low density. In such cases, sound waves get absorbed by the surface and reflections are too small to be reliably sensed by the receiver. Another concern with ultrasonic sensors is their minimum sensing distance.

After transmitting the signal, the sensor needs some time to recover before it is ready to receive the reflected wave. If the range is too small, the receiver will receive a reflected wave before the trigger signal ends, resulting in an erroneous measurement. The datasheets for your particular sensor will usually specify the minimum range that can be reliably detected.

Range Detection in Your Ultrasonic Sensor Projects

One common sensor used for range detection with a development board is the HC-SR04 (see above), which provides high accuracy and stable readings in a compact package. It has four pins: supply, ground, trigger, and echo. Transmission is initiated by sending a 10 μs pulse to the trigger pin. This causes the ultrasound sensor to send out 8 pulses of 40 kHz each and raise the echo pin to high value. The echo pin stays high until the reflected signal is received, at which point it turns low. The length of time the echo pin remains high is proportional to the distance travelled (see the above equation).

timing_sensorTiming diagram for the HC-SR04 ultrasonic sensor

The typical usable range for this particular sensor is 2 to 400 cm, although working at more than 10 cm ranges gives better results with 3 mm accuracy. These modules typically require a 5 V power supply, and the operating current can reach 15 mA (3 mA standby current). The sensor assembly can be easily plugged into a breadboard for testing purposes.

For a simple range testing, you can plug the HC-SR04 sensor into an Arduino board, as shown in this tutorial. Ultrasonic sensors are excellent devices to use for liquid level measurements with a microcontroller board. This can be used for something as simple as creating an automated plant watering system, flashing an alarm LED, or for triggering a relay to turn a valve in a large water tank.

Another interesting project is to use an ultrasonic sensor in robotics for obstacle avoidance. This is simple enough to implement on an Arduino board, although you might consider going with Raspberry Pi or an equivalent if you need much more processing power. For the clean freaks, you can find a touchless automatic motion-sense trash can in this tutorial. The applications for the ultrasonic sensors are limitless and quite affordable.

More Advanced Ultrasonic Sensor Projects

You can also use an ultrasonic sensor for more complicated speed measurements. If the relative speed between the sensor and the object is rather large, a Doppler shift will occur once the wave is reflected from the target, and the shifted frequency can be detected with an ultrasonic sensor. The magnitude of the Doppler shift can be used to calculate speed, but not heading; at least two sensors with defined angle between them must be used to measure heading as well as speed.

If you want to implement this feature, you need a separate analog ultrasonic transducer. You then need to mix the detected signal with the reference signal, producing an AM analog signal. The frequency of the AM signal can then be extracted using an envelope circuit and then measured. You can then determine the relative speed between the sensor and the target using the standard Doppler shift equation. Note that the actual speed and any heading measurement will depend on the resolution of the ADCs in your system.

Small module for ultrasonic sensor projectsSmall module for ultrasonic sensor projects

Once you have decided on the type of system that you want to build and collected all the required components it’s time to test the system. The easiest way to implement a test system would be using Arduino, Raspberry Pi, or similar platform.

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.