Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Noob question about resistors for LEDs, but for opto-isolator.  (Read 6811 times)

0 Members and 1 Guest are viewing this topic.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 09:14:16 pm
  • ...
I'm still a noob at this stuff, in fact I think I've regressed since not playing with it for a few months.

At 5v, what's the lowest value resistor I can use on the IR LED side of this opto-isolator without having to worry about it burning up in a month?
http://media.digikey.com/pdf/Data%20Sheets/Lite-On%20PDFs/LTV-817_827_847(M,S,S_TA1).pdf
If I'm doing things correctly, an online calculator is telling me 82ohm, but that seems low to me.

I was under the impression that opto-isolators were like switches, but after building my circuit on the breadboard, I see it's more like a transistor where the input affects the output.  I'm making a circuit that switches between two resistances when an optoisolator is tripped and didn't account for the optoisolator itself adding resistance.  I got down to a 220 ohm resistor on the anode before getting a low enough resistance on the collector/emitter side.  But I would like to go even lower for the sake of being able to adjust it with a pot elsewhere in the circuit.

What I'm up to = this will reduce the brightness of the IR LEDs in the optical switches of my joysticks, making them less sensitive to the point of skipping the corners in 4-way games. It will be controlled by joychoose of course.  ;)
« Last Edit: August 16, 2013, 04:32:48 pm by BadMouth »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #1 on: August 17, 2013, 12:10:18 pm »
According to the specs you linked to, the forward voltage at 20 MA is 1.2
So, using supply voltage of 5 minus the forward voltage of 1.2, divided by 20 ma:

E =Es-Ef  (5-1.2=3.8 volts)
R= E/I
R=3.8/.020 (20 ma)
R= 190 ohms. (200 should be ok that will give the led 19 MA)

If you are experiencing the output of this opto isolator "floating" (not turning completely off), you may need to bias it with a resistor on the transistor side (output) of the opto isolator.
If the transistor is switching the ground going to the joystick, add a 5 K resistor to the wire going to the joystick and the positive supply for the joystick. If it is switching the positive, then the 5k resistor needs to go to the ground.
This will either pull down the opto isolator output when it is turned off (if it is switching the positive) or pull up the output if it is switching the ground.
(Its actually pulling up or down the input to the joystick, to make sure it is completely off)
The 5 K resistor is just a wild guess, it may need to be higher or lower. To err on safety, maybe use a 10 K, if it don't work, try the 5 K.
See diagram below, this is assuming that the opto isolator is NPN.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #2 on: August 17, 2013, 12:17:20 pm »
Ok I just re-read your post and I think I misunderstood.
If you are trying to adjust the brightness of your internal joystick leds, may need a different approach.
The circuit I recommended is completely off or completely on, based on optoisolator output.
Adjusting the brightness of LEDs are not as simple as one may think, however you can try to put a pot (adjustable resistor) in between the optoisolator and the joystick, then adjust the pot to vary the brightness of the joystick leds. (This is not efficient, because at some point the led will drop off fast to dark.)
The best way to vary the brightness of an led is adjust the current (caution! very easy to fry the led), or pulse the current off and on at different rates. I don't know if this is possible with your joysticks or not.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 09:14:16 pm
  • ...
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #3 on: August 17, 2013, 03:42:21 pm »
Ok I just re-read your post and I think I misunderstood.
If you are trying to adjust the brightness of your internal joystick leds, may need a different approach.
The circuit I recommended is completely off or completely on, based on optoisolator output.
Adjusting the brightness of LEDs are not as simple as one may think, however you can try to put a pot (adjustable resistor) in between the optoisolator and the joystick, then adjust the pot to vary the brightness of the joystick leds. (This is not efficient, because at some point the led will drop off fast to dark.)
The best way to vary the brightness of an led is adjust the current (caution! very easy to fry the led), or pulse the current off and on at different rates. I don't know if this is possible with your joysticks or not.

Yeah, I want to switch between two different levels of resistance.  One when the opto-isolator is off, another when it is on.  The simplest way I thought of to accomplish this was adding another resistor in parallel with the first one when the opto-isolator is on.  (I'm using pots so they're adjustable, but for the sake of keeping it simple, we'll just say I'm using resistors).

The joystick PCB already has a pot to adjust the sensitivity.  I've removed that pot and replaced it with some pins and a cable that will go to this circuit. 

