MOSFET collegato ad Arduino uno per gestire
Transcript
MOSFET collegato ad Arduino uno per gestire
MOSFET collegato ad Arduino uno per gestire correnti elevate In questo tutorial vedremo come collegare un MOSFET ad Arduino per comandare un motore elettrico evitando quindi il superamento della soglia dei 40 milliAmpere sui PIN in uscita del microcontrollore. Io ho usato un MOSFET IRF520 (immagine sottostante) ma va bene qualsiasi MOSFET. Importante è controllare il datasheet di ogni componente prima di collegarlo alla nostra basetta. Il funzionamento è molto semplice e basilare, lo possiamo paragonare ad un rubinetto di casa, applicando una piccolissima corrente al Gate il MOSFET fa fluire o meno la corrente che andrà ad alimentare i carichi maggiori. Elenchiamo i componenti necessari per collegare un motorino al PIN 9 di Arduino uno senza prelevare e quindi sovralimentare il PIN stesso: Schema Ecco lo sketch che ci permetterà di far ruotare il motore. int turns = 0; int turnAmount = 1; unsigned long currentTime; unsigned long loopTime; void setup() { pinMode(9, OUTPUT); currentTime = millis(); loopTime = currentTime; } void loop() { currentTime = millis(); if(currentTime >= (loopTime + 20)){ analogWrite(9, turns); turns = turns + turnAmount; if (turns == 0 || turns == 255) { turnAmount = -turnAmount ; } if (turns == 0) { delay(5000); } loopTime = currentTime; } } TIP120 is two NPN transistors arranged so that 1 transistor drives the 2nd transistor. http://www.fairchildsemi.com/ds/TI/TIP122.pdf NPNs need current to turn them on - 1st transistor is used to drive higher current into the 2nd. Voltage drop across the 2nd transistor collector-emitter is pretty high, 2 to 4V depending on current. N-channel MOSFET is driven by voltage level instead, needs very little current. Voltage drop across drain-source is dependent on the Rds of the device and the current flow. Rds can be very low, like 0.030 ohm, so for 360 LEDs, arranged in 90 parallel strings of 4 LEDs in series, drawing 20mA/string, so 90 * 0.02 = 1.8A, the voltage drop across the MOSFET would be 1.8A * 0.03ohn = 0.054V http://aosmd.com/res/data_sheets/AOI516.pdf This might allow strings of 5 LEDs from 12V even, reducing your current draw even more - 360/5 = 72 * 0.02 = 1.44A. Power dissipated = Current * Voltage So for TIP120, 1.8A * 2V = 3.6W, gonna need heatsinking. For a MOSFET, 1.8 * 0.054 = 0.09W, heat sink likely not needed. MOSFET, want to switch voltage levels quickly, so go from high resistance (off) state to very low resistance (on) state quickly, and not burn up the part going thru the medium resistance region slowly and dissipating more power.