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
I needed to figure out exactly how much power the airsoft guns actually use. Voltage is pretty straightforward: the battery's nominal voltage is 11,1V so under load it will probably be a bit below that.
Current, however, is rather more difficult to measure. My multimeter is only good up to 10A and I expect higher current than that.
Luckily, I have data loggers on two of my remote controlled helicopters which are also electrically powered and run on 37V batteries up to 80A (yes, that is a lot) so they should be perfect.
So I went and connected the guns to one side of the data logger and the battery to the other, plugged in the USB lead, started the application and set it to live recording. Here are the results.
First the M110 gun:
And here the M130 gun:
The first shot draws significantly more current than the rest. This is seen clearly both when firing on semi-auto and on full-auto.
The M130 gun draws more current but not a lot more.
Based on these measurements I settled on a maximum current of 60A and a continous current of 20A.
This is the kind of data logger I use: Eagle Tree eLogger
What's the point of making robots if you can't mount lasers to them?
I am not making robots and I don't have any deadly lasers lying around. I do however play airsoft and I thought it would be neat to have a remote triggered, automatically firing gun which could be set up and left waiting for unsuspecting bad guys to wander into its line of fire.
Somehow, I settled on the following basic setup:
Two units: a sensor/transmitter and a receiver/trigger. The sensor would be placed where it can detect people that should be fired upon and the trigger unit will be connected to the gun.
Communication will be wireless using nRF24L01+ units, the sensor will be a passive infrared motion sensor (like the ones turning on the lights in the garage), gun will be triggered by a power MOSFET and both the sensor unit and trigger unit will be controlled by an ATmega168.
An Arduino will be used in the prototyping phase for testing the various components but the I will probably move over til plain C (avr-lib) at some point. Read the entire post »