How to use a MOSFET to follow an input voltage

Thanks for the schematic. However, it is lacking a lot of important information. There are no connection labels except for 5V and ground on the UNO. The values of the resistor and capacitor are not given.

Finally, the circuit is wrong for what you are trying to do. It pretends that the MOSFET module has a bipolar current output, it does not. That will not drive your LP filter correctly, or supply current to the load correctly.

The module you linked to, is the "cheapo" kind that lacks a driver transistor. So it can't work properly from only 5V, as the IRF520 is not a logic level MOSFET as has been pointed out.

Your circuit is completely inadequate for the purpose of supplying variable DC power which is what you say you need (although I'm skeptical about that). The reason is that a low pass filter like that one, can not drive a big load directly, it needs an additional amplifier stage after the filter, to provide a buffered DC output.

If you want a really simple circuit for that, you have to find a way to put the LP filter before the MOSFET in the circuit, not after.

Well, you shouldn't leap past this starting point. This is something that works. So you should also tell us a lot more about this mystery button and whatever it is attached to. But since you have it in front of you, you should also be investigating it.

The first step of a successful hack, is usually a lot of reverse engineering.

If you want to control with an analog signal, this is a good option:
image
Buffer amplifier, from wikipedia.

1 Like

Is this your light pad where each press of the power button gives an increasing level of brightness?

1 Like

Thanks for all the comments.

At the moment controlling the light panel has taken a back seat as I'm learning a lot on the way to attempting that.

At the moment my goal is to get the MOSFET output to reflect the input which is a PWM signal coming from PIN 3 of the UNO. The capacitor is a 10uF one. The resistor is 2KOhms. I just tried a few different ones and was amazed at the 'perfect' sine wave that resulted from this combination. The 5V is taken from the 5v power pin on the UNO. The gnd pin from the UNO is used as common earth. I also tried a 5v 2A power supply from the wall connected to the output circuit but to no avail.

I initially connected the LP filter before the MOSFET to the PIN 3's output and got a superb sine wave from the PWM signal. I also experimented with sparkfuns 12 bit DAC connected to the UNO which gave a superb sine wave from the PWM signal as well. Pluging these signals into the MOSFET gate showed me that the MOSFET was acting as a switch for the output circuit rather transferring the varying voltage forms so I decided to place the LP filter on the other side of the MOSFET to smooth out the transferred PWM signal.

However I'm getting nothing like the smoothing I got on the other side and I'm investigating whether the MOSFET is successfully transferring the PWM signal to the output circuit. Should it? I assume it should do as it appears to in the video that I mention below.

I'm basically modifying the approach shown in this video and using the same MOSFET module.

I'm not concerned about the light panel at the moment just learning more about, well everything really. :slight_smile:

The circuit he uses shown below is essentially what I've done although I'm keeping the power sources to 5v,I don't need the potentiometers and I need just one MOSFET. Oh and i'm experimenting with LP filtering!

Any guidance most welcome. I've no doubt the circuit is all wrong but I'm learning masses.

Sorry for not responding. Hit newby post limit yesterday.

Yes very similar, actual one is this.

Please post images and details of the panel and your connections to it. Reply #16 shows the panel, and some random probes. It's fuzzy and doesn't appear to show the actual electrical connnections, or how you have connected them.

At the moment, all we have to understand that, is a box in your diagram with two lines coming out of it. Obviously, that is not enough.

I'm really just repeating reply #7, you didn't ever respond meaningfully.

Thanks for your help.

I'm down some very deep rabbit holes looking into some of the suggestions here - buffering, op amps, Logic level MOSFETS etc etc. Getting the light panel connected is no longer the priority but I will return to it when I feel I'm ready to explore it a bit further.

The replies here have given me a lot to explore and think about and will no doubt raise further questions.

Thanks again.

1 Like

Exploration is really good, I commend you. But if you post the further questions here, please show us what you have done. The more details of that you provide, the more specific, relevant, and applicable the answers can be.

I think this is a bad tactic to solve your problem... in a couple of ways.

The device you are using has a threshold voltage of anywhere between 2 and 4 volts... It will probably switch, but the upper end (4V) could be questionable.

I pick these up from Mouser, I think for < $1 each, I usually get them by 10's and they are even lower cost. They are good for 600mA and will directly connect to your Arduino...

It has a gate threshold of 1.3v to 3V, so it should fully switch...


The other is that you are using a digital system, and are trying to convert it to an analog signal? In the end what are you actually trying to control and how much current is it going to require.?

These types of mosfet are really used as digital switches, not an analog device.

What analog voltage are you actually trying to follow?


To make that screen work like I think you are after, will require a 'finger' arm to physically push the button. Not too feasible... probably more so than figuring out the how the button on the screen is actually working.

What you need is a schematic and probably a guide on how to take it apart without breaking it :crazy_face: It probably controls the pwm of the screen 'enable' by the internal micro who 'read' the switch activation's. That's a guess and that's where you going to stay until you confirm some of these assumptions.


I use a photo transistor to 'read' the ambient light, do an a/d conversion and then control the common cathode (negative) of the display by a derived pwm... driving a mosfet... works well..

Screenshot from 2022-09-15 13-24-37

Capacitor/resistor slows the slew rate down so it's isn't a 'fast' response.


Hope i didn't miss something in this thread...

Interested in the final solution...

Good luck

:smiley_cat:

Thanks jkwilborn.

It's been a real adventure and education!

The buttons on the EL panel allow for 3 different levels of brightness rather than a continuous dimming so a finger arm arrangements might get to one of those levels but not those in between.

To give some background I'm an astrophotographer and one of the data calibration steps is to remove vignetting and other artefacts from the images caused by the optics. This is done by taking what we call 'flat' frames that are essentially exposures of uniform light that are subtracted from the actual image frames. These can be done by pointing the scope at the sky during twilight but most people now use the likes of EL screens for the purpose under programmatic control. Depending on the aperture size of the scope these can cost anything from about £150 upwards! So I figured I would build my own if I could get a cheap light panel and figure out a way to control it from an UNO.

Well since my last post I have played with various solutions. Forgetting about the problem of the switch on the panel I began to learn about basic electronics in general and how to control circuits that potentially require more power than than the UNO can chuck out. I played with the PWM pins connected directly to the panel via the supplied cable. I could turn the light on at 100% duty cycle but it would turn off at anything below that so I assumed it either didn't like PWM or the switch electronics was scuppering things!

Assuming it didn't like PWM I explored the possibility of supplying it with an analogue signal and put together a low pass RC filter. I also bought a USB oscilloscope so I could see what effect the filter was having on the PWM input. Amazed at how well that worked! I wrote a sketch to send a sin wave duty cycle to the PEM pin and observed that on one probe of the scope and the output of the filter on the other. After playing a bit with the R and C values I got the most perfect analogue sine wave! I know about Fourier analysis but seeing an application of it work so perfectly was awesome. I also bought a cheap DAC converter an MCP4725 to play with which gives 4096 levels as opposed to the 255 of the PWM output although 255 is more than I need for my purposes!

Plugging the analogue output of the filter into the panel did not solve the problem, the light would come on at max values but turn off at anything below that. So it clearly wasn't an issue with the panel not liking PWM.

I then figured I would explore powering the panel from a separate circuit that was turned on and off by the PWM signal from the UNO or the output of the low pass filter. This led me to sign up for a video course in basic electric theory so I explored Ohm law, Kirchoffs various laws, Equivalent circuits etc etc. Then I studied the transistor and played around with it acting as an amplifier and a switch. Then I figured I would try a cheap op amp so did a quick course in those and made a unity gain buffer, voltage follower using negative feedback to the op amp. Explored all sorts of things to do with op amps. Then I realised I had a number of Darlington chips lying around that where used to control a small motor and they had the necessary power and signal connections so I could use one of those to isolate and control the panel. At each stage I explored the various IV relations across the source and load circuits.

So I now had various ways I could control a load. Only problem was the 'load' still wouldn't play ball with that switch in the way. So I thought I would have a closer look at that and started to pull the back of the panel. This peeled away quite easily exposing the circuit of the dimmer which I'm guessing uses a capacitive touch pad alongside a PWM generator. Anyways the wires out to the LEDs were clear to see so I desoldered them from the dimmer circuit and connected them to my Darlington circuit. I played with both analogue and PWM signals from the UNO and both worked perfectly!!!! The brightness response was linear as well across the 0-255 range of first stage PWM. Awesome.

So i figured I would go back to stage one and see what happened if I connected the UNO PWM output (pin 6) direct to the panel circumventing the buffer circuit and that worked perfectly as well with apparently no overheating or any other side effects - I have the Uno connected to a 2A powered USB hub.

I have since done the same 'mod' to a second panel and have that running directly on pin 3 with no complaints from the UNO either. They are both controlled via ASCOM drivers - an observatory equipment control standard - that I have written.

So what a cracking journey I have had. I've learnt so much I'm glad I didn't just rip the back off at the beginning - although at that point I would have had no idea what I was looking at or why this might actually work.

John

1 Like

It's common to sense a switch by the micro then modify the pwm to reflect a 'change' in brightness... I do it on mine.

Glad you got it figured... most people are not willing to disassemble the equipment....

You should post a 'how to' for other astronomers.

Take care...

:smiley_cat:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.