Archive for September, 2010
In electronics as in everyting else, the more you mess up the more you learn (hopefully). With that in mind I figured, "what the hell, let's give it a go" and I sent an order to Micron 20 .
It is a pretty simple PCB for an ATmega168 (or -328) with voltage regulator, pull-up resistor for the reset pin, a crystal with associated load caps and a 3mm led with resistor.
The order specifications are as follows:
- 6.9 x 2.8mm (2700 x 1100 mils)
- Solder mask (blue) on both sides
- Silkscreen (yellow) on top
Minimum PCB size is 0.7 dm2 (square decimeters?! Why would anyone ever use square decimeters as a unit?) so I will received 4 boards.
I chose to have the boards done in 7 work days (you can choose between 24 hours to 15 days) and airmail delivery and the grand total was €66.
Now, we'll see what kind of mistakes I have made :)
It looks like this:
So far I've only been concerned with designing circuit schematics. That is, an illustration of how the various components are connected to each other but which not necessarily have any correspondance with how the actual, physical components are placed on a board. I have been using the free version of CadSoft's EAGLE which is very capable and has all the features I will need for the forseeable future. And it runs on Mac OS X (as well as Windows and Linux). It does have kind of a weird user interface but you get used to that.
EAGLE has both a schematic editor and a PCB layout editor and until recently I had never spent more than five minutes looking at the PCB layout editor so I had some learning to do. This tutorial from SparkFun and this PDF helped a lot. As did this list of layers from PCB-Pool.
Three more things I learned:
- Choose the right components when making the schematic - or later.
It quickly turned out that I had to go back and spend some more time in the schematic editor. Because up until now I just chose components without much regard for the "footprint" – i.e. size and shape. I didn't care exactly what resistor I was using as long as it had the right symbol and I could specify name and value.
But for PCB layout you really need to know whether there are 0.1 or 0.2 inches between the capacitor leads, for example.
So choose the right components when you make the schematic OR just drop in some components and then go back and change them when you starting working on the PCB layout.
Yes, I know that most engineer types out there will yell stuff about always choosing the correct component to begin with. But honestly, when I make the schematic I have no idea whether a given resistor will be 10 mm or 8 mm long. And I don't want to spend time thinking about at that time. So there!
- Make your own or adjust the packages
For some components I needed to change some details on the footprint. For the polarized capacitor I would like a square pad for the positive lead and for the 7805 volt reg I wanted to remove a lot of unnecessary silk screen print. This tutorial from SparkFun is helpful (http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=110).
As is knowing how to copy everything from an existing package. Here's how:
1) to identify the package and the library it's part of, choose the info tool and click on the part
2) open the library and edit the existing package
3) click the layers tool and show all layers
4) choose the group tool and select everything
5) click the cut tool (the scissor) – yes: cut. It will actually copy and not cut.
6) open or create the new package
7) click the paste tool (next to the cut tool)
And then you can add or remove stuff and save the package. Then edit the part, add a new package and connect pins and pads and then replace the old part with the new variant in the schematic editor (And choose Library -> Update all).
- Print and check
Print out a copy of the board in actual size by choosing File -> Print… and setting the scale factor to 1.
Then place all the components on the paper (push the pins through if possible) and make sure everything fits and the footprints are correct. I caught several mistakes by doing this...
Having made a couple of prototype-like projects I thought it would be nice to put the projects on proper made-for-the-purpose circuit boards. So far I've been using these boards and they have worked very well: the size is perfect for an ATmega168 with support components (like a 7805 volt reg and a couple of capacitors) and they are laid out like a breadboard.
However, I'm running out of space for components on those boards and using single-pad proto boards seems kind of kludgy.
So I began looking into making my own PCBs. But all that stuff with printing and ironing and splashing around with acids and whatnot just looks like too much hassle.
So if I don't want to make my own, I guess I'll have to buy them. It might be a bit more expensive but they will look soo much cooler with solder mask and silkscreen and stuff.
After a couple of hours of Googling I ended up confused on higher level. It turns out that there are lots and lots of companies making PCBs to order but specifications, requirements, prices, minimum quantities etc. vary wildly. My requirements are:
- Simple boards: typically only one copper layer and (for the time being) no small SMD components so layout isn't too complex.
- Small quantities: like one or two or six boards at a time.
- No hurry: I can wait a couple of weeks.
- Price: I don't want to spend too much money on something that is just for fun (actually, that's probably too late but still...)
- No hassle: by which I mainly mean import tax and VAT.
- Solder mask: I'd like a solder mask (http://en.wikipedia.org/wiki/Solder_mask) to help protect from shorts and to avoid having to tin all copper traces to prevent corrosion of the copper (not strictly necessary). Also, it look cool.
- Silkscreen: Not strictly a requirement but it would be nice to have outlines and labels silkscreened unto the board. And again: it looks cool.
Two providers I'm currently looking at are:
Both are in the EU so there's no import tax and VAT, both accept designs in EAGLE .BRD files (EAGLE is the schematic and layout program I use), and both are able to deliver single and double-sided boards with solder mask and silkscreen in small quantities for a reasonable price.
I just found out I forgot to post this article about choosing the right MOSFET for the autogun project. Here it is:
When switching on the gun, we're passing a significant amount of current through the MOSFET.
As shown on the power test tables in this posting, we should expect a peak of 50 Amps and a sustained current of about 20 Amps.
So the MOSFET should be able to handle at least 15V and 60A. And since we are turning on the MOSFET from the MCU control circuitry at 5V the gate threshold should be low enough for the MOSFET to turn fully on at 5V. In practice this means a logic-level MOSFET.
The datasheets of MOSFETs will list a whole bucketful of specifications. Some of the important ones are:
|VDSS||maximum drain-source voltage. In my case, it should be at least 15V|
|ID||maximum drain current. In my case, it should be at least 60A to be safe. (Although the *sustained* current will only be 20A.)
Be careful with this one. Often it will be specified as one value "silicon-limited" and another - lower one - as "package-limited". This means the chip itself can handle a high current but the casing might melt or burst into flames. Which is bad. So use the lower one.
Also, it might be specified as one value "@ 25 °C" and another - again, lower - "@ 110 °C". Again, use the lower one since it is highly unlikely that the MOSFET will be at 25 °C when we are pulling 20A through it.
|PD||maximum power dissipated in the MOSFET. This is calculated as RDS(on) * I^2.|
|VGS(th)||gate threshold voltage. This is a measure of how much voltage on the gate is required to turn the MOSFET on. As mentioned, since we're dealing with logic-level voltages, it should be no more than 2.5V|
|RDS(on)||drain-source resistance when fully on. This will determine how much power is dissipated in the MOSFET's junction.
Since all the power dissipated in the MOSFET junction is converted into heat we need to check how fast we can get rid of that heat. Otherwise, the MOSFET will heat up and eventually break. And possibly (albeit not likely) melt and/or burst spectacularly into flames. Therefore, we will also take a good, long look at the following:
|RΘJ-A||thermal resistance between junction and ambient. This is a measure of how much power can be dissipated as heat from the junction to the surrounding air without any help.|
|RΘJ-C||thermal resistance between junction and case. We might need this if we need a heatsink. In that case we need to add this with the thermal resistance of the heatsink (RΘHS) and check if we are below the max allowable thermal resistance.|
|TJ||maximum operating temperature for the junction. We need this to check if enough heat is dissipated.|
Browsing through dozens of MOSFETs, this one looked promising: IRL1404PbF. It is listed as a "N-LogL 40V 160A 200W 0,004R TO220AB" MOSFET.
(Which means "N-channel, logic-level, VDSS=40V, ID=160A, PD=200W, RDS(on)=0,004Ω in a TO-220 package".)
It looks good because:
- it is logic-level activated
- it can handle 15V
- it can handle 60A
- it has a low RDS(on) which means that the PD will be low (PD = RDS(on) * I^2 = 0,004Ω * 20A^2 = 1,6W) which means that we just might be able to get by without a heatsink
To check if we can dissipate the heat fast enough, we need to calculate how hot the junction becomes under load by using the following formula (Tamb is the max operating ambient temperature. in Denmark the temperature is never above 35 so that should be a safe value):
Tj = PD * RΘJ-A + Tamb = RDS(on) * I^2 * RΘJ-A + Tamb = 0,004Ω * 20A^2 * RΘJ-A + Tamb = 1.6W * 62 °C/W + 35 °C = 99,2 °C + 35 °C = 134,2 °C
The result is below the specified 175 °C.
(If, however, we were to run 25A continous current through, we would end up with a junction temp of 190 °C (do the math yourself) which is too high.)
As you can see the current rating for a MOSFET should be taken with a grain of sand. The IRL1404 MOSFET is rated to 160A. But without a heatsink it can't even handle 25A continously.
Bonus reading: choosing a heatsink
If we ended up with a too high temperature, we would need to mount a heatsink to the MOSFET in order to lower the thermal resistance.
In that case, instead of using RΘJ-A for thermal resistance, which is junction-to-ambient air resistance, we would use the combined thermal resistance by adding the following:
|RΘJ-C||junction-to-casing (0,75 °C/W for the IRL1404)|
|RΘC-S||casing-to-heatsink (0,5 °C/W for a "flat, greased surface" and typically between 0,5 and 1,5 depending on whether you use thermal grease, mica or bolt it directly on)|
|RΘHS||heatsink-to-ambient (depending on the heatsink)|
We can calculate the maximum thermal resistance that will dissipate the heat from the junction fast enough by using the above formula (transposed a bit):
maxRΘJ-A = (Tj-Tamb)/PD = (175-35)/PD = 140°C / RDS(on)*ID^2 = 140°C / 0,004Ω * 20 A ^2 = 140°C / 0,004Ω * 400 A^2 = 140°C / 1.6W = 87.5 °C/W
In this case the max thermal resistance of the junction-ambient without heatsink is lower than that (per the datasheet it is 62 °C/W) so we don't need a heatsink, but if we calculated it for a 25A sustained current we would end up with a max thermal resistance of 56 °C/W and since the j-c plus c-s is about 2 °C/W (if we don't use thermal grease) we would need a heatsink with a maximum RΘ of 54 °C/W. Like this little one here which has a thermal resistance at normal airflow (as opposed to "forced", i.e. fan ventilated) of 16,2 °C/W.
A lot about thermal resistance and heatsinks: http://www.jaycar.com.au/images_uploaded/heatsink.pdf
About choosing a MOSFET and explanation of the MOSFET's parameters: http://robots.freehostia.com/SpeedControl/MosfetBody.html