The Prophylactic Layer
Let's talk about protection. Your microcontrollers are actually quite fragile and although you can program them, they can't actually do much. Blink an LED or two? Big deal! But if you try to hook it up to a motor or an automobile, then your precious little integrated circuit will die. So what do you do? How can you actually get your microcontroller doing anything useful?
This introduces us to what I will call the prophylactic layer: the assortment of electronic components that sits in between your microcontroller and everything else. These components aren't so obviously useful. The microcontroller is like a brain and it controls stuff. The motor is like a muscle and it moves stuff. The light bulb is like a ... ok, but it illuminates stuff. They all do things that are pretty obvious to electronics novices. The transistor, the relay, the amplifier, the triac, the optoisolator. These components are a little more mysterious, but it might help to think that they are often like a prophylactic layer.
What this really is about is power. You will generally run into one of two situations: (a) you need to connect a higher voltage thing to your microcontroller and/or (b) the thing you're connecting requires a lot of current.
Take this as an example: you want your microcontroller to run a 24V DC motor. There are several ways to do this, but one of the most common is to use an H-Bridge. This would still be a good idea even if you were only using a 5V motor because the dirty voltage spikes and stuff would not be a good thing to expose your microcontroller to... so you spend a couple bucks and put an H-Bridge in between your motor and your microcontroller.
An other good example: you want to have your microcontroller turn a light on and off. Not an LED, but a real AC powered desk lamp. This is like Protestants and Catholics or punks and hippies -- you shouldn't just mix them together and see what happens! Tom Igoe discusses this but I really like
this circuit the best. You can also see a more broad writeup.
You'll probably start to guess that protecting the microcontroller isn't the highest priority... it's more about getting voltage levels to agree and supplying the right amount of power to the right places. I haven't gone into beefier transistors like the TIP120 or opto-isolators, but they can be useful too!
Related: Switches, transistors, and relays
Submitted by seandockray on 28 February 2007 - 12:16am.
» seandockray's blog | login to post comments
