Issue 272: EQ Answers

The answers to the Circuit Cellar 272 Engineering Quotient are now available. The problems and answers are listed below.

Problem 1—Why does the power dissipation of a Darlington transistor tend to be higher than that of a single bipolar transistor in switching applications?

Answer 1—In switching applications, a single transistor can saturate, resulting in a low VCE of 0.3 to 0.4 V. However, in a Darlington pair, the output transistor is prevented from saturating by the negative feedback provided by the driver transistor. If the collector voltage drops below the sum of the VBE of the output transistor (about 0.7 V) and the VCE(sat) of the driver transistor (about 0.3 V), the drive current to the output transistor is reduced, preventing it from going into saturation itself. Therefore, the effective VCE(sat) of the Darlington pair is 1 V or more, resulting in much higher dissipation at a given current level.

Problem 2—Suppose you have some 3-bit data, say, grayscale values for which 000 = black and 111 = white. You have a display device that takes 8-bit data, and you want to extend the bit width of your data to match.

If you just pad the data with zeros, you get the value 11100000 for white, which is not full white for the 8-bit display—that would be 11111111. What can you do?

Answer 2—One clever trick is to repeat the bits you have as many times as necessary to fill the output field width. For example, if the 3-bit input value is ABC, the output value would be ABCABCAB. This produces the following mapping, which interpolates nicely between full black and full white (see Table 1). Note that this mapping preserves the original bits; if you want to go back to the 3-bit representation, just take the MSBs and you have the original data.

3-bit INPUT 8-bit OUTPUT
000 00000000
001 00100100
010 01001001
011 01101101
100 10010010
101 10110110
110 11011011
111 11111111

Problem 3—Can an induction motor (e.g., squirrel-cage type) be used as a generator?

Answer 3—Believe it or not, yes it can.

An induction motor has no electrical connections to the rotor; instead, a magnetic field is induced into the rotor by the stator. The motor runs slightly slower than “synchronous” speed—typically 1725 or 3450 rpm when on 60 Hz power.

If the motor is provided with a capacitive load, is driven at slightly higher than synchronous speed (1875 or 3750 rpm), and has enough residual magnetism in the rotor to get itself going, it will generate power up to approximately its rating as a motor. The reactive current of the load capacitor keeps the rotor energized in much the same way as when it is operating as a motor.

See www.qsl.net/ns8o/Induction_Generator.html for additional details.

Problem 4—In Figure 1, why does this reconstruction of a 20-kHz sinewave sampled at 44.1 kHz show ripple in its amplitude?

Answer 4—The actual sampled data, represented by the square dots in the diagram, contains equal levels of Fsignal (the sine wave) and Fsample-Fsignal (one of the aliases of the sinewave). Any reconstruction filter is going to have difficulty passing the one and eliminating the other, so you inevitably get some of the alias signal, which, when added to the desired signal, produces the “modulation” you see.

In the case of a software display of a waveform on a computer screen (e.g., such as you might see in software used to edit audio recordings), they’re probably using an FIR low-pass filter (sin(x)/x coefficients) windowed to some finite length. A shorter window gives faster drawing times, so they’re making a tradeoff between visual fidelity and interactive performance. The windowing makes the filter somewhat less than brick-wall, so you get the leakage of the alias and the modulation.

In the case of a real audio D/A converter, even with oversampling you can’t get perfect stopband attenuation (and you must always do at least some of the filtering in the analog domain), so once again you see the leakage and modulation.

In this example, Fsignal = 0.9×Fnyquist, so Falias = 1.1×Fnyquist and Falias/Fsignal = 1.22. To eliminate the visible artifacts, the reconstruction filter would need to have a slope of about 60dB over this frequency span, or about 200 dB/octave.

CC272: Issue of Ingenuity

The March issue of Circuit Cellar includes articles from a number of practical problem solvers, such as a homeowner who wanted to get a better grasp of his electrical usage and a professor who built a better-than-average music box.

Dean Boman, a retired spacecraft communications systems designer, decided to add oversight of his electric usage (in real time) to his home-monitoring system. After all, his system already addressed everything from security to fire detection to irrigation control. On page 34, he describes his energy monitoring system, which provides a webpage with circuit-by-circuit energy usage. This level of detail can make you a well-informed energy consumer.

Dean Bowman’s energy-monitoring system

Bruce Land, a senior lecturer in electronics and computer science at Cornell University, thought developing a microcontroller-based music device would be a useful class lesson. But more importantly, he knew his 3-year-old granddaughter would love an interactive music box. On page 28, he shares how he built a music device with an 8-bit microcontroller that enables changing the note sequence, timbre, tempo, and beat.

Computer engineer Chris Paiano has written many application notes for the Cypress programmable-system-on-chip (PSoC) chipset. He is even working on a PSoC solution for his broken dishwasher. But that’s far from his most impressive work. Read an interview with this problem-solver on page 41.

