as I keep on working on a project I found out that actually dimming LEDs with PWM is not for me as I need to take pictures of them and the dimming would show in the final images.
Exposures are pretty long and dimming the LEDs throughout the whole exposure would end up having a series of dots instead of a constant, dimmed, line (LEDs are moved throught the exposure).
I was therefore thinking if there might be another way of dimming LEDs without using PWM but still controlling them with Arduino?
How many LEDs, how much current will be used?
The brightness of LEDs is controlled by the current. Somehow You need to control that current by an Arduino. It can likely be done.
I've taken a quick look around but all I can find are digital potentiometer which could handle only 5V.
Is there any model which is suitable for 12V (I have already all the LEDs cabled for 12V...)?
Also, how many Amps can let passing through the potentiometer?
What about using a capacitor parallel to your leds?
That should stop the flickering and drop the voltage to the average of the high and low time.
And if you got resistors in a row to the leds (i am pretty sure you have) droping the voltage automaticaly means that the current drops too.
I never tried this, but theoretically it should work.
(you may need to experiment a bit whith the sice of the capacitor)
I´m sorry for my poor spelling, but i´m not a native speaker...
Is there any model which is suitable for 12V (I have already all the LEDs cabled for 12V...)?
Also, how many Amps can let passing through the potentiometer?
That complicates things even more... I assume you have a MOSFET driver? A single transistor or MOSFET can "pass" PWM but it's not a linear amplifier.
Exposures are pretty long and dimming the LEDs throughout the whole exposure would end up having a series of dots instead of a constant, dimmed, line (LEDs are moved throught the exposure).
Not knowing your LED requirements I can only guess. You need an analog constant current source or sink, there are a lot of design available on the web. This is a simple example of a constant current sink. You could replace R with a pot or digital pot if you want, just be sure to limit the circuits minimum value.
You could arrange a transistor (bipolar or NFET) with:
a current sense resistor between the emitter/source and GND
the LED cathode on the collector/drain
the LED anode to VDD
The emitter side of the sense resistor goes to the '-' input of an opamp (e.g. LM324). The '+' side of the opamp goes to the output of a DAC (e.g. MCP4725 using Adafruit_MCP4725 library) -- either directly of through a voltage divider. The base/gate of the transistor is connected to the opamp output pin.
The general theory is that as current flows through the sense resistor, a voltage is developed across it and this is negative feedback to the opamp. When operating linearly, the opamp will always try to minimize the difference between the input pins '+' and '-'. So if you apply, say, 20mV to the '+' pin using the DAC, the opamp will drive the NPN so that the collector current produces a 20mV drop across the sense resistor.
If you had a 1-ohm resistor, then I = 20mV x 1-ohm == 20mA.
If you set the DAC to 30mV you would get 30mA and so on. You can dim by reducing the voltage output of the DAC.
An NFET based circuit might look like (stolen from the web):
The location of the 100mV tag is where you would connect the DAC. The sense resistor is 5-ohm in the image but you can choose whatever works for you. The additional components (R1, C1, R3) can help you tune the transient response and stability of the current source circuit.
gilshultz:
Not knowing your LED requirements I can only guess. You need an analog constant current source or sink, there are a lot of design available on the web. This is a simple example of a constant current sink. You could replace R with a pot or digital pot if you want, just be sure to limit the circuits minimum value.
The circuit does what Yoy say, but.....
The full LED current passes R2 which needs ti be a low Ohm type of several Watts.
The transistor T2 will get hot and needs real cooling.
Not usual programmable resistor will do as R2.
Ale_V:
I was therefore thinking if there might be another way of dimming LEDs without using PWM but still controlling them with Arduino?
Rough as guts idea but one could use say an LM317 with a bank of parallel resistors switched in via small relays, each giving a lower overall sense value and hense differing current levels.
Basic LM317 shown below......
Yes, I did think about that but then again, how many different lED light levels are actually seen by the human eye.
I guess it remains in the details that are not supplied.
bluejets:
Yes, I did think about that but then again, how many different lED light levels are actually seen by the human eye.
I guess it remains in the details that are not supplied.
I fully agree.
Raising the PWM frequency and extending the exposure time in the camera would be a solution without a lot of heating.
It is not OP's vision what is affected. It is a long exposition photo. We don't know how quickly is the LED moving and what is the resolution of the photo but I can imagine even a very high PWM frequency may be visible at some circumstances.
Of course the "right" solution to this is increasing PWM frequency to maximum and if it still does not help use a filter to smooth the current somehow. It is not difficult. There are so many options choosing the most suitable is the only difficult task - and we cannot help with this unless OP provides more information.
@smajdalf ok I'm making some (generally reasonable) assumptions; a 30fps video, even a fixed camera with a shutter speed of maybe 1/250 ( to give enough exposure to pick up leds) would be unlikely to show dots - and the rate COULD be higher, and a cap across the LED would smooth it out.
Ale_V: Exposures are pretty long and dimming the LEDs throughout the whole exposure would end up having a series of dots instead of a constant, dimmed, line (LEDs are moved throught the exposure).
Google "long exposure photo" for more examples. I have no idea how to make reasonable estimates but the LEDs need to blink several times in each pixel to get a smooth line. I guess the time to move from one pixel to another may be pretty short.