Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

IR Switch

  1. Feb 25, 2010 #1
    Hey. I am trying to build a circuit which would switch on/off another device. So far I have tried using an IR LED on the controller and with a phototransistor on the load device (which has it's own batteries), but I cannot figure out how to get it to work. I do not need complicated signals, just a simple on/off toggle to switch on a 9V motor in series with a 9V battery (like a regular manual switch).

    Does anyone have any suggestions?

  2. jcsd
  3. Feb 26, 2010 #2
    There are a couple reasons why this circuit may not be working, but here's a guess at a solution.

    Assuming the IR LED and the phototransistor are working (basically that the LED is turning the transistor 'on' when lit and 'off' when not lit), the circuit you described is basically a push button instead of a switch. When you flash the LED, the transistor will be 'on' until the LED goes out. What you need to add to the circuit is a latch of some kind.

    A latching relay would probably do what you need. Connect the emitter of the transistor to 9v, and connect the collector to the input of a latching relay. When the transistor switches 'on', this will latch the relay closed. Connect one side of the relay contact also to 9v, and connect the other end of the coil to your motor (or whatever you want.) Pulsing the IR LED will latch the relay open or closed, and will connect/disconnect power to your load.

    Hope this helps.
  4. Feb 26, 2010 #3
    Can you describe how your circuit is not working? Is it failing to turn on even at close range? Perhaps you could post your schematic.

    Usually in these applications the IR is modulated to distinguish it from ambient light. The frequency you use can be almost anything except the power line frequency, its second harmonic and that used by CF bulbs which I believe is about 40 kHz. The receiver needs to filter out everything except your modulation frequency.
  5. Feb 26, 2010 #4
    Thanks for the quick replies. The circuit is basically supposed to allow a remote to shine an infrared light to turn on or off a motor. The circuit I'm using right now (which isn't working) is:


    While using in the above diagram, the voltage across the motor only rises to maybe .5V maximum; however if I use a single resistor as the load the voltage will almost completely transfer. I think this may have to do with the maximum current output of the photo transistor but how could I remedy this?

    This problem is compounded by the fact that the phototransistor only seems to work from very close range, making the device impractical (what's the point of a switch if you have to touch it anyway...).

    Does anyone have any idea for how to use either a IR phototransistor/IR photodiode/ or 38 kHz IR detector to operate a relay or switch? Also, could I modulate the IR LED so that it's ranged could be increased and picked up by the 38kHz IR detector? (I don't honestly even know what modulate means).

    Thanks for the help,

  6. Feb 26, 2010 #5


    User Avatar
    Science Advisor

    Modulate just means to change something, usually to add extra information to it.

    This is a typical 38 KHz transmit / receiver setup.

    http://dl.dropbox.com/u/4222062/38%20KHz%20oscillator-receiver.PNG [Broken]

    The infra red LED is switched on and off at a 38 KHz rate.
    In normal use as a remote control, this 38 KHz switching is sent in bursts to send data to a TV, say, to change channels etc.

    The wire going off to the right of the receiver is an output which would go to a circuit like this:
    http://dl.dropbox.com/u/4222062/NPN%20%20driver.JPG [Broken]

    This can control enough current to drive a small relay which would switch a motor. There might be enough current to run a very small motor.

    The transistor shown at right might be used to drive a relay like this:
    http://dl.dropbox.com/u/4222062/relay%20driver.JPG [Broken]

    Your motor would be switched by the contacts at the top of the relay.
    Last edited by a moderator: May 4, 2017
  7. Feb 26, 2010 #6
    Thanks. Do you think there is any simpler way to create a RC off/off switch? I am not limiting my project to using IR receivers either.

    The final project is just a toy for a year old nephew; so it doesn't have to really do anything particular.

    Would it be possible to have the motor drive variably just as the IR LED was shone near it?

    Thanks for the help again,

  8. Feb 27, 2010 #7


    User Avatar
    Science Advisor

    Look at it from the receiver's point of view.

    If it is seeing 1 square meter, that is 1000000 sq millimeters.
    The area of a 3 mm LED is about 7 sq mm.

    So, the brightness of the LED doesn't make much difference to the light picked up in a normal room.

    Just using a photodiode as a receiver and switching a LED is never going to be much good.

    That is why you need to use pulsed light.

    If you accept that, you could try the following circuit:

    http://dl.dropbox.com/u/4222062/photosensor%20MOTOR%20CONTROL.JPG [Broken]

    A toy really has to do more than turn on and off, so you could have a play with this for your own benefit. You could get your nephew a toy from China while you learn ablout remote control.
    A better approach is probably radio control, but that is a new can of worms.
    Last edited by a moderator: May 4, 2017
  9. Feb 27, 2010 #8
    Thanks for the reply.

    I am trying the pulsed IR now (it doesn't seem too hard). Would it be possible to use the phototransistor to switch on a relay controlling a 9V motor hooked up to a 9 V battery? Or would the signal first have to be amplified by transistors before it could operate the relay?


  10. Feb 27, 2010 #9


    User Avatar
    Science Advisor

    The current needed by most relays would be too great for a phototransistor to supply, I think.
    You would have to check the data sheets.
    But it is easy to do it with transistors.

    You would need to find a 38 KHz IR receiver chip. These cost about $3 but they are worth it.

    If you do go with the 38 KHz transmitter, look for a 10 turn pot for the 10 K resistor. This will be easier to adjust than a normal pot.

    The remote from your TV or VCR would probably work as a signal source instead of the transmitter if you just wanted to test the receiver.
  11. Feb 27, 2010 #10
    I have the IR receiver (and managed to get 38 kHz output from the IR as well) but am unsure how to amplify the signal with a transistor. Thanks again for any help.
  12. Feb 27, 2010 #11


    User Avatar
    Science Advisor

    The output of an IR receiver is either 5 volts or zero volts. You would use the last diagram in post no 5 above. That is the one with the relay.

    The transistor should be a small power transistor. R should be something like 10000 ohms, but this may need adjusting.

    Use a low coil-current relay.
  13. Mar 1, 2010 #12
    Hm.. the IR transmitter is capped (on the lower end) at about 78 kHz and on the high end about 400 kHz (based on the 10kohm potentiometer). What component would I need to change? I think it pulses based on the discharging of the capacitor, so would a lower value capacitor potentially give me a lower mean range?


  14. Mar 1, 2010 #13


    User Avatar
    Science Advisor

    A larger capacitor or larger resistors would lower the frequency.

    A calculator I have seems to say the frequency should be too low if anything. How are you measuring the frequency?
    The 100 nF capacitor could be marked 0.1 uF or just 104. It should not be marked 100 pF.

    Anyway, maybe you could try this one:

    http://dl.dropbox.com/u/4222062/38%20KHz.JPG [Broken]

    It should give 38 KHz when the 10 K pot is at about 4K and it should give about 16 KHz at the 10 K setting on the pot.

    You would need to get a 0.0047 uF capacitor. Any type except ceramic would be OK.
    Last edited by a moderator: May 4, 2017
  15. Mar 1, 2010 #14
    Thanks. I am measuring the frequency with a Radioshack 46 range digital multimeter, with the black probe on the high input voltage and the red probe on the resistor/diode junction. However, I did substitute a 1 nF capacitor instead of the 1.5 nF capacitor you put in the schematic just because of availability. (the .1uF is still .1uF though).

    Even adding another 1.5kohm resistor in series b/w input and terminal 7 only lowers the minimum frequency a little bit.

    edit: I am also using the TL555 ultra-low power timer instead of the 7555... could this make a difference?
  16. Mar 1, 2010 #15


    User Avatar
    Science Advisor

    The TL555 should be OK, although it seems you have to fiddle with the values.

    The 1.5 nF capacitor is the one controlling frequency. You would make it bigger to lower the frequency.

    That circuit was stolen from a magazine which is normally reliable. (!)

    The following site is a calculator for astable 555 oscillators, although it is for the standard 555 not a CMOS one.
    Last edited by a moderator: Apr 24, 2017
  17. Mar 2, 2010 #16
    I think you guys are making this circuit unnecessarily complicated. Modulating an IR diode is most useful for a) multiple controller functions via enumerated pulses, or b) to distinguish one IR signal from another concurrent one by varying frequency. In this case, it's silly to add all this functionality if you are only going to use this as an on/off switch.

    IR diodes are inherently short-ranged, and the problem you are having with sourcing enough current to your motor is probably more from the fact that you are trying to operate your diode at too long of a range. Also, the previous poster was correct in noting that a phototransistor may not be able to source enough current to supply a motor. However, if you can successfully switch the transistor on or off using an IR diode (which you say you can using a resistor as a load,) then you can certainly open and close a relay.

    A latching relay needs VERY LITTLE current to turn on. A brief search returns: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PB963-ND
    which is a bistable (latching) relay that can be easily driven by a 9v battery.

    You can improve also this easy circuit by adding another IR diode in parallel with your current one (reducing the need for a current limiting resistor and improving the distance you can operate at) or by putting an IR selective light filter in front of your phototransistor.

    Adding the LM555 timer etc makes this an interesting project, but if you're already having trouble with a simpler circuit, and if the goal is to build a present for your nephew, I suggest you keep it as simple as possible.
  18. Mar 2, 2010 #17


    User Avatar
    Science Advisor

    That relay needs 50 mA coil current. How would you get that much current through a phototransistor lit by an infra red diode held at any reasonable distance away?

    Infra red receiver chips have a very nice tuned amplifier built in and these would extend the range of the system by a factor of 10.

    They are cheap. They don't need tuning and can be used to tune the transmitter. So, why not use them?

    All this was explained to the poster and he wants to get good coverage by using a more complex circuit. He made the right decision, especially as he wants to learn these techniques.

    Even the 38 KHz system would not be able to supply enough current to drive a relay directly, so an extra amplifier is still required.
    The current needed to switch on a transistor is a LOT less than the current needed to drive the relay directly.

    IR diodes are inherently short-ranged, and the problem you are having with sourcing enough current to your motor is probably more from the fact that you are trying to operate your diode at too long of a range.

    TV remote controls usually use infra red diodes. These typically have a range of 20 ft or so. I'm sure this poster would be happy to get 20 ft range. There is no reason why this would not happen.
  19. Mar 2, 2010 #18
    Indeed. 50mA is definitely not unobtainable, but if that is still an issue, here is a relay that operates at 11mA:


    This is only after a very brief search, and I'm certain you could find one with even lower current requirements (or you could use another BJT as a current amplifier...)

    Yes, I agree, but they also increase the complexity/cost of the circuit by an order of magnitude by introducing an lm555 etc, and considering other factors such as debugging time, experience, etc, it is probably most wise to use an equally functional but much simpler solution that provides on/off functionality.

    I was certainly not insulting your suggestion. In fact, I think it would work quite well, and I definitely recommend the OP build a circuit like this if he is interested. I was only suggesting that all things considered, it might be easiest to build a more simple circuit for his nephew and fool around with more complicated things on his own.

    I disagree with this. Even considering a relay that requires 200mA (or some much larger current,) it would still be easier to use a darlington pair (or another basic amplifier configuration) than several IC's. Regardless, it is quite easy to find latching relays with tiny coil current requirements that would eliminate a lot of complexity from this project.

    Though range is undoubtedly an issue, it could easily be improved by using a couple (very affordable) diodes in parallel/series, or by using a single high power diode, without increasing the circuit complexity at all (or really reducing the battery life, since the remote is just used briefly).
  20. Mar 2, 2010 #19


    User Avatar
    Science Advisor

    Even 11 mA would not be available from a simple phototransistor arrangement. Currents of 50 uA might be possible but not if other light was present. There is plenty of infra red light in a room lit by an incandescent lamp, so just an IR filter won't help much.

    they also increase the complexity/cost of the circuit by an order of magnitude by introducing an lm555 etc, and considering other factors such as debugging time, experience, etc, it is probably most wise to use an equally functional but much simpler solution that provides on/off functionality.

    You consider a 555 and a few components as expensive and complicated?

    If you can see any simple way to do this that has a chance of actually working, draw up a circuit of it with real components and attach it to a posting. Let us see what you have in mind.

    IR remote control is moderately difficult to do and you have to take it seriously to get even reasonable results.
  21. Mar 2, 2010 #20
    Before I post I just wanted to say that you guys rock. I've never gotten this much help from a forum before.

    I got the 38 kHz receiver working on the breadboard and am about to solder it now. The relay I bought is a 5V SPDT micromini with a nominal coil current of 90 mA. I have not learned about transistors yet, but if I were to send the small current created by the receiver into the collector of an NPN transistor with 5V across it's base, wouldn't that amplify the current by 50 (assuming that is the Hfe)?

    Thanks again for all the help,

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook