Protect PWM Output - how do it properly

Hi.

I wonder how to protect a PWM output from arduino.

this is my setup:

Arduino PWM output that controls a PWM dimmable LED driver.

i tried to protect PWM output with a Photocoupler, and a transistor. i'm unsure how to do this properly.

this is my circuit:

i have tested this, and it works. but i get 5 point somthing volts to the PWM Dimmer.
The PWM input is raited 2 - 10 Volt. is it posible to use 10 volt instead of 5 on the transistor to get closer to 10 volt?

it's around 80M of cable from Arudino to the dimmer.

hope someone can point me in the right direction.

Thanks.

By using the same ground each side of the optio isolator you are negating the isolation advantage you get from using one.

The PWM input is raited 2 - 10 Volt. is it posible to use 10 volt instead of 5 on the transistor to get closer to 10 volt?

Yes

Your solution is overkill.

All you need is:

Look at AOI514 for the MOSFET as an example of a Logic Level (gate), low Rds N-channel MOSFET

In this case "circuit being controlled" is just a 1K resistor, and the top pin of the MOSFET (the Drain) is the control signal to your device. The output is flipped from the input, as a High into the Gate yields a Low output (and a Low in yields High out).
analogWrite(pwmPin, 1); will yield the widest High pulse to the device, 0 being full high
analogWrite (pwmPin, 254); will yield the narrowest High pulse to the device, 255 being full low

CrossRoads:
Look at AOI514 for the MOSFET as an example of a Logic Level (gate), low Rds N-channel MOSFET
AOI514 Alpha & Omega Semiconductor Inc. | Discrete Semiconductor Products | DigiKey
In this case "circuit being controlled" is just a 1K resistor, and the top pin of the MOSFET (the Drain) is the control signal to your device. The output is flipped from the input, as a High into the Gate yields a Low output (and a Low in yields High out).
analogWrite(pwmPin, 1); will yield the widest High pulse to the device, 0 being full high
analogWrite (pwmPin, 254); will yield the narrowest High pulse to the device, 255 being full low

I'm Gonna look at that. i ously never used a MOSFET before. so this is a new experience.
Thanks!

pwillard:
Your solution is overkill.

how come?
can you explain it for me. This is kinda new to me. (=
Thanks.

Even a Mosfet is overkill here if it's a simple control input. A BJT will do as good here and is still cheaper. Especially you don't need al that low Ron nonsense for a control pin.

but NOTE: this will NOT give you a 2V-10V signal! If you have a led driver that needs 2V-10V to dim you need to filter it.

According to the datasheet (as I read it, it is a bit funny), the LDB senses high starting from 2V and the input should be high impedance. So neither a resistor nor a transistor should be necessary? AFAIR, I am driving an LDB-300 from an ESP8266 with just a directly connected wire.

Check attached. This is working well with my Arduino wind MPPT. First I made my wind MPPT with UNO and then used Mini Pro.

FET with optocoupler.jpg

Ah, yes. Missed the driver type, it's only in the schematic. It's indeed a normal PWM pin. Then indeed, just connect the PWM pin of the Arduino to the dimming pin of the LDB-300 :slight_smile: Don't forget to connect the grounds if you use different power supplies for the leds and the Arduino.

Taffen:
I wonder how to protect a PWM output from arduino.

You cannot "protect" things in an abstract, generic way like that. You must always know the list of dangers that you are protecting from.

So what did you think you needed to protect this output from? Overcurrent? High voltage? Cosmic rays? Economic depression? The Second Coming of Christ?

Without that info, everyone's replies were a meaningless waste of time for them to write and us to read.

According to the datasheet (as I read it, it is a bit funny), the LDB senses high starting from 2V and the input should be high impedance. So neither a resistor nor a transistor should be necessary? AFAIR, I am driving an LDB-300 from an ESP8266 with just a directly connected wire.

Datasheet says the max PWM signal current is 1 mA. Can an ESP pin supply that much current? I don't know, I don't have a datasheet for it.

it's around 80M of cable from Arudino to the dimmer.

This could be an issue.

Due to the long cable length, I think opto-isolation is essential, so I do like your original circuit. The opto-isolation will not only provide protection from interference, noise, spikes ... it will eliminate any grounding problems due to the long cable length. Also, the saturation voltage of the PC817 is only 0.1 to 0.2V, which is great because the LDB-L driver needs the PWM to go <= 0.5V when low.

If you would like to simplify, I would think you could eliminate the 2N2222 and R3. Then change R2 to 2.2K to provide more signal strength. Could connect R2 to 10V to get increased PWM voltage swing.

An opto might indeed be the best solution when LED driver and controller are that far apart (and on different supplies).

Maybe not needed to use any pull up resistor on the collector of the opto transistor.
Drivers like that usually have an inbuild (50-200K) pull up resistor (not listed in the LDB-350 datasheet).
Just connect emitter to LED driver ground, and collector to PWM input.
Opto must be used near the LED driver, due to cable capacitance and hum pickup.
Leo..