loading

At some point in Arduino, you are going to want to leave the calm waters of blinking an LED and control something a little more powerful. To do that, you are going to need a little help.

Transistors can be used as a switch using the Arduino's digital signal for control. A MOSFET is an ideal type of transistor for this application, and can handle several amps of current and up to 30 volts!

I've designed an Open Source Arduino shield to utilize three MOSFETs, which can be used to control motors, solenoids, or even the three channels of an RGB LED string!

Step 1: Gather the Parts, Tools, and Supplies

You can build this circuit with a number of various parts, but these are the ones I've found to work:

PCB:

Digikey parts:

  • 3 - MOSFET IRLB8721, IRLB8721PBF-ND
  • 4 - TERMINAL BLOCK 3.5MM 2POS, ED1514-ND
  • 1 - LM7809 Voltage regulator, LM7809ACT-ND
  • 1 - 100 uf 35V Cap, 93-1081-ND
  • 1 - 10 uf Cap, P997-ND
  • 1 - 1 uf Cap 50V, 478-7667-ND
  • 3 - Diode 1N4001, 641-1310-1-ND
  • 3 - 10K resistor, 1/8W, CF18JT10K0CT-ND
  • 1 - 1K resistor, 1/8W
  • 3 - 330 resistor, 1/8W, CF18JT330RCT-ND
  • 1 - 3mm LED, red, 160-1955-ND
  • 3 - 3mm LED, green, 160-1710-ND
  • 1 - power shunt, 2-881545-2-ND
  • 1 - CONN HEADER .100" SNGL STR 40POS, S1012EC-40-ND

Optional:

  • 2 - CONN TERM BLOCK 2.54MM 2POS PCB, ED10561-ND
  • 1 - CONN TERM BLOCK 2.54MM 3POS PCB, ED10562-ND
  • Heat syncs, HS198-ND (with analog headers installed, will only fit on one of the MOSFETs).

Tools and Supplies:

For my workshops, I use SparkFun's Beginner's ToolKit which has most of what you need:

  • Soldering iron.
  • Solder
  • Wire nippers
  • Desoldering braid (hopefully not needed, but you never know).

A kit for this project is available on Tindie.com. Purchasing the kit will save you the time and expense of ordering from several different vendors and avoid the minimum PCB order premium. You will also be helping me develop and share other projects!

Step 2: Ladies and Gentlement, Start Your Irons

We are going to assume you have some kit-building experience. If you need some help soldering, head over to www.sparkfun.com/tutorials/213 to brush up.

The order of assembly is largely a matter of preference. If you don't have a helper or a vice, I generally go from lowest height to tallest so when the board is reversed on the table, the parts stay in place.

Resistors: Let's start with resistors since they are the most plentiful, lowest seating, and easiest to solder. They are more heat resistant and will give you a chance to brush up on your technique. They also have no polarity, so you can put them in either way.

Diodes: Now you are warmed up, time to try something with polarity. Add the diode observing the white line on the PCB and the black band on the diode. This is the "kick-back" diode and the circuit will not work if it is in backwards.

Step 3: LEDs, Capacitors

LEDs:

Light emitting diodes have a polarity. Place the longer leg in the hole with the silkscreen "+" next to it. The red LED indicates the shield is powered (not just from USB), and the green LEDs indicate the MOSFET outputs are engergized.

Capacitor:

The 1uF ceramic capacitor does not have a polarity and can go in either way. The 10uF and 100uF electrolytic capacitors do have polarity. Like the LEDs, place the longer lead in the hole with the silkscreen "+" next to it. Capacitors are mainly to keep the power signal to the microcontroller steady while the loads are switching on and off.

Step 4: Terminals

The two-position terminals allow us an easy way to connect power and loads to the board. They are optional if you are building a permanent installation and want to just solder the wires directly. This also applies to the optional input terminals.

