How to use a MOSFET to follow an input voltage

Hi there.

Newbie alert!

I've been trying to control the brightness of a lamp via a MOSFET connected to a DAC that is connected to my UNO. I have a sketch that generates a sine wave output on the DAC. This sine wave is connected to the gate of the MOSFET. The output voltage of the MOSFET is anything other than a sine wave it's turning on and off as the gate voltage crosses some threshold which seems to be about 1.5Vs. So the MOSFET seems to be acting more like a switch than a variable resistor in my circuit.

Watching a few vids on youtube where MOSFETS control the brightness of LEDS or the speed of a motor I was led to believe that the output voltage of the MOSFET would reflect the varying input voltage on the gate.

The MOSFET is an IRF520 module.

What am I doing wrong.

Any help much appreciated.

John

the tutorials you watched were probably using PWM on the MOSFET

what kind of light bulb do you want to drive?

you can see how the drain to source or whatever element you want to influence in the datasheet : https://www.vishay.com/docs/91017/irf520.pdf

1 Like

Ultimately I wanted to control the voltage going to a small light panel which which doesn't seem to like PWM signals but now I'm really just interested in trying to get the output circuit voltage to reflect the drain voltage. Maybe a MOSFET is not suited to this and the switching behaviour I'm seeing is to be expected?

I will have a close look at the datasheet to see if I can better interpret what I'm seeing.

Yes looks like those examples where pushing PWM signals through the MOSFET, thanks for the tip. I can get a basic LED in the output circuit to follow the sine wave if I generate it on the PWM pins rather than the DAC output and feed that into the MOSFET.

In order to get a pure analog signal in the output circuit do you think a low pass filter in that circuit would do the job?

Thanks

John

It would first be interesting to understand what does your light panel expect? Constant voltage, limiting amps to drive brightness or will it turn on at any voltage?

That's a very good question. I'm exploring what this panel expects. At the moment it has a button you can touch and the brightness goes up and down but I want to do the same without having to touch it. Would you know how that button changes the brightness? I'm interested in how it migth have been implemented. I'm playing with changing the supply voltage in the hope it will have the same effect. It's certainly doesn't like PWM signals.

I've made some very exciting progress with the circuit. I'm new to electronics and have just added an RC low pass filters to the PWM output and have looked at the output with and without the filter by connecting it to A0 and passing the values to the PC for display.

This shows before and after the filter is added.

1 Like

Can you please complete your exploration, or else post some details of this mystery panel? It's frustrating to try to solve problems with unknown hardware.

Actually, the same problem exists with your MOSFET circuit... please post details of the module and a wiring diagram.

You did say,

What am I doing wrong.

Any help much appreciated.

implying that you were looking for assistance. But your actual problem, and your actual circuit, are not currently clear.

I think you meant IRL520 with logic level gate drive.

Not necessarily. There are modules on the market, that use the IRF520 but switch 12V, the gate drive is also 12V from a step up transistor.

The IRF520 has a threshold voltage of between 2-4V before it will conduct. It is possible to use it to follow an input sine wave, but you need to take care of two things:

  1. The input sine must be at least 4V
  2. Use a heatsink. FETs in the linear mode are essentially voltage-controlled resistors and they can get hot depending on how much power you're putting through them.

That said, I agree with the other posters that PWM is probably a better way to solve this.

We can speculate all day, it remains speculation as the target device is unknown, the exact reason why PWM didn't work remains unknown. A failure of an unknown experiment doesn't vindicate or rule out anything. It's far better to discuss a known, actual device and known, actual experiments and observation and measurements.

I see your gamble and it's well meaning, but the odds are not good. There is a lot of bad advice and cranky projects on the internet now, and that influences the questions we get. The assumption of normal practices has gone out the window.

https://www.amazon.co.uk/gp/product/B06XHH1TQM/ref=ppx_yo_dt_b_asin_title_o06_s00?ie=UTF8&psc=1

This shows my basic circuit before the MOSFET is connected. This shows the PWM output of PIN3 going to input A0 and the resulting time plot of a PWM form of the sine wave.

Again no MOSFET connected but PWM going into RC filter and smoothed o/p going in A0...

With this module, a wiring diagram as suggested by @anon57585045 would be nice.
You might want to experiment with the IRL520 as a discrete component.

Light panel I want to control shown in background. As a newbie the forum is only letting me attach one picture at a time!

image

This is what I was trying to do though I'm sure you guys can find a lot wrong with it. I've tried connecting the PWM from the UNO direct to the light panel and it only comes on when the duty cycle is 100% (255 sent to the pin). However the panel will light if I connect it to a steady 3.3v or 5v from the UNO.

A smoothed PWM signal does not appear to bring it on and the sine wave reduces and distorts with the light panel connected. I figured the UNO PWM pins do not provide enough power for it so I figured maybe a separate circuit connected via a MOSFET would work. This can be driven by the PWM (as I've discovered it won't reflect a varying smoothed signal but will switch on and off for PWM) and it's output can be smoothed with a low pass filter to get back to analog which I'm hoping the light panel will be happy with. This is an experiment and exploration as a new comer to electronics.

This is what happens when the light is connected. It doesn't come on...

You'll need to try a logic level MOSFET for this circuit. You probably need to buffer the RC filter to get sufficient signal to the LP. Need a link to the LP specifications. Need to know the component values for R and C. Need to know which pwm pin you are using (pins 5 and 6 are 980 Hz, pins 3, 9, 11 and 12 are 490 Hz).

1 Like

Have you tried measuring and/or scoping the signal from the manufacturers controller, to see how it is normally driven?