Using 0-5VDC with n-channel mosfet for PWM on 12VDC

Thread Starter

jnobits

Joined Mar 7, 2019
23
Hey @MrSoftware, mine can output 0-5. It has a dedicated 5v and a dedicated 3.3v pin. All digital pins can output between 0-5v. It's the Arduino Uno Rev3. See my last post...given my attemps have failed so far, my next goal is to see if i can use a signal genrator for PWM (found some on amazon and ebay that are small enough and can generate the signal i need). But i'll have to be able to switch the source of the light to be either the signal coming from the PWM generator or straight from power supply + (when I don't want PWM). I'm not sure if that is possible.


At first glance, the spec says "Very Low RDS(on) at 4.5V VGS", which tells me the gate needs at least 4.5v to be considered fully-on. Some arduinos are 3.3v output and some 5v, are you sure yours is 5V?

Voltage is relative, so your scope ground must be connected to what you consider to be 0V for your circuit, such as - on your power supply. Else your readings will be meaningless. Put the probe on the drain of your mosfet. You're looking for the voltage at the drain to be 12v when the mosfet is off, and near 0v when the mosfet is fully on. If you see almost 0V when the mosfet is on, then that means it's fully on and working properly. You can put your second probe (other scope channel) on the mosfet gate to see both signals at once.

While in some cases it may be possible to connect the ground clip and probe across the load to measure voltage across the load, you have to be very careful about where you attach the scope ground clip. If your power supply is not isolated from the oscilloscope ground (wall outlet) then clipping the ground clip to a non-0V location would cause a direct short to ground through your oscilloscope ground, which rarely ends well.

Edit --> To answer your Vgth question; the threshold voltage is the gate voltage where it just begins to conduct, usually specified when there is a very tiny current through the mosfet. It does not tell you where the fet is fully-on.
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
Was thinking of using a relay and tying A to NO and B to NC but not confident if that would be appropriate
 

MrSoftware

Joined Oct 29, 2013
1,865
It seems like you're super close with the mosfet. Is the light dimmer than it was with the original supply, or are you going entirely by your measurements?
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
The light is dimmer and it has a internal board (that I don't know much about) in it that fires two different types of signals based on PWM or no PWM. The main reason i can't proceed with what i have is because even though the light is bright enough to look the same when not placed next to a light being run by the original source, when it comes on it doesn't fire the blinking sequence. That may be due to not reaching the right amplitude, it's hard to be sure.

It seems like you're super close with the mosfet. Is the light dimmer than it was with the original supply, or are you going entirely by your measurements?
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
hey @ericgibbs, I'm still trying to understand it. Here's what I have so far:
  • constant +5vdc to a 1k ohm resistor to MOSFET (G)ate, (not sure about PULSE(...)).
  • pwm signal to diode to gate, (not sure about PWL(...))
  • gate to 47K ohm resistor to gnd(-)
  • MOSFET (D)rain to 100 ohm resistor to Lamp gnd(-), and +12VDC to + on Lamp
  • MOSFET (S)ource to -12VDC
  • 0 overrides PWM, i think means when Arduino signal pin is low, light should be on and get full voltage coming from +12VDC supply (based on chart)
  • and if Arduino signal pin is high, light should be off (based on chart)
  • and when Arduino signal is PWM, the light should get corresponding PWM.
 

ericgibbs

Joined Jan 29, 2010
10,493
hi,
  • constant +5vdc to a 1k ohm resistor to MOSFET (G)ate, (not sure about PULSE(...)).
  • the +5v is the Logic and MCU supply

  • pwm signal to diode to gate, (not sure about PWL(...))
  • PWL is a LTSpice command for the simulation ONLY

  • gate to 47K ohm resistor to gnd(-)
  • prevents the Gate floating

  • MOSFET (D)rain to 100 ohm resistor to Lamp gnd(-), and +12VDC to + on Lamp
  • That 100R simulates your lamp, Use your lamp load

  • MOSFET (S)ource to -12VDC
  • The Source goes to a 12V supply via the 100R dummy lamp load

  • 0 overrides PWM, i think means when Arduino signal pin is low, light should be on and get full voltage coming from +12VDC supply (based on chart)
  • Yes
  • and if Arduino signal pin is high, light should be off (based on chart)
  • Yes, IF the PWM is not running

  • and when Arduino signal is PWM, the light should get corresponding PWM.
  • YES
If you post the actual details of the lamp load and voltage I will recheck the simulation
E
 

djsfantasi

Joined Apr 11, 2010
6,719
That Adafruit MOSFET may not work for you. Voltage from a pi may actually be less than 5V (I’ve seen as low as 4.6V). This maybe insufficient to provide the Vgs for the Adafruit MOSFET. The logic level MOSFETs only need around 2.3V (check the datasheets).

As others have noted, you need specifically a “logic level n-channel MOSFET”. Here’s a page of them offered through Amazon.

https://www.amazon.com/s?k=logic+level+n-channel+mosfets&crid=1VR6QJD6R08Y5&sprefix=logic+level+n-channe&ref=nb_sb_ss_i_0_20

I can guarantee that these will turn on with an Arduino. Use a logic level MOSFET for your application.
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
That Adafruit MOSFET may not work for you. Voltage from a pi may actually be less than 5V (I’ve seen as low as 4.6V). This maybe insufficient to provide the Vgs for the Adafruit MOSFET. The logic level MOSFETs only need around 2.3V (check the datasheets).

As others have noted, you need specifically a “logic level n-channel MOSFET”. Here’s a page of them offered through Amazon.

I can guarantee that these will turn on with an Arduino. Use a logic level MOSFET for your application.
Hello @djsfantasi,
  • Correct, on Arduino is not exactly 5v. Dedicated +5 on mine is 4.95VDC, Dedicated 3.3 on mine is 3.313VDC. The digital pin HIGH on mine measures 4.95VDC. I'm going to test the circuit posted soon to see how it work.
  • Are you saying the MOSFET I posted part numbers and datasheet for in this thread is not a logic level n-channel MOSFET?
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
Thanks, i'm going to try the circuit today. As mentioned in prev post, my voltages are not exactly 5v measured. I'll also try get the AMPs for the light.

hi,
  • constant +5vdc to a 1k ohm resistor to MOSFET (G)ate, (not sure about PULSE(...)).
  • the +5v is the Logic and MCU supply

  • pwm signal to diode to gate, (not sure about PWL(...))
  • PWL is a LTSpice command for the simulation ONLY

  • gate to 47K ohm resistor to gnd(-)
  • prevents the Gate floating

  • MOSFET (D)rain to 100 ohm resistor to Lamp gnd(-), and +12VDC to + on Lamp
  • That 100R simulates your lamp, Use your lamp load

  • MOSFET (S)ource to -12VDC
  • The Source goes to a 12V supply via the 100R dummy lamp load

  • 0 overrides PWM, i think means when Arduino signal pin is low, light should be on and get full voltage coming from +12VDC supply (based on chart)
  • Yes
  • and if Arduino signal pin is high, light should be off (based on chart)
  • Yes, IF the PWM is not running

  • and when Arduino signal is PWM, the light should get corresponding PWM.
  • YES
If you post the actual details of the lamp load and voltage I will recheck the simulation
E
 

djsfantasi

Joined Apr 11, 2010
6,719
I went back and reviewed the MOSFET you’ve described. It is indeed a logic level MOSFET.

I turns on at 4.7Vgs. However, there are others which a much lower threshold. The first one in the link turns on at 2.7V, two volts lower. The Mosfets I use with the Arduinos have this lower spec.

Your mileage may vary.
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
I went back and reviewed the MOSFET you’ve described. It is indeed a logic level MOSFET.

I turns on at 4.7Vgs. However, there are others which a much lower threshold. The first one in the link turns on at 2.7V, two volts lower. The Mosfets I use with the Arduinos have this lower spec.

Your mileage may vary.
Hey @djsfantasi, I'm having trouble finding a datasheet to support 2.7v for 4 Pcs IRL7833 IRL7833PBF N Channel 30V 150A Power MOSFET TO-220AB. I see where a user said it in a product review. Maybe I'm getting ref confused when looking where it says "Very Low RDS(on) at 4.5V Vgs" as a reference since both have that statement. When i look at the datasheet for IRL7833, page 3 Drain to Source Current to VDS, I see bottom at 2.7V but if I compare the same figure to the the datasheet for IRLB8721PbF I have, mine is 3V. So it's lower but by only 0.3V if I'm looking at the right values. I do intend on ordering some to try.
 

djsfantasi

Joined Apr 11, 2010
6,719
Hello,
I've been stumped by a project because of a lack of understanding. I need to use an Arduino (because it's controlling a lot of other related stuff and has available outputs) to do pulse width modulation on 12VDC. I looked up solid state relays and could not find anything that had a control voltage of 0-5VDC and could switch up to 15VDC. Then i looked up mosfets and found some post showing using n-channel mosfets to do PWM but on smaller voltage. I purchased some n-channel mosfets and when I generate PWM from the Arduino, i get the correct frequency and duty cycle but wrong amplitude. This is using a single mosfet with arduino to signal, 12+ to source, and drain going to +12 side of load and -12 side of load going back to -12 on power supply. I think I have it hooked up wrong, but at the same time, i think the circuit is wrong.

Here is my goal:
Use Arduino 0-5V to generate a PWM signal (done, verified with oscilloscope)
apply that signal to a SSR or circuit that will:
-send a steady +12 volts when the signal (from arduino pin x) is just on (+5VDC)
-send 0VDC when the signal (from arduino pin x) is 0VDC
-PWM on the +12VDC when the signal (from arduino pin x) is PWM (generate the same PWM)

I don't understand circuits enough and its been so many years that I don't remember my options or how to complete this after my first attempt failed. Last night I tried to make a circuit in autodesk eagle free and could not get the mosfet to map so I could simulate the signal and test.

Any ideas on how i can complete this using mosfets? Or if there is a relay I can buy that can be used to send/mirror the 0-5VDC signal on 12VDC?
Are the Arduino and load grounds connected? Note that there may be an issue here, because the load is connected to -12v, not ground. Also you are attempting to switch 24V, not 12.

It is really hard to envision, as the closest thing to a schematic we have, is a sketch which we know is wrong.


For example, in your description, the load had 24V across it. (+12 to -12 is 24. 24 = +12 - (-12) = 12 + 12

But your sketch may be interpreted that you have labeled ground as -12V. Ground is very different than -12V, as the math I presented above shows. In your description, ground would be the midpoint between +12Vand -12V, or 0V.

Maybe there is some confusion here. But the language of electronics is very specific.

Can you supply another diagram, which corrects the original issues and clarifies the voltage supplied by the power source?
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
@ericgibbs, I'm still not sure i have this hooked up correctly looking at the schematic with simulation data I'm having trouble following.

  • constant +5vdc to a 1k ohm resistor to MOSFET (G)ate, (not sure about PULSE(...)).
  • the +5v is the Logic and MCU supply
So when hooking up, i can disregard this since 0-5V is coming from Arduino PWM pin?
  • MOSFET (S)ource to -12VDC
  • The Source goes to a 12V supply via the 100R dummy lamp load
So with that MOSFET (S)ource goes to 12v+ or 12- on my custom lamp light?
  • MOSFET (D)rain to 100 ohm resistor to Lamp gnd(-), and +12VDC to + on Lamp
  • That 100R simulates your lamp, Use your lamp load
So connect MOSFET (D)rain to negative part of lamp light and +12VDC to (...i'm not sure)?

Do i need to connect anything to GND on arduino?


hi,
  • constant +5vdc to a 1k ohm resistor to MOSFET (G)ate, (not sure about PULSE(...)).
  • the +5v is the Logic and MCU supply

  • pwm signal to diode to gate, (not sure about PWL(...))
  • PWL is a LTSpice command for the simulation ONLY

  • gate to 47K ohm resistor to gnd(-)
  • prevents the Gate floating

  • MOSFET (D)rain to 100 ohm resistor to Lamp gnd(-), and +12VDC to + on Lamp
  • That 100R simulates your lamp, Use your lamp load

  • MOSFET (S)ource to -12VDC
  • The Source goes to a 12V supply via the 100R dummy lamp load

  • 0 overrides PWM, i think means when Arduino signal pin is low, light should be on and get full voltage coming from +12VDC supply (based on chart)
  • Yes
  • and if Arduino signal pin is high, light should be off (based on chart)
  • Yes, IF the PWM is not running

  • and when Arduino signal is PWM, the light should get corresponding PWM.
  • YES
If you post the actual details of the lamp load and voltage I will recheck the simulation
E
 

ericgibbs

Joined Jan 29, 2010
10,493
hi,
You should not use a term like -12V to indicate 0V or Common.
As I understand your project you are using +5V and +12V supply referenced to 0V.

So the MOSFET Source is connected to 0V [ Common]

If you post a diagram of your project, showing the power supplies and lamp load, I will confirm and add the symbols you need.

E
 

Thread Starter

jnobits

Joined Mar 7, 2019
23
hi,
You should not use a term like -12V to indicate 0V or Common.
As I understand your project you are using +5V and +12V supply referenced to 0V.

So the MOSFET Source is connected to 0V [ Common]

If you post a diagram of your project, showing the power supplies and lamp load, I will confirm and add the symbols you need.

E
I still haven't gotten far with schematic in online or desktop tool. For example I don't see a 12V supply and other things. Here is what i have.
 

Attachments

Thread Starter

jnobits

Joined Mar 7, 2019
23
Are the Arduino and load grounds connected? Note that there may be an issue here, because the load is connected to -12v, not ground. Also you are attempting to switch 24V, not 12.

It is really hard to envision, as the closest thing to a schematic we have, is a sketch which we know is wrong.


For example, in your description, the load had 24V across it. (+12 to -12 is 24. 24 = +12 - (-12) = 12 + 12

But your sketch may be interpreted that you have labeled ground as -12V. Ground is very different than -12V, as the math I presented above shows. In your description, ground would be the midpoint between +12Vand -12V, or 0V.

Maybe there is some confusion here. But the language of electronics is very specific.

Can you supply another diagram, which corrects the original issues and clarifies the voltage supplied by the power source?
I added another sketch (which needs work) but after page 1 of this thread, I'm working with connection based on betebo sketch and trying to modify to work based on this sketch.
 
Top