9.4.09
MIT Swap Meet!
That glorious nerd food trough of hardware, the MIT Flea (aka Swap Meet) is near the end of the season. Next one is Sunday, September 16th, 2012. It's at the intersection of Albany and Main Street in Cambridge. 9am until around 1:30pm. Shop 'til your geeky legs drop.
31.1.09
Another Fred Note – LEDs and Microcontrollers
(for you who need a refresher and you who are new)
Read: Forrest Mims III's Getting Started in Electronics pages 44-46, 66-69
Light Emitting diodes are very efficient electrical devices that turn small amounts of electrical current into light. Because they are so efficient, and because the light-generating material is so small, they do not tolerate large amounts of electrical current the way ordinary incandescent light bulbs, solenoids, and motors do. Light bulbs and motors are wasteful in that they produce a lot of heat as by-products of their normal operation (the light, after all, comes from a glowing piece of metal in an anaerobic (no oxygen) environment, so it doesn't burn), and as they dissipate excess current (up to a point).
We can take any lightbulb and drive it with its recommended voltage with no other devices in the circuit. We can usually go higher, making the bulb light much more brightly, though we do risk blowing the bulb, or at least shortening its life. A normal Christmas tree bulb, for example, running at 3 volts DC draws .18 amps. If I bump that up to 6 volts, it draws .30 amps and is too bright to look at, but is otherwise doing fine. If I go much higher, I'll blow the bulb. Why? The filament eventually gets hot enough to melt.
A typical LED on the other hand is made to run on about 20mA; that's .020 amps or 1/10 of the current used by the Christmas tree bulb. Also, an LED typically drops about 2 volts in its normal operation. So, if we power an LED with a 2 volt power supply, the device will have all the voltage it needs to light (to overcome the PN junction barrier) and will draw only as much current from the power supply as it needs. Most power supplies that we use however, are not 2 volt power supplies. So what do we do? The most common solution is to waste some current; add a series resistor to make sure that only 20mA runs through the circuit.
Our Atmega chip output pins supply (source) 5 volts. So if we power an LED from a pin on our microcontroller, we need to deal with the 3 volts that remains after the LED drops its 2 volts. If we don't do anything, that voltage will all turn to current and the LED will emit smoke and a horrible smell. Here's how we calculate the value of resistor we need:
From Ohm's law, we remember that V = I * R. In this case, our V is 5 volts. However, our LED will take care of 2 through the process of lighting, so what we have to deal with is really 3 volts.
3 volts = .02 amps * R ohms ----> 3 / .02 = R = 150 ohms
Resistors dissipate electrical current by creating heat, and are also rated in watts. Watts are an expression of how much work a device is doing. The small resistors we use in class are ¼ or ½ watt. The resistor that determines Hi or Low light level in a slide projector might be rated for 20 watts or even more, and is a big wire-wound ceramic monster.
Power (watts) = EMF (volts) * Current (amps) ---> power = 3 * .02 = .06 watts.
So a ¼ watt resistor will be fine in this case.
The general formula for figuring out the value of a series resistor is:
R = (Vin – Vled) / Iled (voltage in volts, current in amps, and resistance in ohms)
Very Important – Our microcontroller sources 5 volts, however, it also can only deliver these 5 volts at a certain amount of current. Microcontrollers are meant to be brains, not muscles. Typically we place devices between the microcontroller and the world to mediate the outputs. From the Atmega168 datasheet, each output pin can source 40mA of current. In addition, any combination of pins in the same register (A, B, C, D) can support a maximum of 100mA. So, if you use 5 of the D ports to drive LEDs, you reach this 100mA maximum when you drive each LED at 20mA. If you need to drive 8 LEDs, you could drive 4 on D ports and 4 on B ports. This becomes an issue when using lots of LEDs or ultrabright LEDs.
I will cover techniques for driving large current loads with the Atmega in another Fred Note. The short answer is: NPN transistors (2N2222a), MOSFETs, ULN2803 IC, SN754410 IC.
For those of you who want to speed ahead:
Log into your account on Machine Science and open the Machine Science Guides. Scroll down to #3, Electronic Projects. Then look for the heading Atmega-Based Projects (NEW!) Click the link Atmega Board. I suggest reading through it. This is roughly the basics of the material we will cover for the next 2 weeks – simple lighting with LEDs, tone generating, analog light readings, use of switches. The better you know this now, the faster we can get to the more interesting cases.
One especially useful feature of the Atmega Guide is a translation of the commands used for materials supporting the Microchip PIC processor to the Atmega168. This allows you to work with other curriculum units published by Machine Science and adapt them for the Atmega chip. Finally, in the Machine Science Guides, under Item 7, Quick Reference, the Atmega guide has the complete pin out of the chip.
Be sure to visit the Atmel home page (www.atmel.com). This will give you a good idea of how these chips are used. For example, there are zillions that are strictly for automotive use. Toasters, space heaters, blenders, cardiac pacemakers, etc. all use them as well. Here's a link to the Atmega168 chip we are using (www.atmel.com/dyn/products/Product_card.asp?part_id=3303). Download the chip summary, and for late night reading, the full document.
(for you who need a refresher and you who are new)
Read: Forrest Mims III's Getting Started in Electronics pages 44-46, 66-69
Light Emitting diodes are very efficient electrical devices that turn small amounts of electrical current into light. Because they are so efficient, and because the light-generating material is so small, they do not tolerate large amounts of electrical current the way ordinary incandescent light bulbs, solenoids, and motors do. Light bulbs and motors are wasteful in that they produce a lot of heat as by-products of their normal operation (the light, after all, comes from a glowing piece of metal in an anaerobic (no oxygen) environment, so it doesn't burn), and as they dissipate excess current (up to a point).
We can take any lightbulb and drive it with its recommended voltage with no other devices in the circuit. We can usually go higher, making the bulb light much more brightly, though we do risk blowing the bulb, or at least shortening its life. A normal Christmas tree bulb, for example, running at 3 volts DC draws .18 amps. If I bump that up to 6 volts, it draws .30 amps and is too bright to look at, but is otherwise doing fine. If I go much higher, I'll blow the bulb. Why? The filament eventually gets hot enough to melt.
A typical LED on the other hand is made to run on about 20mA; that's .020 amps or 1/10 of the current used by the Christmas tree bulb. Also, an LED typically drops about 2 volts in its normal operation. So, if we power an LED with a 2 volt power supply, the device will have all the voltage it needs to light (to overcome the PN junction barrier) and will draw only as much current from the power supply as it needs. Most power supplies that we use however, are not 2 volt power supplies. So what do we do? The most common solution is to waste some current; add a series resistor to make sure that only 20mA runs through the circuit.
Our Atmega chip output pins supply (source) 5 volts. So if we power an LED from a pin on our microcontroller, we need to deal with the 3 volts that remains after the LED drops its 2 volts. If we don't do anything, that voltage will all turn to current and the LED will emit smoke and a horrible smell. Here's how we calculate the value of resistor we need:
From Ohm's law, we remember that V = I * R. In this case, our V is 5 volts. However, our LED will take care of 2 through the process of lighting, so what we have to deal with is really 3 volts.
3 volts = .02 amps * R ohms ----> 3 / .02 = R = 150 ohms
Resistors dissipate electrical current by creating heat, and are also rated in watts. Watts are an expression of how much work a device is doing. The small resistors we use in class are ¼ or ½ watt. The resistor that determines Hi or Low light level in a slide projector might be rated for 20 watts or even more, and is a big wire-wound ceramic monster.
Power (watts) = EMF (volts) * Current (amps) ---> power = 3 * .02 = .06 watts.
So a ¼ watt resistor will be fine in this case.
The general formula for figuring out the value of a series resistor is:
R = (Vin – Vled) / Iled (voltage in volts, current in amps, and resistance in ohms)
Very Important – Our microcontroller sources 5 volts, however, it also can only deliver these 5 volts at a certain amount of current. Microcontrollers are meant to be brains, not muscles. Typically we place devices between the microcontroller and the world to mediate the outputs. From the Atmega168 datasheet, each output pin can source 40mA of current. In addition, any combination of pins in the same register (A, B, C, D) can support a maximum of 100mA. So, if you use 5 of the D ports to drive LEDs, you reach this 100mA maximum when you drive each LED at 20mA. If you need to drive 8 LEDs, you could drive 4 on D ports and 4 on B ports. This becomes an issue when using lots of LEDs or ultrabright LEDs.
I will cover techniques for driving large current loads with the Atmega in another Fred Note. The short answer is: NPN transistors (2N2222a), MOSFETs, ULN2803 IC, SN754410 IC.
For those of you who want to speed ahead:
Log into your account on Machine Science and open the Machine Science Guides. Scroll down to #3, Electronic Projects. Then look for the heading Atmega-Based Projects (NEW!) Click the link Atmega Board. I suggest reading through it. This is roughly the basics of the material we will cover for the next 2 weeks – simple lighting with LEDs, tone generating, analog light readings, use of switches. The better you know this now, the faster we can get to the more interesting cases.
One especially useful feature of the Atmega Guide is a translation of the commands used for materials supporting the Microchip PIC processor to the Atmega168. This allows you to work with other curriculum units published by Machine Science and adapt them for the Atmega chip. Finally, in the Machine Science Guides, under Item 7, Quick Reference, the Atmega guide has the complete pin out of the chip.
Be sure to visit the Atmel home page (www.atmel.com). This will give you a good idea of how these chips are used. For example, there are zillions that are strictly for automotive use. Toasters, space heaters, blenders, cardiac pacemakers, etc. all use them as well. Here's a link to the Atmega168 chip we are using (www.atmel.com/dyn/products/Product_card.asp?part_id=3303). Download the chip summary, and for late night reading, the full document.
11.11.08
Breakdown of the water metaphor (from Fred)

The water metaphor is useful for visualizing certain aspects of electricity and electronics, however it breaks down when discussing certain concepts. For example, it is an important tool for making an abstract concept concrete, and is useful for discussing electric potential, switches, and simple flow of electrons. However, it can be misleading when used to discuss current and circuits. The usual discussion is that constricting a pipe limits the water flow and, by extension, the current. This is more or less true, but confusion arises because depending on where and how you constrict a water pipe, the water can actually flow faster and with more force, even though less water may be actually flowing. At the faucet handle (valve), the metaphor is pretty close to matching (mostly because the constriction happens before the water enters the faucet, which has a relatively large cross section dampening the extra pressure and speed created at the valve), but if you constrict the water flow at the end of a pipe, by putting a finger over it, the speed increases dramatically, the amount of actual water flowing changes only slightly, and the pressure increases, sometimes by a lot. This is NOT true with electricity. Resistance in a circuit does not make electrons flow faster, it makes them slower, nor does it make them push harder. It does, however, like a water valve, create more turbulence, and wire diameter like water pipes, changes the speed too. Remember, current is NOT the speed of electron flow (though it's related to it). In fact, other than making a CRT work, electron speed is not something we really ever need to worry about. Electron speed is fairly slow: in wire it's around 1 millimeter per second; in a vacuum (like the inside of a CRT) it is around 1/10 the speed of light. But remember, the actual path of electrons isn't important, electrons bounce around in all directions with an overall tendency to move in the direction of electron flow; it's more that when one pushes in on one end, another pops out the other, and for practical purposes, that happens nearly instantaneously. Current is a measure of the actual number of electric charge particles flowing past a point over a given time. Speed is the distance covered over time. When things move, potential energy is converted into kinetic energy. Resistance is actually taking away energy from electrons and turning it into heat rather than the slowing down of electrons.
Another breakdown concerns electric circuits. If the water metaphor is constructed with a closed loop and a pump – like our body's circulatory system, then it's more or less okay, as long as we ignore the fact that we need to power the pump. If it's constructed using a tower, then it's not clear how the water gets back to the top. The energy loss (entropy), inherent in all things and all processes, will guarantee that the water does not have enough energy to get back to the bucket on top of the tower.
See:
http://hyperphysics.phy-astr.gsu.edu/hbase/electric/watcir.html
http://en.wikipedia.org/wiki/Electric_current
http://www.eskimo.com/~billb/miscon/speed.html
10.11.08
Places to get stuff

Plug for Lady Ada (AdaFruit Industries) a.k.a Limor Fried. She is the best source for Arduino Boards as well as build-able electronic kits, especially her own designs. Her site also has tutorials and general information in keeping with her philosophy and practice of "Open Source Hardware."
Subscribe to:
Posts (Atom)