Skip to content Skip to sidebar Skip to footer

Till I Can Gain Control Again

Download PDF YouTube

Arduino's are fantabulous microcontrollers but they tin merely control low-current devices. At that place are several means to extend the adequacy of your Arduino to allow it to drive higher current loads. Today we will look at a couple of them.

Follow along as nosotros learn to use transistors and MOSFETs with our Arduino.

Introduction

The Arduino is a microcontroller, you lot probably already know that. The very proper noun "microcontroller" tells us that the primary purpose of this device s to control things.  The "micro" office simply ways that it is a very tiny device.

The Arduino, or any microcontroller, is tiny in more just size. It also has a pretty small-scale electric current capability, limiting its apply to direct controlling only pocket-size devices such as single LEDs, OLEDs, and LCD displays.

Transistors and MOSFETs

Of class, that hasn't stopped us from controlling much larger devices like gear motors and big stepper motors. We accomplished this past using a driver board to have the low-current Arduino control signals and drive the high-current motors.  In these cases, the driver board did all of the heavy lifting for u.s.a..

The driver boards we have been using accomplish their magic using devices like transistors and MOSFETs. These are basic electronic components that are used in a myriad of applications, in fact, the Arduino itself is a drove of transistors on a unmarried chip.

Today we volition learn to use these components to extend the current-driving adequacy of our Arduino designs.

Transistors and MOSFETS

In 1947 American physicists John Bardeen and Walter Brattain, working nether physicist William Shockley at Bell Labs in Murray Hill, New Bailiwick of jersey, invented the first point-contact transistor. A year later Shockley invented and patented the first bipolar transistor.

This piece of work resulted in all three men earning the 1956 Nobel Prize in Physics for their enquiry on semiconductors and their discovery of the transistor outcome. And their invention literally changed the world.

Transistors are the basis of virtually every electronic device created today. The powerful desktop computers and compact smartphones nosotros know and dearest owe their existence to tiny transistors etched onto silicon chips. Advances in medicine, space enquiry and even the Internet itself would not take occurred without the transistor.

Assortment of Transistors

Transistors replaced vacuum tubes and they could human action equally either amplifiers or electronic switches. We will be making apply of the latter capability.

Bipolar Junction Transistors (BJTs)

The "standard" transistor is the Bipolar Junction Transistor, or BJT. These are sometimes just chosen Bipolar Transistors.

Bipolar Junction Transistors - BJTs

A BJT has three leads:

  • Base
  • Emitter
  • Collector

There are 2 types of BJTs – NPN and PNP.

BJT with Load

A BJT is current driven, that is to say that it is switched on when current flows between the base and emitter.

BJT Low Current to Base

A sufficient current flowing into the base of operations will switch on the transistor and allow current to flow between the emitter and collector.

BJT Switched On

When the BJT is switched on it behaves a lot like a diode. In a way y'all tin think of it as a switchable diode.

MOSFETs

The Metal Oxide Semiconductor Field Effect Transistor, or MOSFET, is an improvement on the BJT in many ways. It is a high impedance device that uses a low voltage to switch it on.

As with a BJT a MOSFET has three leads.

  • Gate
  • Drain
  • Source

MOSFETs

There are two types of MOSFETs, Northward-Channel and P-Aqueduct.

This diagram illustrates a MOSFET in a circuit with a low voltage source connected to the Gate.

MOSFET Driving Load

When a sufficient voltage is applied to the gate the MOSFET is switched on.

MOSFET Low Voltage on Gate

This allows current to flow between the Bleed and the Source. The MOSFET acts similar a very low value resistor when it is switched on.

MOSFET Switched On

Since MOSFETs have a very low on resistance they don't misemploy very much power, and then they stay cool fifty-fifty without heatsinks.

BJTs vs. MOSFETs

So which of the 2 types of transistors would be best for your pattern?

The reply is not always straightforward every bit both Bipolar Junction Transistors (BJTs) and MOSFETs accept their own strengths and weaknesses.

This chart outlines some of those differences:

BJT MOSFET
Current Controlled. Requires biasing electric current and limiting resistor. Voltage Controlled. No biasing electric current or limiting resistor.
Lower impedance. Draws more current. College impedance. Draws minimal current.
Higher gain than MOSFETs. Lower proceeds than BJT'southward.
Larger internal size than MOSFETs. Smaller internal size than BJTs.
Less expensive than MOSFETs. More expensive than BJTs

As you can see in nigh applications the MOSFET has some distinct advantages over the BJT. But in some cases, such as in the design of amplifiers, or where cost is a gene, bipolar junction transistors can be a better pick.

Our Transistor & MOSFET

