Testing and Debugging (Stuff They Don't Teach You in School)

by nords in Workshop > Repair

1281 Views, 27 Favorites, 0 Comments

Testing and Debugging (Stuff They Don't Teach You in School)

Question.JPG

So, you have some device, whether it is a purchased product or something you have built and you want to find out if it is working correctly. Here are some 'semi-obvious but not always' thoughts on the process.

Does It Work?

DSC_1809.JPG

In order to test it, you need to understand how it should be hooked up, how the user interface works and what the correct output should be. OK, this sounds more than semi-obvious but many times a device will be operating according to the manufacturer's design but not according to the user's expectations. 'RTFM' (read the manual) comes into play here. On my high end tuner/preamp, it has two output sets that are controlled separately for two different rooms - perfect for my application. When I connected it up, not all the inputs were available to each output. THEN I read the manual. The secondary output only gets analog inputs - nothing digital from my computer, CD or DVD players. My bad.

So, It Doesn't Work. Now What?

DSC_1805.JPG

So, now you are sure it doesn't work correctly. Try to describe what is not working. Don't do 'why' yet. Fight the urge to dive in with meters and start thrashing around. Switching examples, I made a headphone amplifier for my stereo. 18V external AC supply feeding an internal regulated power supply, stereo audio in, simple two channel amplifier, stereo output to a headphone jack. So, I connect it up to an analog CD player and headphones, nothing comes out the left channel. The right channel works fine. Hmmm.

Since I built this from a kit, I should say that not all kits are created equal. The instructions on the left are from my headphone amp. I had to look up the pin out of the transistor. Any other build information came from the silkscreen. The "+24V" silkscreen had the "+" at the negative input - I only found that out by following the schematic. The instructions on the right from a resistance decade box are only one page in about six. They had the resistor color code printed along with a drawing of every part including the hardware. Much better.

Gather More Information

DSC_1803.JPG

This step implies some thinking about how it functions... err, should function. If no sound came out, I might suspect the power supply since this is common to both channels, leading me to take some voltage readings of the external and internal supplies. Stereo issues are easy when one channel is good - you can swap things to gain information. This is true for multi-axis stepper applications too. So, I swap the inputs cables at the source. The left channel is still dead. OK, it is not the source (CD player problem). Next, I swap the input cables at the amplifier. Nothing changed so the problem isn't the cable. A bit harder but the two channels are each on their own circuit board so I can move the output wires to the headphone jack. The problem moves. I have localized the problem to the left channel circuit board.

I would like to say here that there is a difference in testing something that is manufactured vs your own project. For an off-the-shelf product, it is worth considering whether or not it has ever worked and whether it is under warranty and can be hauled back to a store. For your own project, there are two major possibilities - a design error (unless it is a well established design, like a kit) or a fabrication error. For a kit, most probably it is a fabrication error - soldering problem, wrong component or component installed incorrectly. On occasion you will get a bad part, but it is far more likely that a fabrication error caused the part to fail. Keep that in mind if you find a bad part and replace it, ask why that part would fail since the failure could have been caused my something else (eg. fuses don't fail on their own). For your own design, I hate to say it but, design error is pretty common. Reread any data sheets, and rethink a bit.

Inspection - Use Your Eyes and Your Wits

DSC_1808.JPG
DSC_1806.JPG

Now that the gathered information has directed you to a problem area (in my case the left channel circuit board), stop testing. It is time to observe, carefully. Examine all solder joints for poor soldering, bridges, strands of wire, solder blobs and anything ugly. Double check all connectors and crimped pins. Often it is mechanical stuff that will bite you. Is there symmetry? In my case, the left and right boards are the same. I put them side by side and compared each component. If not, check each component value - learn the resistor color codes. If you have any extra uninstalled parts, measure their values. For mechanical systems, you are looking for things binding, not tightened down well, slipping, flexing.

There are lots of ways to do inspection. I am very nearsighted and can take off my glasses for a close focus. I have a number of lamps around with magnifying glasses built in. There are those sexy magnifying lenses that you can either put around your forehead or clip onto glasses. You can put some optics (from a lupe, scavenged from a scanner or just purchased) in front of your cell phone camera. Or, you might have access to a stereo inspection microscope if your geek circle is diverse enough.

Here is another thought: know that some parts are polarized or have orientation requirements, others don't.

No requirements: Resistors light bulbs 2 pin switches 2 wire inductors

Sometimes requires orientation: Capacitors (polarized and non-polarized) Multi-pin switches (depends on the switch) Connectors (some are symmetrical, most have some kind of key)

Always: Diodes LEDs Semiconductors in general Batteries DC motors

Now It Gets Interesting

DSC_1810.JPG
DSC_1802.JPG

If you haven't found the problem yet, it gets more interesting. I find there are two main techniques I use at this point.

First is dividing the problem wherever possible.

The second is putting a known stimulus into the system and following it, comparing to what you think it should look like.

In mechanical systems, dividing the system might be removing a belt or chain and seeing if drive section works without the load. Then see if I can turn the shaft of the load by hand. Every once in awhile, you get had by this and the problem only occurs when the system isn't split. Putting in a known stimulus could be hand cranking bike pedals or connecting a 1KHz sine wave generator to an input. For electronics, it is time to use the test equipment.

Another random thought: before you power up your circuit, clean off your bench well. No solder splashes, wire bits or anything else conductive should remain.

Call in the Cavalry!

Help from friends.jpg

Still not working and you are feeling dumbfounded? Time to call in the cavalry. This can be a forum on the web or another person from your circle of maker friends. Present your problem in an organized manner. Exactly what equipment is failing (model, revision, software), what the failure is and how it occurs, what you have observed and tried. You will get much more willing help when you show you value their expertise by being organized and not wasting 10 posts just to describe the problem. This is a photo of my group at the makerspace. There is always someone happy to help with small problems if I ask. For larger problems, pizza and beer/soda/wine as appropriate are good thank yous.

Always an Answer

DSC_1811.JPG

There is always an answer. Sometimes, it is 'no'. For your own sanity's sake, sometimes you cut your losses and move on. There is no shame in that - you learned a lot along the way.