The TI TLC59xx chip family are constant current LED drivers that have some pretty impressive stats. I'm experimenting with the TLC5941 which has 16 constant current channels, 80mA sink capability per channel, 17v maximum LED voltage and 4096 PWM intensity levels per channel. If you want to use it, here's an Eagle schematic and footprint to get you going: https://github.com/gandrewstone/tlc594x/blob/master/eagle/tlc594X.lbr
And here's a photo of 2 quad chip driver boards that I made.
Packing those features into such a small chip has created a device that has got some nasty traps that are not described in the datasheet (or hard to understand) and so it is easy for beginning hardware hackers to either fry a couple of chips or just give up in frustration. If you are looking into using this chip, check out my experiences after the break.
Popular Posts
- TLC5940, TLC5941 and Arduino
- Arduino L298 stepper motor driver
- Arduino PWM on all pins.
- DIY PCB fabrication; Breakout Board Toner Transfer Experiments
- Arduino and M5451 -- Control 35 LEDs, motors, etc!
- DIY PCB SMT Breakout board fabrication: Results
- Lightuino Design Thoughts
- Arduino/AVR vs Cypress/PSOC
Wednesday, May 30, 2012
Friday, May 4, 2012
If you wish to make an apple pie from scratch you must first invent the universe
I recently googled this Carl Sagan quote using the search "if you wish to make an apple pie from scratch meaning" and was pretty dismayed that the top result not only misquotes him but comes from a yahoo Q&A site with the following "best" answer:
"Sagan was merely saying all the elements of an apple pie made from scratch [reduced to the lowest common denominator] are elemental to the universe and the universe had to be there before an apple pie could be made from them.
Hardly profound, though it's often quoted."
This result probably says more about the mental acuity of the analyzer then about what is being analyzed. Unfortunately answers are "closed" so nothing can be done about the yahoo page. So I shall give it a shot here and if you like my response please link/forward/facebook/google+ this posting so we can collectively knock Yahoo off of the top spot! So let me start over:
Quote
"If you wish to make an apple pie from scratch you must first invent the universe" Carl Sagan
You can hear a clip of him saying it straight here: http://www.youtube.com/watch?v=7s664NsLeFM, but you'll probably by a lot more entertained by this remix Symphony of Science: A Glorious Dawn
Literal Meaning
Just so we are all on the same page, the simplest level of interpretation is that the baker's fundamental ingredients are not fundamental at all. Apple trees produced the apples, wheat plants produced the flour in the crust, sugar cane produces the sugar. And of course this idea must be recursively applied. What made the chemicals and matter that these plants used? The big bang and stars made them out of more fundamental particles and energy. What made the energy the plants used to arrange the matter?
This is essentially as far as the original "answer" goes, But this is a trivial analysis.
Let's take a Bite out of this Pie
A great way to analyze a quote is to first make your analysis, and then modify the original quote with a different one that matches your analysis. Then compare the two and see what the original has that's missing from the new one & what the new one has that's missing from the original. So here's what Sagan might have said if he was as smart as the author of the "best" answer:
1. God made the universe, you just rearrange it.
Here I am clearly differing by introducing "God" into the quote. Its possible that Sagan's personal beliefs precluded this formulation (I don't know or care). But the important point is that the omission of "God" in his quote aims it directly at humanity, at us.
So let's leave God out of the quote:
2. You can't make stuff from scratch because you're always using other stuff that's already been made.
This formulation in the negative is limiting -- but is that what Sagan wanted to say? That you CANT make an apple pie from scratch? His formulation is in fact enabling; "if you wish to make...". He believes that someday we will truly make a pie from scratch and is seeking to define what that means. By formulating the sentence positively, the quote is infused with the hope and promise of humanity's potential.
So let's reformulate in the positive, but tweak the noun:
3. If you wish to make a particle accelerator from scratch you must first invent the universe
Who is the "you" in this quote? By choosing something as prosaic, as domestic as an apple pie he implies that the makers shall someday be, well, anybody and the making shall be an everyday occurrence. By choosing "particle accelerator" I pretty clearly point this at a small esoteric subgroup. He is also saying that the most common of thing are actually made up of complex ideas.
4. (and finally the misquotation) If you wish to make an apple pie from scratch you must first create the universe.
What's the difference between "creation" and "invention"? Well, a potter can "create" a clay pot (for example) by throwing clay on a wheel. But how can she "invent" one? She really cannot; its already been invented. But she can invent a new kind of pot. With the term "invent" Sagan is clearly suggesting not the mechanical act of creation but the mental act of invention. It is not enough for us to create the pie from fundamental particles; to truly make it "from scratch" we must invent (and therefore understand) the entire mathematical/informatic/computational underpinnings of the universe that either must have been before the first particle existed or that was forced to be by that particle's existence.
Actually, I'm still struggling with what he meant by invent. Since the universe already exists it cannot really be invented again. Was he suggesting the actual invention and subsequent creation of new universes by humankind? Or was he implying that inventing the universe would allow the controlled creation of space and matter within our existing framework? ...quantum mechanics predicts that particles and antiparticles are spontaneously created all the time...
Regardless, in this one sentence Sagan has left us with a large, tasty slice of his hopes and dreams for the future of science and humanity!
"Sagan was merely saying all the elements of an apple pie made from scratch [reduced to the lowest common denominator] are elemental to the universe and the universe had to be there before an apple pie could be made from them.
Hardly profound, though it's often quoted."
This result probably says more about the mental acuity of the analyzer then about what is being analyzed. Unfortunately answers are "closed" so nothing can be done about the yahoo page. So I shall give it a shot here and if you like my response please link/forward/facebook/google+ this posting so we can collectively knock Yahoo off of the top spot! So let me start over:
Quote
"If you wish to make an apple pie from scratch you must first invent the universe" Carl Sagan
You can hear a clip of him saying it straight here: http://www.youtube.com/watch?v=7s664NsLeFM, but you'll probably by a lot more entertained by this remix Symphony of Science: A Glorious Dawn
Literal Meaning
Just so we are all on the same page, the simplest level of interpretation is that the baker's fundamental ingredients are not fundamental at all. Apple trees produced the apples, wheat plants produced the flour in the crust, sugar cane produces the sugar. And of course this idea must be recursively applied. What made the chemicals and matter that these plants used? The big bang and stars made them out of more fundamental particles and energy. What made the energy the plants used to arrange the matter?
This is essentially as far as the original "answer" goes, But this is a trivial analysis.
Let's take a Bite out of this Pie
A great way to analyze a quote is to first make your analysis, and then modify the original quote with a different one that matches your analysis. Then compare the two and see what the original has that's missing from the new one & what the new one has that's missing from the original. So here's what Sagan might have said if he was as smart as the author of the "best" answer:
1. God made the universe, you just rearrange it.
Here I am clearly differing by introducing "God" into the quote. Its possible that Sagan's personal beliefs precluded this formulation (I don't know or care). But the important point is that the omission of "God" in his quote aims it directly at humanity, at us.
So let's leave God out of the quote:
2. You can't make stuff from scratch because you're always using other stuff that's already been made.
This formulation in the negative is limiting -- but is that what Sagan wanted to say? That you CANT make an apple pie from scratch? His formulation is in fact enabling; "if you wish to make...". He believes that someday we will truly make a pie from scratch and is seeking to define what that means. By formulating the sentence positively, the quote is infused with the hope and promise of humanity's potential.
So let's reformulate in the positive, but tweak the noun:
3. If you wish to make a particle accelerator from scratch you must first invent the universe
Who is the "you" in this quote? By choosing something as prosaic, as domestic as an apple pie he implies that the makers shall someday be, well, anybody and the making shall be an everyday occurrence. By choosing "particle accelerator" I pretty clearly point this at a small esoteric subgroup. He is also saying that the most common of thing are actually made up of complex ideas.
4. (and finally the misquotation) If you wish to make an apple pie from scratch you must first create the universe.
What's the difference between "creation" and "invention"? Well, a potter can "create" a clay pot (for example) by throwing clay on a wheel. But how can she "invent" one? She really cannot; its already been invented. But she can invent a new kind of pot. With the term "invent" Sagan is clearly suggesting not the mechanical act of creation but the mental act of invention. It is not enough for us to create the pie from fundamental particles; to truly make it "from scratch" we must invent (and therefore understand) the entire mathematical/informatic/computational underpinnings of the universe that either must have been before the first particle existed or that was forced to be by that particle's existence.
Actually, I'm still struggling with what he meant by invent. Since the universe already exists it cannot really be invented again. Was he suggesting the actual invention and subsequent creation of new universes by humankind? Or was he implying that inventing the universe would allow the controlled creation of space and matter within our existing framework? ...quantum mechanics predicts that particles and antiparticles are spontaneously created all the time...
Regardless, in this one sentence Sagan has left us with a large, tasty slice of his hopes and dreams for the future of science and humanity!
Friday, February 10, 2012
AVRez: A Simple Arduino API for other chips
The Arduino IS its software library. As I'm sure you've seen on the web, its pretty easy to breadboard an Arduino -- and to do it for about 10 bucks -- so Arduino is not really about the hardware. And the IDE is no Eclipse or Emacs. While this may actually be an advantage for complete beginners :-) it cannot be the IDE that sustains the Arduino's popularity.
The true secret to the Arduino is in its software library -- which AFAIK actually came from a project called Wiring. Here's a quick quiz to prove my point. What does this do:
Huh??? 99.9% of you will say (for .1% who get it right and don't get my drift, your next challenge is to write the equivalent of analogRead(11) without looking at the datasheet).
Well if you happen to have read the Atmel 328 processor spec, and pored through the avr-gcc io328xxx.h header file you'd know that this sets the bit corresponding to PB2 in the data direction register to high.
Make sense yet? No? Let me make it clearer.
pinMode(10, OUTPUT);
That's the Arduino/Wiring library version of the same code above. And pretty much anyone who understands that pins must be designated input or output can understand that line. You don't even have to be familiar with the Arduino/Wiring library! Its the magic of self-documenting code.
So when you go digging around in "AppNotes" and other example code, don't be fooled by the garbage you find. Its not "real" embedded programmers that directly use unreadable archana like "ADMUX |= 1; ASCSRA |= _BV(ADSC); while (ADSCRA&_BV(ADSC); result=ADCL | (((uint16_t)(ADCH))*256);" (that's how you read an analog pin PB2 by the way). Its actually just the "real bad" ones :-). Or institutions who have a vested interested in locking you into their platform.
In fact the only real confusion with "pinMode(10,OUTPUT)" is identifying what "10" means.
This is why I've decided to make a super simple library that I call "AVRez" that provides a similar API for other chips. You can look at it at here. This library is intended for use with chips that are not "Arduino" compatible so a few changes had to be made made, most especially in the pin out. However the basic API is instantly understandable to anyone whether they know the Arduino APIs or not.
With this library, for example, you can call "pinMode(pinB2, OUTPUT);". The only visual difference between this and the Arduino library is the constant "pinB2". Instead of making up separate names and numbers for each pin, I've chosen to use the pin names exactly as described in the datasheet. This will make code running on "barebones" processors more understandable.
Often performance is cited as the reason registers are directly bit-banged in "main" code. But this argument is better understood as simply a criticism of existing abstraction layers -- just because one abstraction layer is inefficient does not mean all must be!
In AVRez, for performance reasons a pin name actually expands to a complete list of all registers that are needed to manipulate the pin. Then the macros "pinMode", "digitialWrite", etc just use the registers that they needs and the rest get dropped by the C preprocessor. This allows the AVRez functions to be quite efficient; for example "pinMode" ultimately becomes just "DDRB |= _BV(PB2);" which is about the most efficient "C" implementation possible (but actually, technically not quite correct. It should be "cli(); DDRB |= _BV(PB2); sei();". Can you figure out why? In fact this issue is actually why the AVR processor has 2 special commands just for the job that are named "sbr" and "cbr". Compare this to the implementations you see in the Arduino core library...
But one issue with this approach is that the name "pinB2" does not have a type. So you can't store it into a variable like this:
int pin = pinB2;
But it would be quite possible to add a pin enumeration to the library and therefore fall back to something a bit less efficient. Then you could use something like:
int pin = pinIndex(pinB2); // Or maybe "= pinB2index;" is clearer...
pinMode(pin, OUTPUT);
One question for thought before I sign off: what is the MOST efficient way to translate a pin enumeration into code? What we see in the Arduino library ain't it! :-)
The true secret to the Arduino is in its software library -- which AFAIK actually came from a project called Wiring. Here's a quick quiz to prove my point. What does this do:
Huh??? 99.9% of you will say (for .1% who get it right and don't get my drift, your next challenge is to write the equivalent of analogRead(11) without looking at the datasheet).
Well if you happen to have read the Atmel 328 processor spec, and pored through the avr-gcc io328xxx.h header file you'd know that this sets the bit corresponding to PB2 in the data direction register to high.
Make sense yet? No? Let me make it clearer.
pinMode(10, OUTPUT);
That's the Arduino/Wiring library version of the same code above. And pretty much anyone who understands that pins must be designated input or output can understand that line. You don't even have to be familiar with the Arduino/Wiring library! Its the magic of self-documenting code.
So when you go digging around in "AppNotes" and other example code, don't be fooled by the garbage you find. Its not "real" embedded programmers that directly use unreadable archana like "ADMUX |= 1; ASCSRA |= _BV(ADSC); while (ADSCRA&_BV(ADSC); result=ADCL | (((uint16_t)(ADCH))*256);" (that's how you read an analog pin PB2 by the way). Its actually just the "real bad" ones :-). Or institutions who have a vested interested in locking you into their platform.
In fact the only real confusion with "pinMode(10,OUTPUT)" is identifying what "10" means.
This is why I've decided to make a super simple library that I call "AVRez" that provides a similar API for other chips. You can look at it at here. This library is intended for use with chips that are not "Arduino" compatible so a few changes had to be made made, most especially in the pin out. However the basic API is instantly understandable to anyone whether they know the Arduino APIs or not.
With this library, for example, you can call "pinMode(pinB2, OUTPUT);". The only visual difference between this and the Arduino library is the constant "pinB2". Instead of making up separate names and numbers for each pin, I've chosen to use the pin names exactly as described in the datasheet. This will make code running on "barebones" processors more understandable.
Often performance is cited as the reason registers are directly bit-banged in "main" code. But this argument is better understood as simply a criticism of existing abstraction layers -- just because one abstraction layer is inefficient does not mean all must be!
In AVRez, for performance reasons a pin name actually expands to a complete list of all registers that are needed to manipulate the pin. Then the macros "pinMode", "digitialWrite", etc just use the registers that they needs and the rest get dropped by the C preprocessor. This allows the AVRez functions to be quite efficient; for example "pinMode" ultimately becomes just "DDRB |= _BV(PB2);" which is about the most efficient "C" implementation possible (but actually, technically not quite correct. It should be "cli(); DDRB |= _BV(PB2); sei();". Can you figure out why? In fact this issue is actually why the AVR processor has 2 special commands just for the job that are named "sbr" and "cbr". Compare this to the implementations you see in the Arduino core library...
But one issue with this approach is that the name "pinB2" does not have a type. So you can't store it into a variable like this:
int pin = pinB2;
But it would be quite possible to add a pin enumeration to the library and therefore fall back to something a bit less efficient. Then you could use something like:
int pin = pinIndex(pinB2); // Or maybe "= pinB2index;" is clearer...
pinMode(pin, OUTPUT);
One question for thought before I sign off: what is the MOST efficient way to translate a pin enumeration into code? What we see in the Arduino library ain't it! :-)
Tuesday, January 31, 2012
Ubuntu 11.10/Gnome 3.0: Surviving the transition!
I've had significant issues with the new Ubuntu GUI and Gnome 3.0; ranging from irritations (difficulty to create launchers) to bugs (mouse stops responding). If you are googling around I'm sure you've seen the near universal cry of dismay. If there is one message to send Canonical (if any of you ever read this posting) it would be that while its a great idea to "dumb down" the interface so a single GUI will work between your desktop and touch machines, you can't disable the advantages available through a mouse interface!
Anyway, here is what I did to make it workable. These are mostly culled from various web sources; they are not my original work.
Friday, January 27, 2012
Transdescending Arduino: Going cheap and small
The Arduino is great; a microController you can actually do something with for 30 bucks! Ok, but your train layout needs 5 of them ($150), your home sensor network needs 10 + $40 xbee cards (clocking in at $700!). Or the mere fact that your want to KEEP your projects around means that you get nailed for 30 bucks over and over again.
But wait a second... the AVR328p is a 3 dollar chip! And the AVR ATMega48 (pin compatible but with a LOT less space) is 2 bucks (for 10)! And if your requirements are extremely minimal, there's the ATTINY13 which comes in as little as 60 cents -- but in an inconvenient package (you'll be better off spending another 4 dimes and getting one for 1 buck).
Let's hack up a bunch of these chips so next project we'll have lots of choices...
Note: If you've figured out the hardware part and just need some software help check out this posting: AVRez -- "arduino" style APIs for other chips
But wait a second... the AVR328p is a 3 dollar chip! And the AVR ATMega48 (pin compatible but with a LOT less space) is 2 bucks (for 10)! And if your requirements are extremely minimal, there's the ATTINY13 which comes in as little as 60 cents -- but in an inconvenient package (you'll be better off spending another 4 dimes and getting one for 1 buck).
Let's hack up a bunch of these chips so next project we'll have lots of choices...
Note: If you've figured out the hardware part and just need some software help check out this posting: AVRez -- "arduino" style APIs for other chips
Friday, January 20, 2012
DIY PCB SMT Breakout board fabrication: Results
In the last posting I described how I made a few PCBs to act as SMT breakouts. I've discovered that this seems to be a pretty ideal job for DIY PCB work! To mount thru-hole stuff, you need the hole -- and that means hand drilling... but a small breakout board can be done on a single side, and its possible to use .1" Right Angle headers soldered onto an oval thru-hole pad so you don't even need to drill the hole for the breakout header.
In my last posting I finished with the circuit board ironed onto the blank PCB. It turns out that the final steps are quite easy. First you get some etchant. I used ferric chloride from Radio Shack, but I wish I had used muriatic acid and hydrogen peroxide as it seems slightly better for the environment. I poured the etchant in a leftover food container (now forever dedicated to PCB etching) and left the boards in for about 30 minutes. I used a twisted wire hanger to keep my fingers out of the etchant:
Then rinse the board in lots of water, and leave the tap running to dilute any drips of etchant solution that go down your drain. When you're done, put the top on the container (make sure it seals!) and store for next time.
To remove the laser printer toner, I tried a few paint removers, liquid sanders, etc. Nothing really worked. It turns out that Acetone (nail polish remover) is required. Its available in the paint section of hardware stores, and is absolutely amazing at the job. 2 swipes with a rag daubed in Acetone cleans the toner like wiping milk off a table!
Next I soldered the parts on to the PCBs using a toaster oven. I was concerned that the lack of a solder mask might make the solder bridge across PCB pads because its impossible to keep the solder paste onto pads. In fact, I don't even bother, I just paint a thin line down across all the pads in a row (see my earlier post on DIY SMT soldering techniques here). But in fact, the solder balled up nicely as you can see here:
These are tiny SOIC-8 and SOT-23/5 parts. I left the chip off the rightmost SOT-23/5 to see how well the solder wicked onto the pads. Before putting it in the oven, the space between all the pads was completely covered with solder paste -- the wicking works great!
I cut some of these boards with a hobbiest bandsaw, like you can get for $200 at Home Depot. But its even easier to cut them by scoring the front an back with a ruler and then breaking them against the edge of table (preferably metal). Place something hard (like a metal or hardwood block) on top, grab the protruding board with pliers and then crack it by rotating the pliers downwards quickly.
One surprise was how fine a pitch may be possible. I had originally "designed" this board for professional fabrication and I accidentally left some tiny lettering on the board. Amazingly, it transferred to the PCB perfectly well! Here is a close up:
As you can see, by the ballpoint pen I put in for scale, the height of these letters is less then one millimeter! I will need to go back to the file to check, but I'll bet that the line width is just a few mils (thousandths of an inch) wide. Many professional PCB houses won't do less then 8mils! Of course, they require repeatability across hundreds of large boards -- my goal is to get a single small breakout board out of a panel with a half dozen attempts.
So basically, if the transfer works without smudging or distortion you can get amazingly fine detail. And from my limited experience it does tend to do so reliably across portions of the board that can be 2 square inches in size. This makes me believe that it may be possible to home fabricate chip-scale BGA breakout boards -- at least for small BGA packages. I have not discovered anyone who has tried it yet; so I think that will be my next experiment (as soon as I find a "fun" BGA chip)!
EDIT: Here's a photo of the SOIC8 installed on a PCB. I think that its better to put all the pins in a single row, rather then the DIP configuration because that gives you the other side of the breakout board to use to make your circuit!
Also note that no drilling is needed! Get right angle breakaway headers and then solder them to the (undrilled) thru hole pad.
EDIT 2: Here is a photo of a SOT-363 chip with a 2 mil circle indicating pin 1. To get an idea of the size, the circle is indicated by the lead of a standard 1/4 watt resistor. As you can see the 2 mil line width was etched perfectly!
In my last posting I finished with the circuit board ironed onto the blank PCB. It turns out that the final steps are quite easy. First you get some etchant. I used ferric chloride from Radio Shack, but I wish I had used muriatic acid and hydrogen peroxide as it seems slightly better for the environment. I poured the etchant in a leftover food container (now forever dedicated to PCB etching) and left the boards in for about 30 minutes. I used a twisted wire hanger to keep my fingers out of the etchant:
Then rinse the board in lots of water, and leave the tap running to dilute any drips of etchant solution that go down your drain. When you're done, put the top on the container (make sure it seals!) and store for next time.
To remove the laser printer toner, I tried a few paint removers, liquid sanders, etc. Nothing really worked. It turns out that Acetone (nail polish remover) is required. Its available in the paint section of hardware stores, and is absolutely amazing at the job. 2 swipes with a rag daubed in Acetone cleans the toner like wiping milk off a table!
Next I soldered the parts on to the PCBs using a toaster oven. I was concerned that the lack of a solder mask might make the solder bridge across PCB pads because its impossible to keep the solder paste onto pads. In fact, I don't even bother, I just paint a thin line down across all the pads in a row (see my earlier post on DIY SMT soldering techniques here). But in fact, the solder balled up nicely as you can see here:
These are tiny SOIC-8 and SOT-23/5 parts. I left the chip off the rightmost SOT-23/5 to see how well the solder wicked onto the pads. Before putting it in the oven, the space between all the pads was completely covered with solder paste -- the wicking works great!
I cut some of these boards with a hobbiest bandsaw, like you can get for $200 at Home Depot. But its even easier to cut them by scoring the front an back with a ruler and then breaking them against the edge of table (preferably metal). Place something hard (like a metal or hardwood block) on top, grab the protruding board with pliers and then crack it by rotating the pliers downwards quickly.
One surprise was how fine a pitch may be possible. I had originally "designed" this board for professional fabrication and I accidentally left some tiny lettering on the board. Amazingly, it transferred to the PCB perfectly well! Here is a close up:
As you can see, by the ballpoint pen I put in for scale, the height of these letters is less then one millimeter! I will need to go back to the file to check, but I'll bet that the line width is just a few mils (thousandths of an inch) wide. Many professional PCB houses won't do less then 8mils! Of course, they require repeatability across hundreds of large boards -- my goal is to get a single small breakout board out of a panel with a half dozen attempts.
So basically, if the transfer works without smudging or distortion you can get amazingly fine detail. And from my limited experience it does tend to do so reliably across portions of the board that can be 2 square inches in size. This makes me believe that it may be possible to home fabricate chip-scale BGA breakout boards -- at least for small BGA packages. I have not discovered anyone who has tried it yet; so I think that will be my next experiment (as soon as I find a "fun" BGA chip)!
EDIT: Here's a photo of the SOIC8 installed on a PCB. I think that its better to put all the pins in a single row, rather then the DIP configuration because that gives you the other side of the breakout board to use to make your circuit!
Also note that no drilling is needed! Get right angle breakaway headers and then solder them to the (undrilled) thru hole pad.
EDIT 2: Here is a photo of a SOT-363 chip with a 2 mil circle indicating pin 1. To get an idea of the size, the circle is indicated by the lead of a standard 1/4 watt resistor. As you can see the 2 mil line width was etched perfectly!
Friday, January 13, 2012
DIY PCB fabrication; Breakout Board Toner Transfer Experiments
Using modern components in PCB circuit board design essentially requires the use of small surface mount packages. Testing these components can be costly and time consuming if you need to have a break-out-board professionally fabricated for every component. It is possible to hand-solder extremely thin magnet wire to individual leads of a SMT package but that is a very painstaking process.
It would be much easier if individual PCBs could be hand-fabricated for the task. I dug around on the web and DIY PCB fabrication for very small parts seems quite tricky; most people use home PCBs to make larger circuits out of thru-hole parts.
However, even if multi-chip SMT designs are not feasible, it would be very valuable to be able to rapidly fabricate single chip breakout boards for SMT parts (for noobies: a breakout board is a PCB that simply brings all the pins in a SMT chip to a male header that can be plugged into a solderless breadboard). Especially small parts; if you are putting a TQFP-144 on you board there are places where you can buy breakouts. And there are fewer footprints so you could build up a "library" of breakouts. But there are tons of different packages for components ranging from 2 to 32 pins!
Making these small-pin count PCBs might be feasible (where large SMT designs are not) for several reasons. First, the PCB will be quite small, allowing you to panel multiples "tries" onto a single DIY board. You only need one success! Second, the routing will be pretty short and simple. If the pins are placed on either side of the chip the routes will be short and on a single side (so you can try the same circuit on both sides!). Finally, I think that right angle .1" headers could be used in place of straight pins, so the final board would not need to be drilled. This will save a lot of time (and painstaking work).
Here are my first attempts (ever) to use the toner transfer method to put a mask on copper PCBs. I panelized 6 SOIC-8 and 6 SOT-23/5 breakout boards onto a space about 2x3 inches:
And the back side attempts:
The basic methodology (for people who are reading this as an instructable) is to:
1. Remove all layers of your PCB except routes, pads and vias. Export it as an image (monochrome, 600 dpi). Load it up in a graphics editor (gimp), reverse the color, and horizontally mirror it.
2. Next, use a laser printer to print it onto some kind of paper. You want a paper with unique, generally undesirable properties; essentially the toner should just barely stick and it should dissolve readily in water. Four types are commonly suggested:
A) glossy paper ripped from a cheap magazine/catalog
B) glossy photo paper
C) sticker backing paper (pull the stickers off and print on the shiny side)
D) speciality PCB toner transfer paper.
3. "clean" a blank PCB with steel wool, and then iron the toner on by placing the iron at its highest setting on the paper (which is on the PCB) for about a minute. You can't move the paper relative to the PCB so some masking tape on the corners might help. Also don't push down hard, and don't move the iron around much.
4. Soak the PCB in water for about 5 minutes and then rub the paper off. You can rub quite hard; if it toner comes off then it did not transfer.
The PCB on the upper left of image 1 was made with glossy photo paper. This paper essentially did not work for me; it would glue itself to the iron and then separate from the PCB or pick it up as well. The toner was still melted at this point so most of it stayed with the paper.
The upper right image 1 board shows what happens when you push down too hard. Pressure on the melted toner caused it to spread out. So don't do that!! :-) The bottom left of image 1 was ironed on for several minutes. It got so hot it changed the copper color -- additionally the paper was extremely hard to remove. Oops! The last photo on image 1 was again done with glossy photo paper. The paper still lifted off with the iron but amazingly it left a perfect transfer in the middle! Unfortunately I doubt its repeatable.
I left board on photo 2 clean to show how the PCB should look after it has been rubbed by the steel wool. The other 3 boards on the bottom image show transfers with the sticker-backing paper with ironing times of 30seconds, 1 minute, and 1:30. I'm sure you can see which is which since they show more toner sticking. In fact, the last image has perfect transfers of 9 out of the 12 circuits! The only miss transfers are on the top of the PCB. Clearly I did not get that portion hot enough (in fact, I think that it may have been under the steam holes of the iron). Removal of the paper was pretty quick under hot water; about 5 minutes (so clearly the boards were not under the iron for too long). But the paper did not "pill" up like other web postings suggest; it mostly peeled off. After ironing, the paper it was a little browned in spots but not significantly.
Like any other craft there is clearly a bit of skill and practice required. And some experimentation is required to become familiar with your particular tools. However, so far this looks like a pretty feasible method for breakout board fabrication. In the next installment I will attempt to etch the boards and solder the parts on!
It would be much easier if individual PCBs could be hand-fabricated for the task. I dug around on the web and DIY PCB fabrication for very small parts seems quite tricky; most people use home PCBs to make larger circuits out of thru-hole parts.
However, even if multi-chip SMT designs are not feasible, it would be very valuable to be able to rapidly fabricate single chip breakout boards for SMT parts (for noobies: a breakout board is a PCB that simply brings all the pins in a SMT chip to a male header that can be plugged into a solderless breadboard). Especially small parts; if you are putting a TQFP-144 on you board there are places where you can buy breakouts. And there are fewer footprints so you could build up a "library" of breakouts. But there are tons of different packages for components ranging from 2 to 32 pins!
Making these small-pin count PCBs might be feasible (where large SMT designs are not) for several reasons. First, the PCB will be quite small, allowing you to panel multiples "tries" onto a single DIY board. You only need one success! Second, the routing will be pretty short and simple. If the pins are placed on either side of the chip the routes will be short and on a single side (so you can try the same circuit on both sides!). Finally, I think that right angle .1" headers could be used in place of straight pins, so the final board would not need to be drilled. This will save a lot of time (and painstaking work).
Here are my first attempts (ever) to use the toner transfer method to put a mask on copper PCBs. I panelized 6 SOIC-8 and 6 SOT-23/5 breakout boards onto a space about 2x3 inches:
And the back side attempts:
The basic methodology (for people who are reading this as an instructable) is to:
1. Remove all layers of your PCB except routes, pads and vias. Export it as an image (monochrome, 600 dpi). Load it up in a graphics editor (gimp), reverse the color, and horizontally mirror it.
2. Next, use a laser printer to print it onto some kind of paper. You want a paper with unique, generally undesirable properties; essentially the toner should just barely stick and it should dissolve readily in water. Four types are commonly suggested:
A) glossy paper ripped from a cheap magazine/catalog
B) glossy photo paper
C) sticker backing paper (pull the stickers off and print on the shiny side)
D) speciality PCB toner transfer paper.
3. "clean" a blank PCB with steel wool, and then iron the toner on by placing the iron at its highest setting on the paper (which is on the PCB) for about a minute. You can't move the paper relative to the PCB so some masking tape on the corners might help. Also don't push down hard, and don't move the iron around much.
4. Soak the PCB in water for about 5 minutes and then rub the paper off. You can rub quite hard; if it toner comes off then it did not transfer.
The PCB on the upper left of image 1 was made with glossy photo paper. This paper essentially did not work for me; it would glue itself to the iron and then separate from the PCB or pick it up as well. The toner was still melted at this point so most of it stayed with the paper.
The upper right image 1 board shows what happens when you push down too hard. Pressure on the melted toner caused it to spread out. So don't do that!! :-) The bottom left of image 1 was ironed on for several minutes. It got so hot it changed the copper color -- additionally the paper was extremely hard to remove. Oops! The last photo on image 1 was again done with glossy photo paper. The paper still lifted off with the iron but amazingly it left a perfect transfer in the middle! Unfortunately I doubt its repeatable.
I left board on photo 2 clean to show how the PCB should look after it has been rubbed by the steel wool. The other 3 boards on the bottom image show transfers with the sticker-backing paper with ironing times of 30seconds, 1 minute, and 1:30. I'm sure you can see which is which since they show more toner sticking. In fact, the last image has perfect transfers of 9 out of the 12 circuits! The only miss transfers are on the top of the PCB. Clearly I did not get that portion hot enough (in fact, I think that it may have been under the steam holes of the iron). Removal of the paper was pretty quick under hot water; about 5 minutes (so clearly the boards were not under the iron for too long). But the paper did not "pill" up like other web postings suggest; it mostly peeled off. After ironing, the paper it was a little browned in spots but not significantly.
Like any other craft there is clearly a bit of skill and practice required. And some experimentation is required to become familiar with your particular tools. However, so far this looks like a pretty feasible method for breakout board fabrication. In the next installment I will attempt to etch the boards and solder the parts on!
Tuesday, January 10, 2012
Ubuntu 11.10 64bit CadSoft Eagle 6.0.0 installation pain
I think Eagle 6 was rushed to market :-). It resists installation on the most popular Linux distros, and when you do finally get it working it pops up with an "I'm sorry, there's a nasty bug" dialog. But Kudos to Cadsoft for admitting it!!!
Here are my notes on the installation. I think I might be missing a step or two so if you follow these and run into issues, please post a comment!!!
These instructions should also mostly work in 32 bit Linux distros, but you won't need to install as much (remove the packages with "i386", or "32" in their names).
Step 1: Prep Ubuntu for 32 bit compilation
Next, get and install libpng14 from source:
http://sourceforge.net/projects/libpng/files/libpng14/1.4.8/libpng-1.4.8.tar.xz/download
32 bit distros should remove "CFLAGS=-m32" and just use this line instead:
./configure --prefix=/
[Troubleshooting] If you get the error: "configure: error: C compiler cannot create executables" check the config.log file. If the problem is: "/usr/bin/ld: cannot find crt1.o: No such file or directory" then you did not install g++-multilib gcc-multilib.
If you get: "configure: error: zlib not installed" you did not install lib32z1-dev
Now install Eagle:
chmod a+x eagle-lin*
sudo ./eagle-lin*
Good Luck and keep building OSHW!!!
Here are my notes on the installation. I think I might be missing a step or two so if you follow these and run into issues, please post a comment!!!
These instructions should also mostly work in 32 bit Linux distros, but you won't need to install as much (remove the packages with "i386", or "32" in their names).
Step 1: Prep Ubuntu for 32 bit compilation
sudo apt-get install build-essential lib32z1-dev g++-multilib gcc-multilib ia32-libs libssl1.0.0 libssl1.0.0:i386 libjpeg8 libjpeg8:i386
Next, get and install libpng14 from source:
http://sourceforge.net/projects/libpng/files/libpng14/1.4.8/libpng-1.4.8.tar.xz/download
tar xvf libpng-1.4.8* cd libpng-* ./configure CFLAGS=-m32 --prefix=/ make check sudo make install
32 bit distros should remove "CFLAGS=-m32" and just use this line instead:
./configure --prefix=/
[Troubleshooting] If you get the error: "configure: error: C compiler cannot create executables" check the config.log file. If the problem is: "/usr/bin/ld: cannot find crt1.o: No such file or directory" then you did not install g++-multilib gcc-multilib.
If you get: "configure: error: zlib not installed" you did not install lib32z1-dev
Now install Eagle:
chmod a+x eagle-lin*
sudo ./eagle-lin*
Good Luck and keep building OSHW!!!
Wednesday, November 2, 2011
Open Hardware Journal
Bruce Perens (who did Busybox and Debian as well as defining "Open Source") has created an Open Hardware Journal (http://openhardware.org/journal/). Check out the first issue, I've got two articles in it! Ok ok, probably he needed more submissions which is why my stuff made the cut :-). But hey I'll take it!
The first article "An Open Hardware Platform for USB Firmware Updates and
General USB Development" is about the USB interface on the Lightuino. I chose that topic because this interface is a cheap and tiny way to put USB in many of your projects. The interface will talk SPI to your uP or some SPI chip, or I2C (although I did not use that in the Lightuino). And it will do serial (USB CDC ACM if you need the formal acronym) or emulate an input device (USB HID). Read the article for more info, and check out my code on github here: https://github.com/gandrewstone/toastedCypressUsb
My second article "A Return To Open Devices" is about my ideas around the philosophy and driving forces behind the open hardware movement. I'm sure the people who come to open hardware do it for many different reasons; this is simply my perspective.
The first article "An Open Hardware Platform for USB Firmware Updates and
General USB Development" is about the USB interface on the Lightuino. I chose that topic because this interface is a cheap and tiny way to put USB in many of your projects. The interface will talk SPI to your uP or some SPI chip, or I2C (although I did not use that in the Lightuino). And it will do serial (USB CDC ACM if you need the formal acronym) or emulate an input device (USB HID). Read the article for more info, and check out my code on github here: https://github.com/gandrewstone/toastedCypressUsb
My second article "A Return To Open Devices" is about my ideas around the philosophy and driving forces behind the open hardware movement. I'm sure the people who come to open hardware do it for many different reasons; this is simply my perspective.
Friday, September 9, 2011
DIY Surface Mount Workshop
A few days ago I held a workshop on do-it-yourself (aka cheap) surface mount electronics techniques at a Boston artspace/hackerspace called sprout & co (http://thesprouts.org/). This was organized through the Boston Arduino meetup group. Participants got to mount a tiny QFN-24 chip (a PCA9555 io-expander) onto a QFN breakout board and then we tested them by connecting them up to an Arduino. There was one bad chip; but once that was replaced everybody's boards worked!
Here are my notes from the workshop. If you did not attend, these notes are a good tutorial on how to get started cheaply! Also, if you'd like some of the QFN breakout boards, please contact me and I will sell you a few.
Surface Mount Tools (homemade/modified):
Toaster Oven:
Got mine from the dump. Keep it simple; you don't
need to mod it with fancy temperature feedback like some web posts suggest.
$30 used heat
gun (ebay) with aluminum foil to narrow and speed the air jet. Secure the aluminum foil by wrapping steel wire around the nozzle. Shape the hole in the end by forming it around a pen with your fingers. This tool is indispensable for removing and replacing chips (rework), and works great!
Cheap plastic Mechanical Pencil:
Pencil lead solder paste onto pins;
eraser dabs off too much.
PCB Vice:
You can use any clamp like this. You can probably get one for less then $10 if you look around. Just drill a hole in your desk slightly smaller then the clamp bar and stick it in upside down.
Here it is holding the boards we made, with my breadboard-to-IDE-or-RJ-45 connector in the background.
Here it is holding the boards we made, with my breadboard-to-IDE-or-RJ-45 connector in the background.
But once you do this fairly often you'll want to upgrade to a Panavise.
Soldering Iron:
You CAN use a standard cheapo wide tip soldering iron for SMT rework -- even though you can't touch just a single pin, it is sufficient to heat a single pin.
However, knockoffs of the "Hakko 936" soldering iron are pretty cheap at $50; check Amazon or ebay. And they are all you'll ever need...
Tweezers:
You use these to hand "pick-and-place" chips. Buy them from a drugstore. But don't buy the cheapest pair you can find. Buy a set that looks totally overkill for plucking nose hairs :-) -- like they were milled out of a block of metal.
Magnifying glass/bright light:
You may need these to peek at the board as it is cooking, and for rework. I'm sure you can do it on the cheap. I have a "helping hands" for the glass:
Available on ebay for 6 bucks. And the clips are actually great for other soldering jobs, like joining 2 wires. For the bright light, any portable (plug in) work light will work fine (try home depot). Once you do a lot of work you may want a "swing arm magnifying glass lamp":
Supplies:
Solder wire:
Get thin rosin core solder
Solder Paste:
Solder paste are tiny balls of solder in a flux mix that is viscous like toothpaste. It can be very expensive and require refrigeration. Don't buy that. Buy this Lodestar paste from DealExtreme. It does not require refrigeration, however, as a hobbyist you should refrigerate it so it will last you forever.
Flux:
Flux is a substance that cleans your PCB and lets the solder flow better. It is also available at DealExtreme. They often mis-name it "paste" but you'll know it is flux only because it won't be grey. Get "no-clean" or "neutral PH" (its almost all like that now).
Solder Remover Braid:
This braid is necessary to remove excess solder when doing fine SMT work. Solder suckers don't work!
Step 1:
Use an oven to solder a QFN-24 part onto a breakout board.
Mix a TINY bit of solder paste and flux to about a 60/40 mix. You don't need much. Put any extra back into the container since it contains lead so its good to generate as little hazardous waste as possible...
Too much paste and the solder will not wick onto the pads (it will stay on the non-metal parts of the PCB or create bridges between pads -- "pads" are the metal parts of the PCB that you are trying to solder the chip's wires "pins" to)
Too much flux and the pins won't be soldered.
Apply with your mechanical pencil (click out the lead). For
tiny QFN leads, just draw your pencil straight across all the leads. That is, cover the entire surface including between the
leads. This is important so let me emphasize: Don't try to keep the paste out of the 6mil space between the leads! That is impossible & when heated the flux will cause the paste to flow to the pads anyway.
But if there is a center square pad, use the pencil to
draw around that pad to clean any paste that would bridge the center pad to a lead (it is
very hard to fix that issue).
You need to apply a thin layer. You should be able to see the shape of the pads under the paste, but they should be obscured. But if the paste goes on clear, with just a few "dirty" spots you have too much flux in your mix.
This photo shows 6 boards with solder paste on them -- this wasn't part of the workshop, I just grabbed this photo from my archives. Perhaps the paste is on a little thick... but as you can see, no attempt was made to keep the paste away from the spaces between the pads.
Next, put the chip on with tweezers. Positioning is not critical; you can be off by a half-pin in any direction. When hot, the chip will actually float on the flux layer and surface tension will actually cause the chip to be sucked onto the pads! But if you are off by more then a half-pin, the chip might be sucked onto the wrong set of pads.
Now bake your board. You need to bake the board in a particular fashion, but its not rocket science.
Here is an example provided by Kester paste. It works fine for any paste:

Next, you
bring the heat up to a max of 220-240C rapidly to melt all the solder
paste. Excessive exposure to this heat can harm the chips or melt
plastic parts so you want to keep this brief. At this point, use your
magnifying glass and a bright light to watch the paste on the board. It
will go from grey to bright shiny silver when melted (bubbling is just the flux moving around). Wait 10 more seconds after you see no more grey to make sure solder you can't see also melts. Then turn the oven off.
Now you have a choice. You can either wait with the oven door closed so the oven cools down slowly (as shown on the heat profile). Cooling slowly will mean there are fewer mechanical stresses on the board.
Or if you see any problems, you can open the oven door, pull out the tray and
reposition “tombstone” (sticking up) resistors and caps. Also if a chip is out of alignment (off by one pin for example), you can “tap”
the chip to make it position itself! When doing multiple bigger boards, you'll often find a few issues.
I'd imagine that while this cools the board faster, it is probably still less stressful then heating a portion of the board with your "air pencil". That is the only other way to reposition chips.
Debugging
Now that your board is baked and cooled, you need to visually inspect it. Look for bridges (2 pins connected) and unsoldered pins. A bridge will look more shiny then the other pins since it is a bigger solder blob. Unsoldered pins will look darker.
Unsoldered:
Apply a tiny bit of paste to solder pins. Heat the pin (and perhaps nearby pins) with an iron to melt the solder. Often you'll have added too much paste, so now check for bridges.
Bridges:
Use flux to cause the bridge to flow onto nearby pads/pins. This only works if the bridge is not caused by too much solder.
Use copper solder remover wire (braid) to
remove solder. I guess this is often misused. This is how you do it:
Touch braid to you can of flux to get a tiny bit on it)
Put the braid onto the bridge part so it complete covers it (and probably a bunch more pins).
Heat the braid by using the iron to press
it into the bridge where you want to remove the solder.
The braid won't work if its not hot!!! So heat it and cause its heat to melt the solder.
If the braid is at all silver, clip it and throw that part away; it has already sucked up solder.
Speed solder headers
Next we need to solder long headers onto the board. There is a fast technique to do a row of pins that I will show. Eventually you should be able to do about a pin per second or two.
First, clip/break the pin header so it contains the right number of pins.
Next put the headers in the solderless breadboard; and put the PCB on top. This gets them aligned correctly. Use the PCB to seat them into the breadboard. This will keep the board steady as you solder it.
Now its often good to solder the ends to make sure the PCB stays firmly seated against the pin header, but as you get better you can skip this step.
Now use the speed solder technique to do the rest. Here's a video:
Here I am doing pins on both sides of the iron, so heating 6 pins simultaneously. But you should stick with one side for now.
Use an overhand grip on the iron so it can be placed flush along the pins.
Heat 3 pins simultaneously.
Preheat pin -- using iron tip
Middle pin -- focus on soldering it
3rd pin -- continue to heat to make a good solder joint
I noticed most people using not nearly enough solder. Feed the solder so fast that there is a large constant blob of solder on the iron. This solder blob is essential to transfer heat to the pins. As you push your iron across the pins it will actually clean up this excess solder (if not, your iron is too cold, or you aren't using rosin core solder). Actually you may end up with a few bridges, but those are easy (and quick) to fix once the job is done. Just hold a "dry" iron against the bridge and it should grab the excess. And look for any holes you missed; as a beginner you'll have one or two!
Testing: Hook up the breakout board
Read the spec to hook up the board. Really. This is a great exercise and very important to get correct. Because if you are trying a new PCB, new software, and a new chip you want to make sure you get something right! :-) But ok, Ryan Feeney was kind enough to help you out with this image:
In this image, GND are the blue rows on both sides and 5v are the red ones (connect them to GND and 5v on your Arduino).
One other trick; if you don't have a handy 3.3v power supply, you can use a red LED to reduce 5v to 3.3v. This will work up to about 20mA; beyond that your LED will burn out so use multiples!
Testing: The sample sketch
The sketch I used is located at: http://i2cdevices.svn.sourceforge.net/viewvc/i2cdevices/latest/ioexpander/pca9555/pca9555.pde?revision=1
Someday I might actually put other i2c devices in there too! :-)
It should blink the LED.
Hot air rework exercise
Some of you got to do or see this, because we had a dead chip.
In this exercise we'll use the hot air "pencil" to remove a chip and then replace it with a new one.
First, use aluminum foil and metal boxes to cover and protect other chips (and plastic headers). Well, there is nothing really to protect in the breakout board except for the plastic vise jaws -- but for a "real" board you'll need this.
Heat the chip with slow motions of the heat gun. When the solder on the edges goes shiny, pluck/knock it off with tweezers.
If there is a lot of solder on the pads then clean it with flux and solder remover. Put a little more paste on the pads.
Touch the new chip in the flux can to just get a TINY bit of flux on its pads
Place the new chip right near, but not on, the pads. This will cause the chip to heat up with the pads. The chip's leads have to be hot enough to melt the solder or the solder won't stick to it! Its the SMT equivalent of a "cold" solder joint.
Reheat with the hot air "pencil". When the solder melts (it goes shiny) it should wick to the pads so there is no bridges. If there are bridges you have too much solder or not enough flux. When it wicks correctly, tap the chip with tweezers to move it into place. You should see it "snap" or "pop" into place as the surface tension of each pad/lead pulls the chip. Heat for maybe 10 more seconds to make sure all the chip's leads were hot enough and then you are done!
Thanks! Please go forth and build open source hardware!!
Subscribe to:
Posts (Atom)