Articles Hierarchy

Articles Home » Arduino Projects » ARDUINO PROJECT: power MOSFET


some time ago i already tested MOSFET ( and i used them to drive LEDs )

but now esp. in respect i have PMS3 available i hope i can see what is happening when i drive this circuits by PWM...

so first prepare setup:
- PMS3 on MAX32 hardware,
- a new puls program on Arduino UNO
with a compiler switch i can select the pure D7 switching ?97kHz?
or add by divider ( here 10 )
X = N / divider
Y = X / divider
but i can not reach with that 100kHz / 10kHz / 1kHz pulses, because the counts and ifs slow UNO down.
For D7 switch only: 67 pulses
For D5 D6 divided signals: 49 pulses

so with a additional delayMicroseconds(4) i now have about 50kHz, 5kHz,500Hz pulsing for test.

In a other version i made a standard arduino PWM (500Hz) on D3 and
a coded PWM on D7
with setpoint adjustable by poti on A0.
with a second poti on A1 i can adjust the base frequency of the D7 PWM.
it is not only about the possibility to test on different frequencies ( what would be possible
with the arduino PWM only when you fuck with the internal timers )
it is more about the requirement to be able to do measurements ( analog reads )
when the PWM is known down or up.
Random reads on a PWM signal are useless as i learned in my first tests, but
interesting example: the current what comes back from a motor when the PWM puls is OFF
can be used as a speed signal.

Now i want to learn about using a optoisolator / photocoupler LTV817C pls see also datasheet

I see between IF 10 .. 20mA in VF 1 ..1.3V, select RD = (5V-1.2V)/0.0115A = 330ohm
Range: 35V and 50mA, but for IF 11mA, IC only max 22mA, select RL = 1kohm
while at 5kHz it looks good: ( A1 is puls, A2 is opto input, A0 is opto output )

with higher resolution

but the 50kHz not come through.

and a test with RL = 10kohm not much better.

So as good the idea is to protect the board from the power switching job by opto,
there are 2 problems, the frequency limit and the outputpower limit.
As a high power MOSFET might want current to switch on, there could be need to use
one transistor more between opto and MOSFET gate. But also the circuits i found in internet
to connect opto and mosfet are so different that i might need lots of testing.

test circuit:

look for the MOSFETs i have here:
IRL510 max 5.6A
IRL530 max 15A
L2203N max 116A

with leg 1,2,3 = G,D,S = Gate, Drain, Source and cooler on Drain
and Source means MINUS / GND
and Drain means PLUS / LOAD

well, there is some switching by the MOSFET, see A1
removing the resistor to MINUS has no effect,
removing resistor from PLUS switch opto output OFF and LED glows dimm.
disconnect the puls sets opto output to high and LED bright ON!!.
up to 10kHz sameresults,
using D3 as PWM output ( with read from potentiometer on A0 )
(480Hz basetime) find that i can not switch OFF LED completely,
-a- still see pulses,
-b- even take out the mosfet keeps LED little bit ON????
that little magic light? is a current by the voltage divider for the scope!

a test of all 3 MOSFET on that circuit ( still all on 5VDC ) show same.
as with the PWM see best, my first circuit is inverting, and with that behavior,
that its ON at
- start,
- puls OFF,
- Arduino upload...
it is just dangerous and should not be used.

now i try this:
works much better, but the 10k to GND needs to be optimized,
- 1k and MOSFET not switch,
- open and opto discharge like capacitor.

criteria is that MOSFET not show a RAMP instead of SWITCH, because that means HEAT!
you can see very good that between 2 .. 3V at GATE the MOSFET change its state.

+ but 2k looks better.

but i need to look for MOSFET driver IC.. even up to complete motor H bridge driver.
I see some circuit now where for a model car DC motor, one 2 output driver IC was used,
and one drive 3 parallel MOSFET ( 150A range types ) without cooler,
and the other drive 2 parallel MOSFET for breaking ( slow down ).
But the concept of parallel uncooled MOSFET i not fully understand.

now working still on 5VDC from USB.. Arduino and use only about 16mA LED current (pulses)
now i would need to power up.

As long the GND between the 2 power systems is connected i could use the scope
also on the 12VDC level when i make new voltage divider.
with the prim range 3v3 ( MAX32 board ) and 10k-10k voltage divider, a 2 / 1 "probe" range is 6v6.
now with 10k-1k its a 11 /1 "probe" and range is 36V3.
i change all 3 resistors ( to avoid confusion ) and its one of the rare situations where i power all off.
mostly i change parts and wires on breadboard under HOT condition.
and now play in PMS3 with zoom range buttons, like 1,5,10,20 give 5, 1, 0.5, 0.25 V/DIV

