Sunday, June 03, 2007

Voodoo Electronics

I'm interested in robotics, but building robots requires three things: mechanics, electronics and software. (I'm intentionally ignoring BEAM here -- I'm not interested in building software-free robots.) I know software, and I feel like I have an okay grasp of mechanical systems. I don't know enough about electronics, though.

My understanding of electronics is that there are basically three types of electronics:

  • AC electronics. Not especially relevant to building robots.
  • DC digital electronics. This part I feel like I pretty much understand. It's based on boolean logic, and so a lot of my software knowledge is applicable. The only extra bits are pretty simple:
    • you're dealing with high versus low rather than true/false, so you need to come up with a mapping convention for each circuit and stick with it.
    • many components (like ICs) also need power. Just get a power source that's the right voltage and enough current, and this should be okay.
    • there are a few different "families" of digital components. Stick with one for any one circuit.
  • DC analog electronics. This has two main parts. The first part is the "simple bits": things like Ohm's law which every single electronics tutorial feels the need to tell you about. The second part is what I've come to call "voodoo electronics" -- the parts that every electronics tutorial I've ever seen simply hand-waves away.

A recent example of "voodoo electronics" that I encountered was in the most recent issue of Make. This issue had a number of electronics tutorials. Some of these were very helpful, like Your Electronics Workbench. The article on the 555 timer chip, however, The Biggest Little Chip, suffered from the voodoo electronic problem. The article contained the following schematic:

Figure 2 from "The Biggest Little Chip"

It then went on to explain the purpose of each of the various components one by one. The explanations were a bit terse, but reasonable. Eventually, the entire circuit had been explained except for R3 and C2. Here's how the article explained their purpose:

R3 protects the LED from excessive current, while C2 protects the 555 timer from random noise.

"Excessive current"? "Random electronic noise"? How am I supposed to design my own circuits without understanding how to both predict when these problems will exist and how to devise a defense against them? So far I have yet to see a single electronics tutorial that explains these things.

I ran into the same thing when I found some schematics for a stepper motor controller on the web. All of the schematics made sense to me, except a mysterious zener diode which was there (according to the documentation) "to absorb reverse EMF". No more explanation was given.

Are there any electronics tutorials out there that actually explain how to predict when part of a circuit will be susceptible to "random electronic noise", "excessive current", or "reverse EMF" and how to build protection against them, or is my only hope to take a full-fledged course in electrical engineering?

Update

After posting this I realized that I could just post a comment on Make's website. The author of the 555 article posted a very helpful response. Now I just need to figure out what that zener diode in that stepper motor controller was for.

posted Sunday, June 03, 2007
Get yourself a copy of "Horowitz and Hill". It's the bible.  
  Blogger Mark on June 05, 2007
Let me start with the observation
mobile phone is notorious for introductiopn of noise in all kinds of electronic gears.

[noise] and [error] - are these two inherently different? Ontollogically probably not that much but we will nevertheless try to find distinct definitions for these two.

[noise] comes from an external (whereby external is a question of perspective) source beyond your control and defined through the point in time and the intenisty it occurs. But as far as you know noise is a random phenomenion - easy to explain, can be filtered out efficiently, but next to impossible to sensibly predict.
[error] is a much more accesile term and generally can be viewed as digression from a Standard and we strive to predict errors, or better .You can't eliminate erors them but you can design with them in mind.

In short, somewhat simplicistic - nature does a great job as noise provider, you try to get on par with it, producing quality errors - this is clearly the job, where one or more of us humans can excel.!

Going forward, we conclude that we wanna try to filter out noise and deal with errors as efficient as possible.

