Shop OBEX P1 Docs P2 Docs Learn Events
Using Optocouplers with Propeller — Parallax Forums

Using Optocouplers with Propeller

morris4019morris4019 Posts: 145
edited 2009-06-22 07:57 in Propeller 1
It has been suggested to me·many times to use optocouplers between the propeller and my L298. I have recently aquired some LOC112 from CLARE. I have the CLARE Datasheet for this item, but there is no application circuits and I'm not quite sure how these are connected in circuit. Has anyone used these 8 pin DIP Optocouplers, or know of a different datasheet for this item?

-Mike

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======

······ I'll try everything once [noparse]:)[/noparse]

Comments

  • LeonLeon Posts: 7,620
    edited 2009-06-22 00:41
    Those are linear optocouplers, I wouldn't use them in a digital application like yours. I've used a CN17-4 optocoupler between an MCU and a high-voltage circuit. A 4N25 is a similar device and very widely available.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 6/22/2009 12:47:42 AM GMT
  • localrogerlocalroger Posts: 3,452
    edited 2009-06-22 00:41
    Mike, I don't have the data sheet in front of me but I've used similar products many times. An optocoupler will have an LED on one side, which you drive like an LED, and a phototransistor on the other which you treat like an open collector output with a pullup resistor. It will also invert the signal. The prop shouldn't have any problem driving the LED as long as you use a suitable series resistor. In the absence of other docs you can always use a milliammeter to make sure you're feeding it a reasonable amount of current.
  • morris4019morris4019 Posts: 145
    edited 2009-06-22 01:11
    @leon, Are you sure you cannot use these LOC112, the datasheet says for use with analog or digital applications, thats why i got this particular optocoupler rather than a different one. If i do indeed need to get a different optocoupler I will, just checking. Also, will NOT using an optocoupler cause the propeller to restart at random times? I tested the L298 on the propeller before with no problems, but only with one bridge hooked up (one motor), now that there is 2, i am getting a restart every once in awhile.

    -Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-06-22 01:50
    With your current arrangement you will still get a restart even with optos unless you are running the Prop off a different power supply. I have no idea of your hookup and how you have the grounds connected but certainly you could assist the sensitive parts of the circuit by filtering the supply to the Prop's regulator. You need a diode, resistor, and a large value capacitor in the arrangement shown.
    POWER--- +diode- ---- 22R
    (TO REGULATOR)
    +470uF- GND

    The trouble is that motors can be very cruel to power supplies and the voltage can drop severely which even momentarily will reset the Prop. Also I mentioned ground connections which basically means that the Prop's ground should be connected back to the source independently from the motor's (L298) ground. Note that the L298 has a logic supply ground on pin 9 which follows the Prop's ground so you should not simply join this to pin 8 (power GND).

    *Peter*
  • LeonLeon Posts: 7,620
    edited 2009-06-22 05:09
    Mike:

    You could use the LOC112 as a digital interface but the 4N25 is a fraction of the price, and easier to use. As Peter says, your problem won't be solved by using an opto-coupler, anyway.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • morris4019morris4019 Posts: 145
    edited 2009-06-22 05:36
    ok, I actually might have fixed the problem with the restarts. I have rebuilt this particular setup a few times and when looking at it with fresh eyes I noticed one thing, I forgot to add a capacitor between GND and Vout of my 5vregulator. (5v regulator simply powers the L298) Once i added the capacitor it seems i do not run in to the problem anymore.

    As far as the optocoupler I thought It was suggested because of the voltage difference between the 3.3v (prop) and 5v+ of the L298 so i don't fry my microcontroller.

    -mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ======

    ······ I'll try everything once [noparse]:)[/noparse]
  • Mike HuseltonMike Huselton Posts: 746
    edited 2009-06-22 07:57
    Linear optoisolators usually have slow switching times. Check the datasheet. But your idea is sound. Maybe you can use a Schmitt trigger if you experience slow rise/fall times.
    Adding a 4.7k resistor in parallel could reduce capacitive effects. Just try your opto isolators. If they work, don't worry about it. Theory often gets in the way of experimentation.
    Applying separate grounds is always a good idea with motors. EMI is evil.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    JMH
Sign In or Register to comment.