Here are the devices we will be using in our ex[periments. Both of them are very common devices that your local electronics store will have in stock. Y'all tin substitute other devices with similar specifications.

TIP120 Darlington Transistor

The TIP120 is an NPN Darlington Power Transistor. Information technology tin switch loads upward to 60-volts with a peak current of 8 amperes and a continuous electric current of five amperes.

A Darlington transistor consists of a pair of transistors in the same package. The emitter of the outset transistor is connected with the base of the second transistor and the collectors of both transistors are connected together to class a Darlington pair.

This arrangement improves both the current gain and current rating of the transistor.

Hither are the main specifications of the TIP120:

  • NPN Medium-ability Darlington Transistor
  • High DC Current Gain (hFE), typically 1000
  • Continuous Collector current (IC) is 5A
  • Collector-Emitter voltage (VCE) is 60V
  • Collector-Base voltage (VCB) is 60V
  • Emitter Base of operations Voltage (VBE) is 5V
  • Base Current(IB) is 120mA
  • Peak load electric current is 8A
  • Available in To-220 Package

IRF520 MOSFET

The IRF520 is a Power Mosfet with a 9.2-ampere collector current and 100-volt breakup voltage. This MOSFET has a low gate threshold voltage of four volts and hence is commonly used with microcontrollers like the Arduino for switching loftier current loads.

Here are the main specifications of the IRF520:

  • N-Channel Power MOSFET
  • Continuous Drain Current (ID): 9.2A
  • Drain to Source Breakdown Voltage: 100V
  • Bleed Source Resistance (RDS) is 0.27 Ohms
  • Gate threshold voltage (VGS-th) is 4V (max)
  • Ascension fourth dimension and fall fourth dimension is 30nS and 20nS
  • It is commonly used with Arduino, due to its low threshold voltage.
  • Available in To-220 packet

Pop MOSFET Module

One reason that I chose to employ the IRF520 for my MOSFET experiments is that it is available equally a depression-cost module. The module has a few supporting components, likewise as screw terminals for power and the load yous are controlling.  Information technology as well has a 3-pin connector for connecting to the Arduino or other microcontrollers.

I'll be using these modules in my MOSFET case, simply y'all could always elect to employ detached IRF520s instead.  I'll evidence you both ways in the wiring diagram.

Arduino with Transistors

For the outset couple of experiments, we volition use the TIP120 ability Darlington BJT.  You tin can substitute a BJT with similar specifications if y'all don't have a TIP120.

I'll be using 6-volt batteries and loads for my experiments, but you lot can use any DC power source and load upwards to twoscore volts. Don't try and switch Ac voltage using the methods you're near to see, these are strictly DC circuits.

Basic Arduino Transistor Switch

The first experiment is the basic switch. It'south a simple hookup and sketch and information technology illustrates how elementary information technology is to command a load with a transistor and an Arduino.

For my high-electric current load, I'k using a 6-volt incandescent low-cal bulb. You could select some other resistive load if yous wish.

Here is how I hooked everything upwardly:

Arduino Transistor Switch Hookup

Note that in add-on to the Arduino, TIP120, calorie-free bulb and battery you'll need a pushbutton switch and a couple of resistors. The 2.2k resistor limits the current into the base of the transistor, while the 10k resistor is a pull-upwards resistor for the switch.

Hook everything upward and then load the following sketch:

The sketch for our switching experiment is pretty elementary. Its purpose is to light the bulb for 5-seconds when the pushbutton is pressed.

We start past defining variables to correspond the output pin to the transistor and the input pin from the switch. We also define a variable to hold the pushbutton value.

In the Setup, we set our inputs and outputs, and then write a Low to the output pin to make certain we enter the loop with the transistor off.

Arduino Transistor Switch on Breadboard

In the Loop, we read the input pivot and use its value for the button value. If information technology is High so the push button has not been pressed and the 10k resistor is pulling the input up to 5-volts.

If the button is pressed the input will go to ground and the value will be Low. We turn on the lamp past setting the output High, which passes current through the 2.2k resistor to the transistor base.

Nosotros want our light to stay on for a while so we add together a 5-second delay. We then set the output LOW to turn off the lamp and go back and finish the loop.

Arduino Transistor Switch

Load the sketch and detect the results. Yous can increase or decrease the delay if you wish.

Switching Anterior Loads

The arrangement we just saw with the transistor and the Arduino works well for resistive loads, but for inductive loads, there is another consideration.

What is an anterior load yous might inquire?

An inductive load refers to any load that passes electricity through a coil. Examples would be motors, relays, and solenoids.

When current is passed through a coil it creates a magnetic field and a small-scale current is generated in the opposite direction. This is sometimes called "reverse EMF" or "backflow voltage".

A device like a motor or a solenoid can take a large reverse EMF when it is in move. That reverse voltage can damage transistors, so they need to exist protected from it.

The almost common method of protecting from contrary EMF damage is to utilize a diode, wired in the "reverse" polarity. This absorbs the contrary voltage.

In our experiment, nosotros volition utilise an anterior load in the grade of a pocket-sized DC motor.

Arduino Transistor Motor Control Hookup

Notation the diode beyond the motor leads, I used an IN4004 rectifier diode, which is a very common device.

The rest of the wiring is pretty straightforward. Once again I'm using a 6-volt battery to power the experiments high-current side, and nosotros're using a 2.2k resistor to limit the electric current into the transistor base.

Nosotros take also added a potentiometer and then that nosotros can command the motor speed.

Hither is the sketch we'll be using for the motor control:

This is also a simple sketch, it's purpose is to read the potentiometer position and prepare the motor speed appropriately.

Nosotros start past defining our output to the transistor and the analog input pin used by the potentiometer. We as well define a variable t concur the motor speed,

All we practise in the Setup is to ascertain our transistor connection equally an output.

Arduino Motor Control on Breadboard

In the Loop, we read the potentiometer position and then use the map command to catechumen it into a range of 0-255.  We then use an analogWrite control to send PWM signals out to our transistor.  This switches the transistor on and off, powering our motor.

Load the sketch and experiment with decision-making the motor speed.  Because we are using PWM the motor should have adept torque even at the slower speeds.

Arduino Motor Control

If y'all need to command the speed of a small DC motor and don't need to opposite it then this is actually a practical circuit.  Merely recall that yous'll be losing 0.7 of a volt through the transistor.

Arduino with MOSFETs

MOSFETs take a number of advantages over BJTs. They cost more than, but for that actress coin, you get much meliorate power dissipation and simplicity in hooking them upwards to your logic circuits.

Nosotros will be making utilise of the IRF520 Northward-Channel Ability MOSFET for our experiments. I'thou going to be using a pop "MOSFET Module" that simplifies hooking up external devices to your microcontroller, simply you lot may as well only apply discrete MOSFETs instead.

Arduino MOSFET RGB LED Strip Driver

Our experiment will involve using an Arduino to command a 5-meter strip of RGB LED strip lights. We'll have three potentiometers to control the intensity of all 3 colors, allowing u.s. to dial-up a rainbow of colors.

You'll require three MOSFETs or MOSFET Modules to wire this up, as well every bit a 12-volt power supply with enough current to power the LED strip, which tin can swallow several amperes.

I used the MOSFET Modules in my pattern, but if yous want to use discrete MOSFETs instead you lot tin can use this diagram to equate the ii.

MOSFET Module with IRF520

Detect that the VCC pin on the module is not connected to annihilation. Also, the Vin and 5+ pins are just tied together.

The diagram does not testify an additional 1k resistor and an LED that the module uses to display activity on the MOSFET gate input.

Hither is the wiring diagram.

Arduino MOSFET LED Strip Light Control Hookup

In retrospect, y'all don't need the connections from the power supply positive to the module V+, they don't actually go anywhere.  Only the connectedness to the LED strip positive common is required.

The hookup is pretty straightforward, essentially we are connection the 3 potentiometers to three analog inputs and the three MOSFET modules to output pins that are capable of PWM.  The LED strip lights are connected to the power supply through the MOSFET outputs.

Here is the sketch nosotros will be using to brand all of this piece of work:

Another elementary sketch, actually it's very similar to the one we used to control the motor with a BJT.

Nosotros ascertain the pins we'll be using for the outputs to the MOSFETs, and the analog pins used by the three potentiometers.  Nosotros likewise define three variables to hold the 3 color values.

In the Setup, we set up the pins continued to the MOSFETs equally outputs. We besides prepare up the serial monitor, this is optional and is included for troubleshooting purposes just.

In the Loop, we read the 3 potentiometers, convert their values to a range of 0-255 and then send PWM out to the three MOSFET switches to control our LEDs. It'due south pretty straightforward.

Arduino LED Strip Light Demo

Once you become everything hooked up requite information technology a effort. If you have trouble getting it to work await at the serial monitor to see what values you're getting from the potentiometers.

It'due south a colorful experiment!

Conclusion

Past using BJTs and MOSFETs nosotros tin extend the command capability of our Arduino projects.  We are no longer limited to devices under 40ma.

The techniques I showed you hither tin can be used for a variety of DC loads, inductive and non-inductive. But they cannot be used to command Air-conditioning devices, so don't even try. In that location are other methods used to control Ac devices, and we will expect at them in a future article and video.

Until and then you'll have to limit yourself to controlling the DC equipment in your earth.  Have fun!

Resources

Lawmaking for this Article – All the code used in this article in a handy ZIP file.

PDF Version – A PDF version of this article, bully for printing and using on your workbench.

Transistor Theory – An excellent tutorial from Sparkfun.

TIP120 – TIP120 Bipolar ability transistor spec sheet.

IRF520 – IRF520 Power MOSFET spec sheet.

Summary

Arduino High-Current Interfacing - Transistors & MOSFETs

Article Name

Arduino Loftier-Current Interfacing - Transistors & MOSFETs

Description

Learn how to employ Bipolar Junction Transistors and MOSFETs to interface high-current DC loads with an Arduino.

Author

Dronebot Workshop

Publisher Name

Dronebot Workshop

Publisher Logo

zimmermannfixecition.blogspot.com

Source: https://dronebotworkshop.com/transistors-mosfets/

Post a Comment for "Till I Can Gain Control Again"