my first post to the forum.
I am trying to get PWM through CNY17-3 optocoupler. Can someone tell what's the problem of my circuit. Is it saturation or what?
Should get about a 2.5V square wave? Voltage divider with 32K and 43K?
Imagecraft compiler user
What is your frequency ?
According to the datasheet the output transistor has a rise time of about 400us for a 30k load.
What's limiting the current out from the uP pin when it goes high? A better way to hook up that part of the circuit would be to connect the cathode of the optocoupler LED to the microprocessor pin, and drive the pin low when you want the LED to be on.
I hope your widget does not need to operate across a wide range of temperatures. Especially the LED is very temperature sensitive and this will change the current transfer ratio; net effect is the pulse shape at the receiving end will vary considerably with temperature.
You can partly optimize the LED drive current and the transistor load to minimize the effect. You don't want to drive the LED too hard or the transistor has trouble getting rid of the charge, too low and at higher temperature the CTO drops so much the signal can disappear completely.
I do not know know what the receiving end is going to do with the signal; if you only need to discriminate between two or three discrete duty cycles there's likely no problem; if you want to use it to generate an analogue voltage for example, I highly recommend to look for a much faster and better optocoupler.
You have connected it wrong.
When AVR output pin is low, it sinks 10mA and LED is off because it is shorted to ground.
When AVR output pin is high, there is nothing to limit current, and most likely you have blown the LED or AVR IO pin.
I believe you want the 330R resistor in series between AVR output pin and LED, not parallel to 3V3.
Thanks for your help.
Would 4n26 optocoupler be better than this CNY17-3?
Give us the Big Picture. You might not need the opto. What is it driving?
I am driving a FET. Opto is only for protect the uC.
Depends what kind of FET and what the FET is driving.
© 2020 Microchip Technology Inc.