Flex+Scicos+Erika !!!

Forum related to the FLEX boards

Moderator: paolo.gai

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Wed May 21, 2008 11:03 am

So you want an active low PWM? I mean, when the PWM is high you want that the diode is in off state and when the PWM is low you want that the diode is emitting.

Unfortunately you can not drive directly the diode from the dsPIC. This is dangerous because the maximum current that you can source or drain from a dsPIC pin is 4mA.

Check the fet transistor at
http://it.rs-online.com/web/search/sear ... &R=6362821

This fast enough (I think).J175 p channel. In this case when the Vgs is high (3.3V) the transistor is off.

Francesco.

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Wed May 21, 2008 11:29 am

[img width=400]http://www.erika.tuxfamily.org/images/f ... 4ae02c.png[/img]

So you want an active low PWM? I mean, when the PWM is high you want that the diode is in off state and when the PWM is low you want that the diode is emitting.

Correct. But if you see tha figure now you\'ll understand why. Let me explain : PWM = 3.3V = ON, the left led if OFF so the right led is OFF and the Vout (after the optocoupler) is ON = 5V; PWM = 0V = OFF, the left led if ON so the right led is ON and the Vout (after the optocoupler) is OFF = 0V. This configuration let me have the same PWM generated with the dsPIC after the optocoupler but with different voltage. Using your configuration I\'ll have a different PWM after the optocoupler (negate one). What do you think about that ? How did you manage when you solved this problems ?

Unfortunately you can not drive directly the diode from the dsPIC. This is dangerous because the maximum current that you can source or drain from a dsPIC pin is 4mA.

I thoght was 25mA, but I\'m wrong than I\'ll change configuration.

This fast enough (I think).J175 p channel. In this case when the Vgs is high (3.3V) the transistor is off.

I\'ll check.
Attachments
opto-ae0343d2a786f56558da0d44a34ae02c.png
opto-ae0343d2a786f56558da0d44a34ae02c.png (20 KiB) Viewed 4380 times

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Wed May 21, 2008 12:59 pm

Ok, with a p-channel fet you will obtain extactly what you want. In the diagram with the bjt you can substitute the bjt with the p-channel fet (with a lowest resistance). In this case when the PWM is high the fet is like an open circuit and the optocoupler led will be off, the optocoupler output will be +5V. When the gate voltage is 0V, the optocoupler diode will be on (the fet is like a short circuit) and the optocoupler output will be at 0V

desmomito
Newbie
Posts: 27
Joined: Wed Mar 05, 2008 4:03 pm

Re:Flex+Scicos+Erika !!!

Post by desmomito » Wed May 21, 2008 3:38 pm

OK,
thank you very much for your availability. I\'m asking to myself if it\'s strange what I\'m trying to do. What do you think ? How would you use PWM and optoisolator ? Do you have any links where I can learn more ?


Thank you,
Pasquale.

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Thu May 22, 2008 9:36 am

Ciao,

Unfortunately this is the correct use of optoisolator, a safer approach. The use of transistors is quite regular in this applications. You have to consider that voltage isolation is a critical issue.

You can still use the optocoupler led drive circuit that I sent to you (the last picture that I uploaded). You can change the optocoupler output stage connection. See the image attached. In this case we have a pull-up connection. When the pwm is high the optocoupler transistor is on and the V_out will be +5V. In your connection if the optocoupler transistor is on will pull-down the V_out.

If you search in internet you can find lots of info (i.e. http://www1.jaycar.com.au/images_uploaded/optocoup.pdf )

Francesco. [img width=211]http://www.erika.tuxfamily.org/images/f ... pullup.png[/img]
Attachments
pullup.png
pullup.png (20 KiB) Viewed 4380 times

francesco
Newbie
Posts: 18
Joined: Mon Mar 03, 2008 1:07 pm

Re:Flex+Scicos+Erika !!!

Post by francesco » Thu May 22, 2008 9:51 am

Sorry,

just a remark on your schematic and my last message.

Try to remove the R2 in your schematic and link the pin 6 (optocoupler) directly to +5V. Link pin 5 to a resistance that goes to gnd (you can simply move R2 from the collector to the emitter). Than the V_out (pwm output) will be pin 5. Make some trials to find the optimal emitter resistance.

Francesco.

Locked