Build an Adequate Test Bench (EE Tip #127)

It’s in our makeup as engineers that we want to test our newly received boards as soon as possible. We just can’t wait to connect them to a power supply and then use our test bench equipment (e.g., generators, oscilloscopes, switches or LEDs, and so on) for simulation.

Circuit Cellar columnist Robert Lacoste's workspace in Chaville, France.

Circuit Cellar columnist Robert Lacoste’s clean, orderly workspace in Chaville, France.

But due to our haste, the result is usually a PCB under test lying on a crowded workbench in the middle of a mesh of test cables, alligator clamps, prototyping boards, and other probes. Experience shows that the probability of a short circuit or mismatched connection is high during this phase of engineering excitement.

Test Board

Rather than requiring a mesh of test wires, it is often wise to develop a small test PCB that will drastically simplify the test phase. Here the ancillary board provided a clean way to connect a Microchip Technology ICD3 debugger, a JTAG emulator, a debug analyzer, and a power supply input.

Take your time: prepare a real test bench to which you can connect your board. It could be as simple as a clean desk with properly labeled wires, but you might also need to anticipate the design of a test PCB in order to simplify the cabling.—Robert Lacoste, “Mixed-Signal Designs,” CC25:25th Anniversary Issue, 2013. 

 

A Wire Is an Inductor (EE Tip #126)

I’m confident you know that you should keep wires and PCB tracks as short as possible. But I’m also sure that you will underestimate this problem fairly frequently.

Remember that 1 cm of a 0.25-mm-wide PCB track is roughly equivalent to an inductance of 10 nH. If this 10 nH is paired with, say, a 10-pF capacitor, that gives a resonant frequency as low as 500 MHz, which is easily below the third or fifth harmonics of the clock frequencies commonly seen on modern high-speed digital boards. Similarly, a 1-cm-long track will jeopardize the performances of any RF system such as a 2.4-GHz transceiver. There is only one solution: keep tracks and wires as short as possible. If you can’t, then use impedance-matched tracks.

Remember this rule especially for the ground connections: any grounded pad of any part working in high frequencies should be directly connected by avia to the underlying ground plane. And this via must be as close as possible to the pad, not some millimeters away.

Just yesterday I did a design review of a customer’s RF PCB. A small 0402 inductance was grounded through a via that was 3 mm away. It was a bad idea because the inductance was as low as 1 nH. Those 3 mm changed its value completely.—Robert Lacoste, “Mixed-Signal Designs,” CC25:25th Anniversary Issue, 2013. 

Wireless Product Regulations (EE Tip #123)

Are you working on a wireless design that you’d like to bring to market? If so, be sure to anticipate regulatory constraints right from the start. Planning upfront will save you a lot of time, money, and hassle.

Electrical engineer Robert Lacoste notes:

Unless you’re working on a prototype that won’t ever leave your lab, there is a high probability that you will need to comply with some regulations. FCC and CE are the most common, but you’ll also find local regulations as well as product-class requirements for a broad range of products, from toys to safety devices to motor-based machines. (Refer to my article “CE Marking in a Nutshell,” Circuit Cellar 257, for more information.CE Mark

Let’s say you design a wireless gizmo for the U.S. market and later find that your customers want to use it in Europe. This means you lose years of work, as well as profits, because you overlooked your customers’ needs and the regulations in place in different locales.

When designing a wireless gizmo that will be used outside the U.S., having adequate information from the start will help you make good decisions. An example would be selecting a worldwide-enabled band like the ubiquitous 2.4 GHz. Similarly, don’t forget that EMC/ESD regulations require that nearly all inputs and outputs should be protected against surge transients. If you forget this, your beautiful, expensive prototype may not survive its first day at the test lab.

Lacoste’s full article appeared in Circuit Cellar’s anniversary issue, CC25.

DDS Basics (EE Tip #122)

The simplest form of a digital waveform synthesizer is a table look-up generator (see Figure 1). Just program a period of the desired waveform in a digital memory (Why not an EPROM for old timers?), connect a binary counter to the address lines of the memory, connect a DAC to the memory data lines, keep the memory in Read mode, clock the counter with a fixed-frequency oscillator FCLOCK, and voilà, you’ve got a waveform on the DAC output. Don’t forget to add a low-pass filter to clean the output signal, with, as you know, a cut-off frequency a little less than FCLOCK/2 to please Mr. Nyquist.

Figure 1: The most basic digital signal generator is built with a simple binary counter. Its output sequentially addresses the rows of a memory, which holds the successive points of the output signal. It is then converted to an analog signal and filtered.

Figure 1: The most basic digital signal generator is built with a simple binary counter. Its output sequentially addresses the rows of a memory, which holds the successive points of the output signal. It is then converted to an analog signal and filtered.

This design works, but it is not too flexible. If you want to change the output frequency, you need to change the clock frequency, which is not easy to do, especially if you need a fine resolution.

The direct digital synthesizer (DDS) architecture is an improvement on this original design (see Figure 2). Rather than add one to the table look-up address counter at each clock pulse like the counter did in the previous example, a DDS uses an N-bit long-phase register and adds a fixed-phase increment (W) at each clock pulse to this register.

Figure 2: The basic architecture of a DDS is a variant of the counter-based digital generator, but it allows a fine frequency resolution thanks to a phase register and a binary adder. The key point is that the increment is not necessarily a divider of the phase register maximum value.

Figure 2: The basic architecture of a DDS is a variant of the counter-based digital generator, but it allows a fine frequency resolution thanks to a phase register and a binary adder. The key point is that the increment is not necessarily a divider of the phase register maximum value.

N can be quite high (e.g., 32 or 48 bits), so only the most significant bits of the phase register are used to select a value from the phase-to-amplitude look-up table, which is usually nothing more than a ROM preprogrammed with a sine waveform. Assume that you are using the P most significant bits as an address. Then the output of the lookup table is routed to a DAC. And, of course, the analog signal finally goes through a low-pass filter, which is called a “reconstruction filter.” You will understand why in a minute.

How does it work? If the phase increment W is set to one, you will need 2N clock pulses to go through all of the values of the look-up table. One sine period will be generated on the FOUT output each 2N clock pulses, exactly like the aforementioned counter-based architecture. If W is 2, it will be twice as fast and the output frequency will be doubled. As you know, you need a little more than two samples per period to be able to reconstruct a sine signal, so the maximum value of W is 2N–1 – 1. The formula giving the output frequency based on the phase increment is then:DDS-EEtip-122-eq1

Don’t be confused. It is not a simple programmable divider because the phase register doesn’t loop back to the same value after each generated period. The table in Figure 3 may help you understand it.

Figure 3: his spreadsheet simulation shows the “phase wheel” concept. A fixed angle is added to the phase register at each clock pulse. Note that each period of the output signal is not identical to the previous ones because the phase doesn’t go back to the same value after a full turn.

Figure 3: This spreadsheet simulation shows the “phase wheel” concept. A fixed angle is added to the phase register at each clock pulse. Note that each period of the output signal is not identical to the previous ones because the phase doesn’t go back to the same value after a full turn.

What make a DDS a fantastic building block are the numeric examples. Just take a standard, low-performance DDS with a phase register of N = 32 bits and a reference clock FCLOCK = 20 MHz. Your DDS can then generate any frequency from DC to nearly 10 MHz with a resolution of the following:DDS-EEtip-122-eq2

Not bad. In fact, the maximum frequency will be a little lower due to constraints on the low-pass filter.—Robert Lacoste, “Direct Digital Synthesis 101,” Circuit Cellar 217, 2008. The issue is available in the CC Webshop.

 

Using Arduino for Prototypes (EE Tip #121)

Arduino is an open-source development kit with a cult following. Open source means the software and hardware design files are available for free download. This begs the question of how the Arduino team can turn a profit, and the answer is the trademark and reputation of the Arduino name and symbol.

Arduino Uno PosterWhile there are now many Arduino clones, the original Arduino boards still outperform most. Arduino is very useful for prototyping. A recent example in my own work is adding a gyroscope sensor to a project. First, I purchased a gyroscope board from Pololu for a small amount. I plugged it into an Arduino breadboard shield purchased from eBay for roughly $5, and wired up the four pins: VCC (3.3 V), GND, SCL, and SDA. Pololu’s website has a link to some demo firmware and I downloaded this from GitHub. The library folders were extracted and renamed according to the instructions and then the example was run. The Arduino serial monitor then showed the gyroscope data in real-time, and the entire process took no more than 30 minutes.

Editor’s note: This EE Tip was written by Fergus Dixon of Sydney, Australia. Dixon runs Electronic System Design, a website set up to promote easy to use and inexpensive development kits. The Arduino Uno pictured above is a small portion of a full Arduino blueprint poster available for free download here.

Basic Goertzel (EE Tip #120)

The basic Goertzel transform, which has been around since 1958, was derived from the discrete Fourier transform (DFT). It’s an extremely efficient method of detecting a single frequency component in a block of input data. Figure 1 depicts the signal flow for the basic Goertzel algorithm as each sample is processed.

Figure 1:  Figure 1—The signal flow of the basic Goertzel transform produces an output (y0) for each sample processed. The output is a combination of the current ADC sample added to the product of the previous output (y1) multiplied by a constant minus the previous output (y2). After a block of samples has been processed, the sum of the squares of y1 and y2 are computed to determine the relative amplitude of a particular frequency.

Figure 1: The signal flow of the basic Goertzel transform produces an output (y0) for each sample processed. The output is a combination of the current ADC sample added to the product of the previous output (y1) multiplied by a constant minus the previous output (y2). After a block of samples has been processed, the sum of the squares of y1 and y2 are computed to determine the relative amplitude of a particular frequency.

Figure 1 may be written as Equation 1. y0 is the current processed output. x0 is the current ADC sample. y1 is the previously processed output, and y2 is the next previously processed output. m is the frequency domain bin number. N is the sample block size. Input samples are processed on a sample-by-sample basis. Processing continues over a block of input data of the length N. After a block of data has been processed, magnitude and phase information for the signal of interest is contained in the y1 and y2 variables.

Equations 1 - 4

Equations 1 – 4

One of the advantages of the Goertzel transform is that the magnitude (and phase) computation needs to be performed only at the end of a block of data. After a block of data has passed through Equation 1, the relative magnitude may be determined by computing the sum of the squares of the real and imaginary components.

The real component (RC) is described as Equation 2. The imaginary component is calculated with Equation 3. The squared magnitude is computed with Equation 4.

For tone detection only, phase information may be ignored. It’s sufficient to compute the square of the magnitude to determine the relative power of a signal.—Eric Kiser, “Digital Decoding Simplified,” Circuit Cellar 182, 2005. The issue is available in the CC Webshop.

 

 

IR Remote Control Testing (EE Tip #119)

On the Internet you can find them in all shapes and sizes: circuits to test remote controls. Here I describe a simple and cheap method that is not that well-known.

This method is based on the principle that an LED does not only generate light when you apply a voltage to it, but also works in the opposite direction to generate a voltage when light falls on it. Within constraints it can therefore be used as an alternative for a proper phototransistor or photodiode. The major advantage is that you will usually have an LED around somewhere, which may not be true for a photodiode.

IR remote tester

IR remote tester

This is also true for infrared (IR) diodes and this makes them eminently suitable for testing a remote control. You only need to connect a voltmeter to the IR diode and the remote control tester is finished. Set the multimeter so it measures DC voltage and turn it on. Hold the remote control close to the IR diode and push any button. If the remote control is working then the voltage shown on the display will quickly rise. When you release the button the voltage will drop again.

However, don’t expect a very high voltage from the IR diode! The voltage generated by the diode will only be about 300 mV, but this is sufficient to show whether the remote control is working or not. There are quite a few other objects that emit IR radiation. So, first note the voltage indicated by the voltmeter before pushing any of the buttons on the remote control and use this as a reference value. Also, don’t do this test in a well lit room or a room with the sun shining in, because there is the chance that there is too much IR radiation present.

To quickly reduce the diode voltage to zero before doing the next measurement you can short-circuit the pins of the diode briefly. This will not damage the diode.—Tom van Steenkiste, Elektor, 11/2010

Want tips about testing power supplies? We’ve got you covered! EE Tip #112 will help you determine the stability of your lab or bench-top supply!

Arduino-Based DIY Voltage Booster (EE Tip #117)

If your project needs a higher voltage rail than is already available in the circuit, you can use an off-the-shelf step-up device. But when you want a variable output voltage, it’s less easy to find a ready-made IC. However, it’s not complicated to build such a circuit yourself, especially if you have a microcontroller board that’s as easy to program as an Arduino. And this also lets you experiment with the circuit so you can get a better understanding of how it works.

Source: Elektor, April 2010

Source: Elektor, April 2010

No surprises in the circuit—a largely conventional boost converter. The MOSFET is driven by a pulse width modulated (PWM) signal from the microcontroller, and the output voltage is measured by one of the microcontroller’s analog inputs. The driver adjusts the PWM signal according to the difference between the output voltage measured and the voltage wanted.

We don’t have enough space here to go into details about how this circuit works, but it’s worth mentioning a few points of special interest.

The small capacitor across the diode improves the efficiency of the circuit. The load is represented by R3. The components used make it possible to supply over 1 A (current limited by the MSS1260T 683MLB inductor from Coilcraft), but maximum efficiency (89%) is at around 95 mA (at an output voltage of 10 V). To avoid damaging the controller’s analog input (≤5 V), the output voltage may not exceed 24 V. For higher voltages, the values of resistors R1 and R2 would need to be changed.

The MOSFET is driven by the microcontroller, which is nothing but a little Arduino board. The Arduino’s default PWM signal frequency is around 500 Hz—too low for this application, which needs a frequency at least 100 times higher. So we can’t use the PWM functions offered by Arduino. But that’s no problem, as the Arduino can also be programmed in assembler, allowing a maximum frequency of 62.5 kHz (the microcontroller runs at 16 MHz). To sample the output voltage, a frequency of 100 Hz is acceptable, which means we can use Arduino’s standard timers and analog functions. The Arduino serial port is very handy: we can use it for sending the output voltage set point (5–24 V) and for collecting certain information about the operation. Thanks to the Arduino environment, it only took about half an hour to program. Software is available. — Clemens Valens (Elektor, April 2010)

Electromagnetic Compliance Protection (EE TIP #115)

Electromagnetic compatibility (EMC) compliance is one of the last processes before a device may be released to the public. EMC goes hand-in-hand with electromagnetic immunity (EMI), but immunity is only needed for critical devices. With EMC, it is very important to find a good EMC company to deal with. With most circuits, the weak point for EMC is any external leads. By adding a few inexpensive parts, EMC protection can be added and the EMC filtering can be adjusted by changing the values of the parts. In the figure below, the 1 µH inductors act as chokes to block any external voltage spikes above a certain frequency. The 1 nF capacitor also acts as a shock absorber to reduce any sharp voltage spikes. Effectively, this is a second-order filter and the cutoff frequency may be reduced by increasing the inductance and capacitance.

EMC ProtectionEditor’s Note: This EE Tip was written by Fergus Dixon of Sydney, Australia. Dixon, who has written two articles and an essay for Circuit Cellar, runs Electronic System Design, a website set up to promote easy to use and inexpensive development kits. Click here to read his essay “The Future of Open-Source Hardware for Medical Devices.”