College students built a rotational inverted pendulum (RIP) to test nonlinear control theory. But you might want to make and tune one for fun. Nelson Epp did. On page 20, he describes how he built his RIP and utilized a TV remote control to meet the challenges of balance and swing. “It is a good project because the hardware used is fairly common, the firmware techniques and math behind them are relatively easy to understand, and you get a good feeling when, for the first time, the thing actually works,” he says.

Nelson Epp’s rotational inverted pendulum (RIP)

Chip biometrics are unique digital chip features—left by the manufacturing process—that distinguish one chip from another of the same type. Finding these chip “fingerprints” is important in developing trustworthy and secure electronics. On page 45, Patrick Schaumont discusses how to extract a fingerprint from a field programmable gate array (FPGA) and authenticate a chip’s identity.

Maurizio Di Paolo Emilio, a telecommunications engineer from Italy, designs data acquisition system software for physics experiments and industrial use. In the Tech the Future essay on page 80, he discusses the many alternatives for data acquisition software and the goal of developing credit-card-sized embedded data acquisition systems, using open-source software, to manage industrial systems.

Other article highlights include George Novacek’s look at ways to reduce product failures in the field (p. 52), Ed Nisley’s take on how to get true analog voltages from the Arduino’s PWM outputs (p. 56), and Jeff Bachiochi’s guidance on using a development kit to design a tool to help transmit Morse code (p. 68).

With this issue’s emphasis on robotics, you’ll want to check out  our From the Archives article about a SOPHOCLES design for a solar-powered robot that can detect poisonous gas (p. 62).

Q&A: Chris Paiano (Problem Solving & Design)

Chris Paiano is an Elko, NV-based problem engineer. His father introduced him to programming at an early age, and Chris has continued to team with his father to write software and firmware for some of his hardware designs. Chris has written dozens of unique application notes for the Cypress Semiconductor Programmable-System-on-Chip (PSoC) chipset. He is currently using PSoC in an innovative household project and dreams of finishing his concept for environmentally friendly electric/hybrid vehicle wheeldrive retrofit kits.

Chris Paiano working with his “office assistants” (bearded dragons)

You can read the complete interview in Circuit Cellar 272 March 2013.

NAN PRICE: Tell us a little about your background.

CHRIS PAIANO: I went to school in Orlando, FL, all the way through college at the University of Central Florida, where I obtained my bachelor’s degree in Computer Engineering.