with PWM i can adjust 3 .. 77mA with 2.8V over the power LED, and on
- A2 opto input,
- A0 opto output,
- A1 Drain / LED output. ( all on 5V/DIV )

test with variable puls frequency show me good operation at 7700Hz, but there arduino can not have a resolution on the PWM in that base frequency.

changing the RL from 100 to 4*||100ohm is 25ohm give me 250mA at max,
still with the uncooled MOSFET only "hand warm",
( of possible ?350mA? i do not have a datasheet or type info of the LED ).
But this way can not work any longer, after every test must wait 1 min to see again, LED just too bright.
And with a switching power supply 12VDC, 20ADC i could do a lot more, i just need a REAL LOAD.
somehow i want to burn 200W.
But that is not so easy, resistors and wattage...
i lucky found one 3ohm 50W resistor i could possibly use ( 12 V, 4A, 48W )
but here i do not understand the datasheet info,
does it mean the 50W ( print on resistor ) work only with a additional 535cm2 / 1mm thick heatsink? and without it could do only 14W?? example datasheet
The nice white ceramic resistors 1 ohm, 5 W.. all useless.
( example, 3 * 5W resistors with each 3ohm in series would give 1.3A and 16W /
and then use 13 of that combinations to get 200W )
so i would better order the good ones: 0.75ohm, 240W, 25USD
but for a short test i think more of using a long small wire as resistor,
what i have here? a 5m , 4 wire telefon cable, single core copper, AWG24 print on the outer PVC.
in serial i would have 20m , 0.2mm2, 1.8ohm >> 6.6A at 80W heat. i could even throw it in a bucket with water for cooling the plastic isolation.
I tested with that, but started carefully, outside on a stone floor, first both resistors in serial to verify that numbers. Add i used a shunt for continuously measuring the current.
i could verify 3ohm for the resistor and 1.7ohm for the wire.
Using only the shunt and the wire worked, but not well.
the current started at 6.2A, and reduced down to 5.09A and stabilized at 5.26A ( 10min)
But the PS volt was only 10.8VDC. With that the wire 2.05 ohm and back to wire ohm calc fits with 60degC for the cooper, small plastic smelling and cable too hot for touching.
the wire as resistor idea is limited, but first must care for cooling.
to keep the 4 wires inside a PVC isolation was wrong .. and dangerous.

Next i could try a perfect adjustable load resistor we all have at home,
take that bucket of water and stick 2 wires in for electrolysis,
do it only outside, dangerous explosive gases are created,
the copper at PLUS is dissolving in progress but could use other anodes,
from also dissolving carbon electrode ( plus pole of a old alkaline battery ) to platin...
i say adjustable: use salt to adjust the current!
Now that was a nice little experiment,
- 12V , 20A SWPS
- shunt
- old (steel) spray bottle as water container AND CATHODE ( 0.6L drinking water)
- small anode material centered

But again, i am far away from the 15 .. 20 A i wanted a TEST LOAD for.

now, all that ideas are valid ( for short term tests ) but not very GREEN
instead to burn the 200W i could try to store them? load a car battery?
It could work if the battery is very empty and my 12VDC switching power supply can be adjusted
a little bit UP ( reached 13.57VDC (at 6A)) .
Because the hardware i am just building here is like a PWM battery loading controller???
But the battery being on the high side with the power supply, how to read its volt / loading status?

But there is a better way to transport the information about current back from a isolated secondary side to primary side, by a HALL sensor!

like the +-200A a Current Sensor: ACS754SCB-200
here the prim and sec side are also isolated like with a opto ( 3kV )
and with a 5VDC supply gives a output of (Vcc/2) 2v5 +- 10mV/A
what with the 1023 analog resolution and 5V would allow us to read 0.5A
( and again like with the arduino Ain, the bad USB Vcc will kill us )
so the range fits to the L2203N max 116A MOSFET but with the max working range i have here, i will not see much.
Found a 50A type ACS754LCB-050-PFF with 40mV/A.
There are smaller ranges like 5 .. 20A, but that are all SMDs.
Anyhow we are close to the real world, where i try to measure 1A AC or up to 20A DC with a clamp amp meter ( that is a HALL sensor device ) having a range of 400 .. 600A,
but there i could use my trick to use ( grab ) N loops of the current wire in the clamp, to increase the resolution, but that's here not possible.

new circuit including HALL sensor,
Pin 1: VCC, Pin 2: GND, Pin 3: VOUT, Terminal 4: IP+, Terminal 5: IP–
just for development still on breadboard, but for higher current need to solder a prototype.

but with my current of 250mA not see a signal (left) ,
without the capacitor ( right) you could guess one.


but what i expect from that kind of setup? pls see my very spec. HALL sensor wiring technique "rubbersoldering" note: the color coding of the rubber is correct.


next step here