The output terminals have a 3.5 mm spacing while the input terminals, which handle less current, have the 2.5 mm (0.1") spacing.

Step 5: MOSFET, Voltage Regulator, and Power Jumper

The work horse of the circuit is the metal–oxide–semiconductor field-effect transistors (MOSFET). They act as a switch for the high-current source, using the Arduino's digital signal as the control. You can learn more about how they work at http://en.wikipedia.org/wiki/MOSFET.

You need to carefully identify the difference between the LM7809 voltage regulator and the three IRLB8721 MOSFETs since they come in the same TO-220 package and look fairly similar except for the markings (see photograph).

We also need to allow the choice of input power between the shield's terminal and the Arduino's barrel jack. Clip a 3-pin segment off the pin header and solder it in place adjacent to the 10uF and 100uF capacitors.

Step 6: Shield Headers

I like to use an available Arduino as a jig to hold the pins in place. Cut two 6-pin segments and two 8-pin segments from the pin header. Place them in the Arduino with the short end pointing upward. Place the shield in place and solder the pins.

Step 7: Inspect and Test

Take a few moments to carefully inspect your solder joints. Use a magnifying glass if you have one. You are looking for missing or bridged joints.

If you are a neat freak or will be showing off your handy-work to your friends, you can remove the solder flux residue using Goo Gone or flux remover.

Step 8: Use

Power Source:

  • You can connect up to 30V DC to the terminal. This will power the Arduino with 9V through Vin.
    • With the power selector to "TERM", the input voltage is supplied to the MOSFETs.
    • With the power selector to "JACK", the regulated 9V output is also supplied to the MOSFETS (1A limit).
  • You can provide up to 12V DC to the Arduino via the Arduino's 2.1mm barrel jack. With the power selector to "JACK", the 12V is supplied to the MOSFETs via Vin.

The red LED will light when the circuit is powered in either manner.


Code:

MOSFETs are connected to Arduno digital PWM pins 3, 5, and 6. These must be set to output:

pinMode(3, OUTPUT);

You can then control the output of the MOSFET using either:

digitalWrite(3, HIGH); // fully on

analogWrite(3, 124);   // PWM values from  0 - 255

Happy MOSFETting . . .

If you build and use it, let me know what for and how it went!

- Ken

Step 9: Options

I've laid the board out so you can use heat shields for the voltage regulator and two of the MOSFETs if you are drawing enough load to heat them up. The traces on the PCB are 80 mils wide, so total current would be limited by those to several amps.

It is likely that the loads you want to control would be triggered by some sort of input.

  • Light controlled by a photo resistor
  • Fan speed controlled by a potentiometer.
  • Solenoid controlled by a pressure dector.
  • I've laid out three analog inputs on the side of the board with 0.1" spacing so you can add headers, terminals, or just solder leads in place.

I've also laid out two of the analog inputs and a ground such that you can attach a temperature sensor like the TMP36 or potentiometer in a power-signal-ground arrangement. Simply set pin A4 pinMode to OUTPUT and digitalWrite it HIGH to supply 5 volts. Use pin A5 to read the signal and the GND for ground.

<p>hi , thanks for sharing such elegant board and design , as that mosfet designed for switch purpose , it is possible to use mosfet for reading the low current device (week signal)? actually I've tried to read My PIR sensor status by transistor but it is too week to drive the transistor , I thought maybe by mosfet can read such week signal , any hint really appreciated </p>
<p>I have no idea, but would start by looking at the data sheet for the IRLB8721 to see if they have any application notes.</p>
<p>Great ible on using one of my favorite semiconductors for useful purposes. I've pretty much given up on solid state and mechanical relays. Instead, I have a sack of MOSFETs to use whenever I need them. Quick, simple high current switches. </p><p>Your board, however, takes MOSFET switching to a whole other level! Bravo!</p><p>Excellent soldering tutorial, too!</p>
<p>Hi All, I am totally greem byt maybe you can tell me if this shield works also as a voltage regulator or just switch?</p><p>I need to regulate range between 40 and 60V using arduino?</p><p>Can you recommend something?</p><p>thanks a looooot!</p>
You are only able to pulse-width modulate the voltage with this shield, and limited to about 30V.<br><br>Take a look at this project:<br>http://tuxgraphics.org/electronics/201005/bench-power-supply-v3.shtml<br>
Hi! I have a few questions about MOSFETs and relays if you have some time to answer them.
<p>Ask away.</p>
Hi MakersBox,<br><br>I am currently working on two separate projects: I'm turning on/off an electromagnet with a 30v, 60a Power N-Channel MOSFET and turning on/off a neon sign with a relay (I'm unsure if I have the proper relay for the job--I have attached a PDF of the relay's specs to this). <br><br>I tested out my MOSFET with a LED and a 680 ohm resistor and it worked well, but now I need to connect the electromagnet to the 12v, 30a power supply. I'm planning on connecting my (+)power to a 10k ohm resistor then to the positive wire of the electromagnet. The negative wire of the electromagnet will be connected to the Drain of the MOSFET. The Source will be connected to the (-)ground of the power supply. The Gate to Pin9(my code is connected to this Pin). The only aspect I am unsure about is if my Arduino's (-)ground can be connected to the ground of my power supply? I know the Arduino can only handle 12v, 3a max, but can one connect the microcontroller's ground to a 12v, 30a power supply?<br><br>Secondly, I'm having issues with the relay turning on/off the 6.5kv, 30mA neon transformer. I cut my transformer's hot wire and connected that to two sides of my relay then connected the other two sides of my relay to Pin9 and the Arduino's (-)ground. I have my Arduino powered by a regulated 5v power supply. I have another regulated 12v power supply connected to the 2nd ground and Vin of the Arduino, but I am unsure if this is necessary. Regardless of this, my relay was not switching the power on/off.<br><br>I have attached images-the first two are from my LED practice and the second two images are images of my relay connection. <br><br>Please let me know if you need any other information or can help. <br><br><br>Thank you, <br>Katie
Thanx a lot ! I don't know how to calculate it myself
That resistor value(10k) is calculated for 9v right?
<p>They are just weak pull-downs. The value isn't too critical.</p>
What value of resistor should i use ?
<p>Take a look at the schematic diagram on the Intro step (different values for different jobs).</p>
<p>Nice Build. The main drawback that would be nice to eliminate is the higher Rds_on caused by the lower gate voltage. With 13.1 milliohms at Vgs=4.5V, 5A would make a hot MOSFET with 3.275W of loss. If you added a 9v driver you could effectively halve the resistance and therefore your I2R losses. I really like that you made a jumper to allow the MOSFETs to be fed with Vin OR the 9V output. The 1.5A maximum current handling of the regulator severely limits the MOSFETs rating of 62A.</p>
<p>I think the primary limit on current handling is the 80 mil traces on the PCB which is only a couple of amps at best.</p>
<p>do you have the shield's circuit schematic? where can i find it?</p>
<p>Nice instructable,What PCB soft to open the gerber files?</p>
<p>I used KiCAD. Others may work.</p>
<p>Thanks</p>

About This Instructable

10,288views

88favorites

License:

More by MakersBox:Easy Joule Thief Soldering Project Using an Arduino Drawing Robot with Hour of Code Tutorials Arduino Drawing Robot 
Add instructable to: