My first few projects involving controlling motors used relays, but since most of my designs are deployable and thus battery powered, reducing power consumption is a priority. Since relays require a constant voltage to reverse their normal state (Off -> On or On -> Off), I've tried to stay away from using them. I've had success using latching relays, but I've always been concerned that in the event of a power loss to my Arduino board, a latching relay could potentially remain open indefinitely. As I've mentioned in previous posts I've been happy using MOSFETs, which have the benefit of closing a circuit in the event of a power loss, but also use minimal power to keep a circuit open. I've had success using Sparkfuns MOSFET breakout board for previous projects, and found them to be an easy, straight forward product to use. But for an upcoming project I will need to control up to 25 solenoids, and due to space limitations and organization it's impracticable to squeeze in 25 breakout boards. Plus each kit costs $4, but a single N-channel MOSFET component sells for less than $1. So I can save a pretty penny if I ditch the breakout board kit and build the power control circuit from scratch. So what is a MOSFET anyway? A MOSFET is just a special kind of resistor, used for amplifying or switching electronic signals. And if your curious, "MOSFET" stands for Metal–Oxide–Semiconductor Field-Effect Transistor. For my purposes here I will be using a MOSFET as a simple ON/ OFF switch. MOSFETs have 3 pins, a "Source" pin, a "Drain" pin, and a "Gate" pin. Or as I like to think of it: In= Source Out= Drain Control= Gate To use the MOSFET as a switch, you raise the voltage to the gate (set pin to "high" using Arduino), which allows electrons to flow from IN -> OUT or from Source -> Drain. So like any switch, the MOSFET conditionally completes a circuit allowing power to flow through. A quick side note: I'm using an N-channel MOSFET. For an N-Channel MOSFET, the source is connected to ground. This is opposed to a P-channel MOSFET, where the source is connected to power (Vcc). So lets wire this puppy up! Remember, on this MOSFET the pins are (from Left to Rigth) Gate, Drain, and Source. So as I have it wired up here, the Arduino is connected to the Gate and will send a "high" voltage to turn the MOSFET on. The Drain is connected to the DC motor, and the Source is connected to ground. When the MOSFET switches ON, the circuit to the battery is completed allowing the battery to power the motor (The Arduino does not power the motor in this example). A few notes on this design: 1- There is a 10k resistor connected to the Arduino control pin. This is used as a pull-down resistor, which holds the gate in a low state (connected to ground) when the Arduino is not sending a "high" signal. 2- There is a 1 amp/ 50 volt diode connecting the + and - sides of the motor. This is used as a rectifier diode, and it is recommended you use one of these anytime you are working with a coil (motor, relay, solenoid, ect). Whenever you stop power to a coil, you can get a powerful reverse voltage spike. The spike only lasts a few microseconds, but the voltage is high enough it can fry your poor MOSFET. The rectifier diode is installed facing the "wrong way" (stripe facing V+ of motor), so that under normal operation it does nothing. But given a reverse spike, the diode allows voltage to flow back to the coil itself (which can handle the spike), as opposed to flowing back to the MOSFET (which can't).
1 Comment
natalia
12/30/2016 05:13:21 pm
Amazing work and great info!! Let's collaborate and build something together :)
Reply
Leave a Reply. |
AuthorAn electronics enthusiast looking for a place to gather his thoughts, ideas, diagrams, and code Archives
October 2016
Categories |