High Frequency PWM dimming of a non-5v Light

Hello everyone!

Intro:

This is my first post here, so please give me some grace if this is not formatted correctly. Around 10-15 years ago, I used to design and create things using the Arduino platform. However, I have not touched it since then. I know enough to maybe hold a surface level conversation, but I cannot efficient code and and would consider myself an intermediate when it comes to electrical understanding.

The Problem:

With that out of the way, here is my plan. I need to be able to drive either an EL Panel, or a 12v LED with some measure of software control. I am making a device know as a "Flat Panel" for Astrophotography and for that, I need to be able to dim a light to a very low state without any flicker. According to my research, a PWM frequency of 30kHz seems to be the sweet spot for the readout speed of the cameras we use.

I know there are some analog options, but ideally, if I can get the Arduino to work correctly I would like to create a GUI with the ability to save presets to repeatability, but also pay someone to integrate into the normal software that many of us in this hobby already use.

The Solution (kinda)

So here is where I need help. I know I need a mosfet transistor (N type I think) and maybe a resistor for said transistor. However, that is why my understanding stops. I believe using the Arduino Uno I can use one of the pins for a PWM frequency of 31kHz. However, I really do not understand what all I need to create this device. Ideally, I need to make 1 version that runs on 12v for a 12v device, but then I also need one to use with an EL Panel, but I am not sure how to even go about that.

Hopefully this is a good first topic. I am happy to answer any questions!

Hi @swordofdamocles

Welcome!

Could you please explain some more what exactly an "El panel" is? Specs or link or photo, etc. etc.

Is the 12V LED, a single LED?

Yes, you need an n-channel MOSFET hooked up like this (for 12V? LED):

Also, the transistor will need to be a logic level one, such as the STP90NF03L.

The standard PWM frequency on the Uno pins is 490hz (pins 5 and 6 are 980hz). But, good news, you can change the PWM frequency with some code.

void setup()
 {
    pinMode(3,155);
    TCCR2B = TCCR2B & B11111000 | B00000001; // for PWM frequency of 31372.55 Hz
}
void loop() 
{
    analogWrite(3,155);
    TCCR2B = TCCR2B & B11111000 | B00000001; // for PWM frequency of 31372.55 Hz
}

That code outputs a frequency of 31372.55Hz on pin D3 with a duty cycle of 155 (out of 255 total). Lots of helpful info for changing default PWM frequency on Arduino found here:

Hope this helps!

Thanks for all of that @kgray9!

So an EL Panel is an Electroluminescent Panel: 5 Inch UV Fade Resistant White Circle Electroluminescent (EL) Light Panel – Technolight

Basically, they are large single sources of light. The run at 100v, 400hz and using them I think complicates things a bit. As for the 12v other source, I am not super sure on that front. Basically, I need a large, very evenly lit surface to take a flat photo. Typically, people use several layers of diffusion and large iPad, or create a box that diffuses the light.

I have thought about using an array of LED's to create a light source, or maybe creating a source similar to a LCD's backlight. That part I am not certain of, but I am wanting it to be 12v since all of our equipment in the hobby is also 12v. Basically, I am wanting to control something like this:

I already own the above product, but it is only available in the EU and there are no cheap options stateside, so I want to create one. The problem is that I have no way to dim it. It uses LED's but I am unaware of the current draw as I have no means to control it fully yet. Below is a dimmer that works with it, but that also gives some good information on the kHz needed for no flicker.

this product fills the one of the rolls I need, but its only analog. I want to create something with software control. Essentially, I am using the panel and the dimmer (once it arrives) as a testing bed to create a software version. The panel runs on 12v so if I could get an Arduino to control it and allow it to be dimmed, that would allow for others to also control theirs. But as for whatever product I design, I am not sure what path is going to work best.

Thank you for the other information, I will look into that transistor but also what logic level means. I also want to research the Nano to see if it could control something like this. I did have a question on the duty cycle. With the 31kHz on D3 and a duty cycle of 155, does that mean I only have 155 level of brightness?

