I will make an aquarium light system. I use power leds and Meanwell LCM25 Driver. So this driver wants 0-10V PWM signal. But our Arduino has an 0-5V PWM Signal.
I found some solution for this purpose. First one:
1 CNY75 optocoupler and BD137. I purchase these materials, but it didn't work as I want. If I set PWM 0, Output is 3.6-4V. If PWM is 1, output is 6V. If PWM is 2, output 9V etc.
I want to use Optocoupler for its isolation. I don't want to destroy my Arduino.
Second one, Mike's solution:
*) Is this solution is safe to use like optocoupler circuit?
*) I have some BC547 and BC557. But this circuit has BC183. Can I use BC547 instead of BC183?
*) I have 560 Ohm, but didn't have 680 Ohm and didn't find it. Can I use this resistor for this solution?
The second circuit is safe, as far as an Arduino is concerned. You shouldn't need the 680 ohm resistor or the 1uF capacitor, either. The LCM25 is designed to take a normal PWM signal between Dim- and Dim+. Nothing is mentioned in the datasheet about the input resistance between the "Dim" inputs, but it could probably be done with a BC547. (A BC547 has the same collector current rating as a BC183 - 100mA.)
The problem might be your 12V supply. The recommended PWM signal for that unit is 10V as you mentioned, and not 12V. A crude way to limit the voltage would be 3 x 1N400x diodes,(or a single LED with a Vf of about 2V), with the "Dim+" output being taken from the bottom of the diodes/LED, (and "Dim-" from the transistor's emitter/ground, of course).
Thanks OldSteve and JohnLincoln. I have one more question.
I made this circuit, and I see 0-12V PWM. This is good. Problem:
When I set PWM to 255, at first, output is 12V then 0Volt. One more example, when I set 245, at first Output is 12Volt, then Voltage reduces.
Every PWM set, at first voltage peak to 12V, then reduces correct level. So my Power Led system flashed to max level at first, and then reduces brightness.
kursatufuk:
I found some solution for this purpose. First one:
1 CNY75 optocoupler and BD137. I purchase these materials, but it didn't work as I want. If I set PWM 0, Output is 3.6-4V. If PWM is 1, output is 6V. If PWM is 2, output 9V etc.
This will conform to your expectation (where the output is full on when PWM is 255):
My "suggested" lower resistance values there are, maybe, a little too low. 5K.
Did you wire the input as my circuit shows, with the CNY and resistor between +5 and Pin9 ?
My redrawn circuit is like yours in that the load (shown as a fan) is between +12 and the collector.
When you refer to "output voltage", where are you measuring?
A) Across the fan
or
B) across the transistor (V_ce)?
Disconnect the CNY from Pin9
Connect the CNY cathode to Ground and measure the output voltage.
Vout = ____ ?
Then Connect the CNY cathode to +5 and measure the output voltage.
Vout = ____ ?
Voltage is going up as PWM goes up [good], but doesn't go to 0 [not so good.]
So, is the phototransistor under-driven?
Try a lower value on the CNY (550 ohms change to 220 ohms).
When Pin9 is LOW, the IRED is full on, so then the phototransistor should be on, taking the base to ground, turning the output transistor off. And vice versa.
Not possible.
You said before that with PWM 0 (mostly at Gnd) the output was 3V and with PWM 255 (mostly +5) the output was 12V.
Can you substitute an LED and a 1k resistor for the load (don't use the meanwell, in other words) for experimentation?
I could propose an emitter follower version of the circuit, in case one end of the meanwell is supposed to be ground referenced, but the disparity in results (Reply6 vs Reply12) leaves me concerned.
You might be overthinking this.
It seems the dimmer has an inbuild pullup to an internal supply.
Because when you leave the Dim pin "open", LED current is max.
Try an opto.
Opto transistor across the Dim+/- pins.
And opto LED via a 1k current limiting resistor to Arduino.
Leo..
If my first post's second circuit is safe, I can use it. (I don't want to destroy my Arduino board) It works, I see 0-12V PWM. But it has a peak problem.
kursatufuk:
Hi Wawa thanks but some question marks...
Where will I connect the 12V DC?
You don't.
The LED driver already provides that voltage.
You don't have to convert Arduino PWM to voltage, and feed a voltage into the LED driver.
Just leave it as PWM.
Just try.
Connect the opto transistor collector to Dim+, and the opto transistor emitter to Dim-.
Opto LED cathode to Arduino ground, and opto anode via a 1k current limiting resistor to an Arduino PWM pin.
Draw a diagram, and post if for approval if you're not sure.
Wawa:
You don't.
The LED driver already provides that voltage.
You don't have to convert Arduino PWM to voltage, and feed a voltage into the LED driver.
Just leave it as PWM.
Just try.
Connect the opto transistor collector to Dim+, and the opto transistor emitter to Dim-.
Opto LED cathode to Arduino ground, and opto anode via a 1k current limiting resistor to an Arduino PWM pin.
Draw a diagram, and post if for approval if you're not sure.
The IDE has some LED fade examples.
Leo..
Wawa, you you you you you are my hero.
Now my PWM is 0-10V really? Is this simple like this? Wow...
Edit: I control with Voltmeter, between Opto Emiter and Collector. 0-8V. This is good. But why not 0-10V?
Ok ok, I tested the Power Led's brightness (First Opto Dim with full PWM, then without dim) and these two brightness was same. Opto provide 0-10V PWM. Yeah, many many thanks Wawa.