At the higher resistance, the IR LEDs are dimmer and the joystick less sensitive so it doesn't register in the corners. (4-way mode)
At the lower resistance, the IR LEDs are brighter and work normally for 8-way games.\
This is with a round gate on the joystick and it doesn't feel as odd for 4-way games as I thought it might.
 

I messed around with it today with the joystick hooked up instead of just measuring resistance.  After a fair amount of fiddling, I got it working the way I want and moved onto building the actual boards, but I'm using a 100ohm resistor.  :scared
(I was mistaken when I mentioned a 220ohm resistor yesterday, it was a 120).

It didn't behave exactly as expected, so a 200ohm resistor might work, but I'd have to remove them from my proto-board to test.  :-\
I have a half dozen more opt-isolators.  Hmmm...


EDIT: ugh, ended up tearing the proto-boards halfway apart before I realized that the pads on the edges aren't linked to the other side like the holes.
This after I tested to make sure that the individual holes weren't linked in any way.   ....and one of the optoisolators is blown.   :embarassed:  It's a shame, as it was working exactly how I wanted on the breadboard for around a half hour of fiddling with it.  Not sure how long out of that the opto-isolator was powered.  Back to the breadboard I suppose.

Is there something other than an optoisolator that would be better to use here?
« Last Edit: August 17, 2013, 06:05:31 pm by BadMouth »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #4 on: August 17, 2013, 11:53:19 pm »
How are you switching the opto isolators? If you are using the printer port, you could use NPN transistors.
But opto isolators are neat because they keep the currents on the joystick and the PC currents separated.
You can also use DIP sockets, so you can just unplug the opto isolators.
So you are wanting to switch the resistance to the joystick LEDS, based on an output on or off from the PC?

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 09:14:16 pm
  • ...
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #5 on: August 18, 2013, 10:01:20 am »
So you are wanting to switch the resistance to the joystick LEDS, based on an output on or off from the PC?

Yup.

How are you switching the opto isolators?

Eventually plan to use a usb Pololu servo controller.  It has a mode that can turn LEDs on and off instead of controlling a servo.
So far, I'm just using a test bench power supply set to 5v.

I might fry a few parts, but I'll get it working soon.
It was working for a fairly long time on the breadboard with the 100ohm resistor.
It never worked on my proto-board.  Maybe it wasn't the low resistance that killed the opto-isolator, but it's not good to exceed specs anyway.  I'll go back to the breadboard today and try to find a solution that uses the proper value resistor.
« Last Edit: August 18, 2013, 10:05:03 am by BadMouth »

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 09:14:16 pm
  • ...
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #6 on: August 18, 2013, 01:22:45 pm »
circuit seems to work fine with a 220 Ohm resistor.   ::)
Hopefully I'll get the same results on the next proto-board.

As an aside, I left an opto-isolator on with a 100ohm resistor for a half hour and it didn't burn up.
I suspect i fried the one on the original protoboard with the soldering iron or poor routing.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #7 on: August 23, 2013, 05:29:38 pm »
I suspect i fried the one on the original protoboard with the soldering iron or poor routing.

This could well be, but hey, it happens to the best of us, so don't give up.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 09:14:16 pm
  • ...
Re: Noob question about resistors for LEDs, but for opto-isolator.
« Reply #8 on: August 26, 2013, 11:15:35 am »
I suspect i fried the one on the original protoboard with the soldering iron or poor routing.

This could well be, but hey, it happens to the best of us, so don't give up.

Pretty sure that's what happened.  I barely tacked the next one in and it worked fine.
The P1 side of my protoboard worked perfectly, but P2 refused to work no matter what I did.
The only difference was that the collector/emitter side of the opto-isolator is reversed.
I did that to make power routing to the anodes simpler.  I didn't think it made a difference, but apparently it does. 
Either that or there is some other problem I'm not seeing. 
I'll reverse them on the breadboard test setup and see if it stops working.  Otherwise I haven't really learned anything.  ;)

At any rate, my protoboard looks like crap from swapping parts, so I'm going to redo one from scratch that I'm not embarrassed to post pictures of.  :P
I'll use sockets for the opto-isolators and make two identical circuits.
Hopefully I'll get it done tonight and will post the final product on my Neo Geo Evolution build thread.
« Last Edit: August 26, 2013, 11:29:12 am by BadMouth »