As it turns out we can use our two prevalent tools, we have as technicians - namely math and the human brain (the latter one best be your own - rented ones have shortcomings regarding configuration options and you never know3n what they have been up to in the past.

The approach 'filter noise' 'deal with error' works remarkably well for those proficient with both.

With filters,the most efficient ones (i.e linear filters in continous time aka Kalman filters) are not easily accessible to the general public as they are based on stochastic differential equations, simply meeaning, you deal with analysis and probability theory (stochastics) simulataenously. Fabolous pastime on rainy Sundays, IF AND ONLY IF you like it.

You don't really need to be able to do the math, somebody else most likley already has.

As for errors, error prediction and calculation of the development of these aberrations are mandatory at least in Europe in case you strive for an engineering degree. The whole stuff, though of major significance is mathematicxcally rather dull and based on statistics and a touch stochastics.

How to find out where to add tolerances based on likely occurences of errors or what to watch out for in terms of filters? Mostly experience plus some common sense. The easiest approach though is to leave that stuff out of your device completely and strart using it right away. Whenever it stops working under certain circumstances, u have most likely hit an error condition. Whenever the use of the device gets really unpleasant you might think of some filtering. And think again about unpleasant, should the governmment pay youn a zillionj to create a new highly efficient electronic torture device.

A last word of caution: Funny as much does sound, don't fool yourself. If you intend to build an electronics device for resale, dealing with epsilon (the tiny error) will be one of the challenges in order to get all the needed compliance seals.

Was a fairly long comment - should you have read 100%, understood at least 50% and still not be mind numbed by excessive boredom, you might es well consider pursuing a techie degree - preferably at a university of your choice.

hth, gerald  
  Anonymous Anonymous on June 05, 2007
Thanks for interesting blog!  
  Anonymous Anonymous on June 18, 2007
Hey,
When a motor or solenoid turns off, it generates a *large*, reverse polarity voltage spike. This is due to the coil trying to resist the change in magnetic field (by compensating with voltage). The total power of the spike is small (since the current is low), but the voltage is very dangerous for digital electroinics - if you don't protect yourself, you'll notice simple logic IC's going wonky after the nearby solenoid goes off a couple hundred times.

The zener diode basically "breaks down" when there's more than a couple volts of current BACKWARDS over the motor - at which point it just shorts them out.

In fact, a zener isn't reallly required - a regular diode usually seems to work well.

--Junior in Computer Engineering at UIUC / kid who likes to build things.  
  Anonymous Anonymous on June 29, 2008
Thanks, "anonymous". That's a very clear explanation.  
  Blogger Laurence on June 29, 2008
Anytime.
The question about Excessive Current is actually a really important one - it's hard to figure out how to power a LED properly if you're relying on your everywhere-cited ohm's law.

Instead of having a resistance like most components, LED's have a "voltage drop", and basically no resistance.

So to figure out how large of a current-limiting resistor to attach to a LED, you basically need to know how much current the LED runs at, how much voltage your source is, and what the forward voltage drop of the LED is.

If you're running lets say .. 5V, and your LED has a forward drop of 0.7v and requires 20ma of power (pretty typical for a small red led).. the math goes like this.

5v-0.7v == 4.3 volts. So if you've got 4.3 volts left, and you want to use your resistor to limit it to 20ma, now here is where your ohm's law comes in: 4.3 / 0.020 == 215. So a 215 ohm resistor (220 is fine, obviously).

Now lets say you want to run two LED's in a row (series). 5V - 0.7 - 0.7 == 3.6V. 3.6 / 0.02 == 180 ohm's will limit it to 20ma (powering both).

If you'd like to run your LED's in parallel, you can simply add their current usage together (so 2 of those would be 20ma, but a total of 0.7V drop). It's best to avoid running lots of LED's in parallel, though, since it tends to distribute more current to the worst performing one (leading to more likely failure).

And on that note, I need to lay off the caffeine and blog commenting ^_~  
  Anonymous Anonymous on June 29, 2008
Well,it looks like the other posters have answered your questions.

The funny thing is I thought I had invented the term "Voodoo Electronics",so I thought I would Google to see if there were any references==oops! pages & pages!.

My definition is a bit different to yours,in that I apply it to things like people thinking a High current low voltage supply is more dangerous than a high voltage low current supply.
Ohms Law is a new & startling concept to them!

Another case is where a production run was held up for days because there were no 1.1KOhm resistors available for a particular RC network.
There were hundreds of 1.0kOhm & 1.2kOhm resistors available.
The C part of the circuit was a 47uf electrolytic +- 20% tolerance hor worse!

this decision was made by a so-called "technical Specialist"!

VK6ZGO  
  Anonymous Anonymous on July 08, 2008
Great tutorial.
Thank You,
GuruSantiago

Want to learn more about electronics?

The GuruSantiago can help. Checkout his videos here:

http://www.youtube.com/user/ElectronicsIsFun
And follow him on twitter @ElectronicsFun  
  Blogger GuruSantiago on July 18, 2010