I started at a very young age. My father always had an electronics workbench and I spent time there when I could. When I was 2 years old, he brought me home an Apple ][ with some floppy disks and told me there were games to be played—if I could only figure out how to make them work.

The Apple ][ was not the most user-friendly or intuitive computer system, by any means. In order to accomplish my important goal of playing video games, I had to learn how to work with the computer’s clunky command-line interface (CLI). Once I figured out how to make all the games work, I wanted to fully automate them so I didn’t have to go through all the manual steps to play them every time (also, so my friends could start them up without me). So, I spent much time developing automatic start-up scripts, from the Applesoft HELLO program to MS-DOS configuration start-up menus, supporting whatever memory management method was required to play certain games, along with icon-driven pre-Windows menu systems that made these early systems usable by my friends, family, and clients.

This evolved into more elaborate scripting and programming to fill the gaps where the tools I needed did not exist, so I had to create them. My possibilities really opened up when I began developing firmware to complement my father’s hardware designs.

NAN: Tell us about your company, Christopher Paiano Engineering (CpE).

CHRIS: I design and program prototypes for various clients. I provide them with ideas at various development stages, which I turn into something that they can mass produce. I’ve just redesigned my website (www.cpeproto.com), by the way. It has a sleeker, simple interface and is easier to navigate now. No more Java menu with annoying sound effects!

NAN: Several of your projects are built around the Cypress Semiconductor programmable system-on-chip (PSoC). Is that your go-to chipset?

CHRIS: Yes, mainly because of how versatile and capable it is. It seems to be sufficient to take care of most any embedded task or set of tasks that come to mind.

For example, recently, the proprietor of a local game/tech/arcade business approached me to build a custom, inexpensive door chime. He wanted customers to hear random, recognizable portal sounds from popular video games whenever customers entered or exited his shop.

I started with an inexpensive motion sensor product from a local superstore. I added a Cypress CY8C27443 PSoC, as I have several lying around for general projects. I made a copy of my “Playing WAV Files with a PSoC” app note project to modify.

I added code to randomly cycle through available sound clips in the memory and I was able to provide 1.9805 s of audio at 8 kHz with the 16 KB of RAM available in this chip. The client was happy with this. He settled on two portal sounds (from The Legend of Zelda and Super Mario Brothers) and the chime has been in use for several months now. Customer feedback has been excellent. Everyone entering the place immediately recognizes the sounds and loves it!

NAN: You’ve written more than 30 application notes for the Cypress chipset, including PongSoC and the Video RTA. Can you explain the process?

CHRIS: Sometimes Cypress would post bounties for app notes that they’d like to see written on a certain topic or capability. Other times, I’d have an interesting personal project for which I decided to utilize a PSoC. I would then decide it might make a good app note, so I’d write it up and submit it. Either way, I’d usually develop the project side-by-side with my father. (We make an excellent hardware/software team.) I work out whatever firmware and PC/smartphone apps may be necessary, and he builds the PSoC circuit board with which to test. Then, I document it all, arrange it, and edit it into an app note (or, in some cases, an article).

Sometimes a project is just too complex to squeeze into a single PSoC’s resources and the simplest solution is to just add another PSoC. Communication between PSoCs can be quick and easy to implement, so distributing tasks and maintaining synchronization is not too difficult. This was the solution for the video real-time analyzer (RTA) app note where, realistically, there were only enough internal analog resources to provide three filters in each PSoC. With the Video RTA, one just adds as many PSoCs to the bus as is necessary to achieve the desired analyzer resolution.

The PongSoC was a fun one! Once I learned it was possible to combine some internal PSoC modules and algorithms to generate a stable composite video signal, I immediately decided I wanted to try and utilize this new capability to recreate a Pong-like embedded game-on-a-chip. I could already generate sound effects and read potentiometers for paddle inputs, I just needed to work it all out. I had a great time doing so, testing it with friends and playing with the variables to tweak the gameplay, and so forth.

Additionally, all 40 of my PSoC application notes are now available in some capacity on my updated website, as Cypress does not actively market the older PSoC families that many of my projects utilized in the past. I get enough e-mail requests for source code and documentation from this collection, so I have just gone ahead and taken the time to restore as many as I could find from my archives to the new website.

NAN: Your two-part article series “PSoC Design Techniques” describes how to build an eight-channel mixer and how DSP effects and a user interface can be added to it (Circuit Cellar 216–217, 2008). Describe the design and why you chose this design concept.

CHRIS: This was a great challenge. In a chip that traditionally would only allow for four full audio pathways in the provided analog resources (four PGA modules utilizing the normal I/O paths provided by PSoC Designer), we managed to figure out a way to utilize the remaining switched-capacitor blocks to act as signal mixers and gain stages with enough live reconfigurable resources to add potentiometers to control volume for each channel. Since there was still plenty of code space, I went ahead and added some DSP effects (reverb and pitch shift) along with a voice menu and flash-settings memory.

I really wanted to showcase what efficient design and algorithms could accomplish in a single piece of silicon, and I’m quite pleased with the way this project turned out. I still use the resulting device on my workbench and in my setups. It comes in handy sometimes. I have not updated it at all. I’ve been using it as is and it is still available for purchase on my website for anyone interested in experimenting with one.

NAN: Are you currently working on or planning any microprocessor-based projects?

CHRIS: Currently, I’m working on a PSoC solution for my broken dishwasher.

Chris Paiano is developing a PSoC solution for a broken dishwasher. In addition to the fix, he plans to make it smartphone-controllable.

The control module on this appliance has failed, so I am wiring it into a PSoC to make it work again as well as add some new capabilities (such as keeping a wash/rinse/door open log so it can tell when the dishes contained within it are clean or dirty, and adding a Bluetooth module so I can check the status and control/program the appliance from my smartphone).

This is the type of personal project I like to work on in my free time. It also might make a good app note or article in the future, as it involves an Android application and Bluetooth communication. It also increases my capabilities, if I have to figure out anything new. And that is always good.

I am almost ready to hook it up to the dishwasher, let it try running through the cycles, and hope I don’t flood my house in the process. Ah, the pure excitement of engineering!

The entire interview is available in Circuit Cellar 272 March 2013.

Microcontroller-Based Markov Music Box

Check out the spectrogram for two FM notes produced by FM modulation. Red indicates higher energy at a given time and frequency.

Cornell University senior lecturer Bruce Land had two reasons for developing an Atmel AVR micrcontroller-based music box. One, he wanted to present synthesis/sequencing algorithms to his students. And two, he wanted the challenge of creating an interactive music box. Interactive audio is becoming an increasingly popular topic among engineers and designers, as we recently reported.

Land writes:

Traditional music boxes play one or two tunes very well, but are not very interactive. Put differently, they have a high quality of synthesis, but a fixed-pattern note sequencer and fixed tonal quality. I wanted to build a device which would play an interesting music-like note sequence, which constantly changed and evolved, with settable timbre, tempo, and beat… To synthesize nice sounding musical notes you need to control spectral content of the note, the rise time (attack), fall time (decay), and the change in spectral content during attack and decay.  Also it is nice to have at least two independent musical voices. And all of this has to be done using the modest arithmetic capability of an 8-bit microcontroller.

Land’s students subsequently used the music box for other projects, such as an auto-composing piano, as shown in the following video.

In early 2013 Circuit Cellar will run Land’s in-depth article on the Markov music box project. Stay tuned for more information.