With the goal that these panels need to fill, the light will need to be very dim and it seems that most sources flicker when they get dim. That cannot be the case with this and I am worried 155 levels of control will not be finite enough.

EDIT: Also, would I need a mosfet gate drive for the one linked above? If so, how do I go about finding that.

You’re welcome!

Logic level means that the transistor is able to fully turn on (or close to fully turn on) with 5V or 3.3V on the gate(standard Arduino voltages).

The Nano would work also, as it is very similar to the Uno but quite a bit smaller.

Its kind of a “level of brightness”. The max is 255 and the minimum is 0. So that is how you would set the brightness, and 25hz or higher would prevent the flickering as your link said.

No, you wouldn’t need a MOSFET gate drive for the one I linked. That is the reason for a logic level MOSFET; you don’t need a gate drive and can instead run it directly from an Arduino.

You can add buttons and a LCD display to set preset settings or whatever if you wanted to get a little fancy :wink: .

1 Like

That is wonderful news to hear! So basically, I could run a Nano with a bit of code to run the dimming option at the 31 kHz but using the MOSFET you linked above to handle the 12v stuff! Feels like I am 15 years younger !

Do you know of a mosfet that could handle the voltages for the EL panel? I tried reading the technical information on the data sheets but I dont know which ones can switch fast enough and handle that voltage.

The last EL panel I saw used AC.

1 Like

Yeah, because the voltage is AC instead of DC, you would have to use two MOSFETs. Try searching “how to have a MOSFET switch AC voltage”. There’s lots of info on that.

Here is a suitable logic level MOSFET for the EL panel:

With a gate voltage of 5v, the IRF630 can switch loads that draw up to 11 amps.

Q: Can MOSFET switch AC?
A: “ Yes, but you need to connect two back to back to deal with the body diode. Connect the source terminals and gate terminals and connect a floating voltage supply between sources and gates. This circuit is typically called a solid state relay.”

Edit: it’s getting late so I’m going to bed :sleeping: . I’ll be back in the morning with some more info :wink: .

@Paul_KD7HB You might be right, it think it is AC. However, there might be a simple solution which is to use their supplied 12v inverter and just slap a zero to the pot thats on there and just use that for dimming control. That should work, for now.

@kgray9 I am going to place an order for several of the mostfets you have listed just to tinker around and see. Maybe some more people can chime in today. The next fun thing is going to be writing the code. It doesnt seem too hard, but it's gonna be interesting to try and relearn it all!

1 Like

Just give me a second. I'm trying something.

I personally have never had a use for a TRIAC or dimming a 120V light, so don't take my word on how exactly to do it. I did find this helpful site on dimming a 120VAC light using a TRIAC:

Note: a TRIAC is similar to a MOSFET, but allows current to flow in both directions.

I found a suitable TRIAC capable of 8A and 600V, that is also logic level:

EDIT: It might be just simpler to go with a 12V light. Or maybe you could make a panel with multiple lights, and place something over them to diffuse the light so it looks more like a light panel, instead of individual lights. Just a thought :wink: .

Yes but AC dimming using a Triac uses the AC - frequency as a frequency for dimming, which will be either 50Hz or 60Hz, which is way to slow for what you want.
If you really intent to dim a high voltage (medium actually but higher than Low-voltage) , you can consider to first convert the AC into DC first, and then just use a single mosfet to dim at the frequency you want.

1 Like

@swordofdamocles
Imagine my joy when I logged onto this forum to see if anyone had worked on a project like what I was contemplating only to find that you are doing the exact same thing!

I also have a Technolight panel and inverter and want to "automate" my flat field captures with it by controlling it with an Arduino and a software interface (to NINA in my case).

I found this thread - DIY Alnitak flat panel - ATM, Optics and DIY Forum - Cloudy Nights - where someone used some code that uses the Alnitak command set to control an LED flat panel.
I'm thinking that I can modify that code as needed once I put together the hardware necessary.

Where are you on your project? Mind sharing the latest?
You might need to talk slowly to me as this is my first foray into the Arduino world.

1 Like

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