My little infrared project

Thread Starter

Deck

Joined Feb 8, 2017
12
I need help with a little project of mine but I'm pretty much clueless about this subject. Basically, what I want to make is a remote switch using an infrared sensor. If this sensor receives the right frequency, then it triggers the switch (on/off switch for a lamp for example). How can I make it so that the light received is processed? What do I need to buy to make this remote switch? I preferably don't want to use Arduino if possible, but I am willing to give it a try. Please be patient with me, I know very little if anything at all about electronics.
 

GopherT

Joined Nov 23, 2012
8,009
I need help with a little project of mine but I'm pretty much clueless about this subject. Basically, what I want to make is a remote switch using an infrared sensor. If this sensor receives the right frequency, then it triggers the switch (on/off switch for a lamp for example). How can I make it so that the light received is processed? What do I need to buy to make this remote switch? I preferably don't want to use Arduino if possible, but I am willing to give it a try. Please be patient with me, I know very little if anything at all about electronics.
Get a LM555 chip (get a few because you'll damage one and have a spare or two). These pulse the IR LED
Google "555 calculator" to find the right resistor and capacitor sizes to make a 38k HZ pulse train.

Then you need a TSOP2238 ir receiver. This will need a resistor and a capacitor - read the DATASHEET. This has a pin that goes high when it receives a 38kHz pulse train of ir light. The DATASHEET says this pin should go to a Microcontroller but it can also turn on a simple transistor.

So, you need a transistor (NPN 2n3904 are always popular for DIY and more).

Now, we need to know more about your switch, or, we need to know more about what you want to switch.
 

Thread Starter

Deck

Joined Feb 8, 2017
12
Get a LM555 chip (get a few because you'll damage one and have a spare or two). These pulse the IR LED
Google "555 calculator" to find the right resistor and capacitor sizes to make a 38k HZ pulse train.

Then you need a TSOP2238 ir receiver. This will need a resistor and a capacitor - read the DATASHEET. This has a pin that goes high when it receives a 38kHz pulse train of ir light. The DATASHEET says this pin should go to a Microcontroller but it can also turn on a simple transistor.

So, you need a transistor (NPN 2n3904 are always popular for DIY and more).

Now, we need to know more about your switch, or, we need to know more about what you want to switch.
Thanks for the replies! So here's what I understood (please correct me if I'm wrong):
  • The LM555 chip pulses an infrared led (Are those two bought separately?) with a frequency determined by the capacitor and resistor I use.
  • The TSOP2238 has a preset frequency on which it goes high. If I want to use a different frequency (both for emitter and receiver) I should get a different receiver and use another combination of capacitor and resistor for the emitter.
  • If I need more than one emitter and receiver in the same room, I simply use different frequencies for each pair.
Which resistor and capacitor should I use for that specific receiver? Do I also have to find a combination of them for this one, or only for the emitter?

About my switch, I want it to turn on and off a lamp remotely (cutting the original wires and wiring my remote switch). If possible, I want it to turn on or off depending on the frequency received. Though, I'm also ok with it turning on or off (depending on it's previous state) every time it receives the right frequency.

To provide a little more detail of GopherT's excellent solution:
https://www.elprocus.com/infrared-remote-control-switch-working-and-applications/
Also thanks for the extra info!
 
Not exactly.

The TSSOP receivers "strip" the carrier frequency of say 38 kHz. They receive, other frequencies, but with a reduced sensitivity.

You have to generate the carrier in the transmitter and modulate it, by turning it on and off.

The best deal would be to detect the pulse width of the carrier and use that. Use a missing pulse detector.

Other issues may arrise because of toggle and repeat.

In modern protocals, a start bit is transmitted which causes the TSSOP to adjust it's gain.

Even a 38 kHz TSSOP package will respond to 50 kHz, just with a reduced range.
 

Thread Starter

Deck

Joined Feb 8, 2017
12
Not exactly.

The TSSOP receivers "strip" the carrier frequency of say 38 kHz. They receive, other frequencies, but with a reduced sensitivity.

You have to generate the carrier in the transmitter and modulate it, by turning it on and off.

The best deal would be to detect the pulse width of the carrier and use that. Use a missing pulse detector.

Other issues may arrise because of toggle and repeat.

In modern protocals, a start bit is transmitted which causes the TSSOP to adjust it's gain.

Even a 38 kHz TSSOP package will respond to 50 kHz, just with a reduced range.
So GopherT's solution isn't quite right? Or am I the one confusing everything? How do I use said missing pulse detector? Or how do I make the TSSOP to respond only to the desired frequency? Thanks!
 

GopherT

Joined Nov 23, 2012
8,009
Not exactly.

The TSSOP receivers "strip" the carrier frequency of say 38 kHz. They receive, other frequencies, but with a reduced sensitivity.

You have to generate the carrier in the transmitter and modulate it, by turning it on and off.

The best deal would be to detect the pulse width of the carrier and use that. Use a missing pulse detector.

Other issues may arrise because of toggle and repeat.

In modern protocals, a start bit is transmitted which causes the TSSOP to adjust it's gain.

Even a 38 kHz TSSOP package will respond to 50 kHz, just with a reduced range.

No, no, no. The TSOP22XX series does not require the pulse train to be turned on an off in bursts - that is why I selected this one. The TSOP24xx and TSOP44xx series do require the pulse train to be sent in repeating bursts. Please read the datasheet before correcting someone. Now you are confusting the Original Poster (OP).
 

GopherT

Joined Nov 23, 2012
8,009
So GopherT's solution isn't quite right? Or am I the one confusing everything? How do I use said missing pulse detector? Or how do I make the TSSOP to respond only to the desired frequency? Thanks!
Please ignore the post by KISS until he shows us the evidence on the Datasheet for TSOP22XX series parts that I am wrong.
 

Thread Starter

Deck

Joined Feb 8, 2017
12
Please ignore the post by KISS until he shows us the evidence on the Datasheet for TSOP22XX series parts that I am wrong.
Then, what I said in my first reply is correct?
  • The LM555 chip pulses an infrared led (Are those two bought separately?) with a frequency determined by the capacitor and resistor I use.
  • The TSOP2238 has a preset frequency on which it goes high. If I want to use a different frequency (both for emitter and receiver) I should get a different receiver and use another combination of capacitor and resistor for the emitter.
  • If I need more than one emitter and receiver in the same room, I simply use different frequencies for each pair.
 

GopherT

Joined Nov 23, 2012
8,009
Thanks for the replies! So here's what I understood (please correct me if I'm wrong):
  • The LM555 chip pulses an infrared led (Are those two bought separately?) with a frequency determined by the capacitor and resistor I use.
  • The TSOP2238 has a preset frequency on which it goes high. If I want to use a different frequency (both for emitter and receiver) I should get a different receiver and use another combination of capacitor and resistor for the emitter.
  • If I need more than one emitter and receiver in the same room, I simply use different frequencies for each pair.
Which resistor and capacitor should I use for that specific receiver? Do I also have to find a combination of them for this one, or only for the emitter?

About my switch, I want it to turn on and off a lamp remotely (cutting the original wires and wiring my remote switch). If possible, I want it to turn on or off depending on the frequency received. Though, I'm also ok with it turning on or off (depending on it's previous state) every time it receives the right frequency.



Also thanks for the extra info!
Yes, an LM555 (or NE555) or many other 555-style parts are the same and most can be used. Pick one with 250 mA of output capability (NE555 or TL555 I know can do this).

The IR LED is purchased separately and needs a resistor in series with the 555 output and IR LED (also known as an IR Emittter).

The output pin of the TSOP2238 stays high as long as it is receiving a train of IR Pulses of 38kHz. The 38KHz is the most sensitivce range. There are filters but they are not hard stops at 37KHz and 39kHz. Search the Datasheet. They have a sensitivitv vs. frequency graph.
 

GopherT

Joined Nov 23, 2012
8,009
As for two in the same room, it is similar to two TVs in one room. The LEDs are pretty directional so it may be possible to do it with the ame parts and circuit. If you buy a second 555 and power it with a second button you can easily build a dual frequency transmitter.

Pick a TSOP22xx part with different xx value that operates at different frequency (the TSOP2238 is 38kHz).

Use the calculator to find a different frequency. Also, keep R1 about 1kHz to keep the on/off times of the flashes about 50%.
 

Thread Starter

Deck

Joined Feb 8, 2017
12

GopherT

Joined Nov 23, 2012
8,009
Thank you very much! A last few questions before I can get started: What do "Vcc", "Gnd" and "lOnF" mean? At what voltage do these components work? (because I assume they are powered by small batteries). Also, do I have to calculate which resistor and capacitor I should use with theTSOP2238?, by using the ohmslawcalculator link? Thanks again!
Vcc is the positive batery voltage (9 volts if using a 9v battery)
Gnd = ground. This will be the negative battery terminal. Also 0v.

Where did you see IOnF? It could be an error / misprint / artifact from a PDF file.

Now, we've only covered the parts to send your signal, receive the signal but not what you are going to do with the received signal. What do you want to do at the receiving end?
 

Thread Starter

Deck

Joined Feb 8, 2017
12
Vcc is the positive batery voltage (9 volts if using a 9v battery)
Gnd = ground. This will be the negative battery terminal. Also 0v.

Where did you see IOnF? It could be an error / misprint / artifact from a PDF file.

Now, we've only covered the parts to send your signal, receive the signal but not what you are going to do with the received signal. What do you want to do at the receiving end?
I think it says something like lOnF in the bottom right corner, on the 5th pin of the chip.

About the receiving end, my english isn't very good so I'll try to explain it as accurate as possible. Each time the sensor receives the right signal, it should change the state of a switch (I think that's how it's called) so that it "opens" or "closes" a circuit (which is the one I intend to control remotely in this project). Whether the circuit is opened or closed depends on it's previous state, and should change every time the emitter sends a burst (I believe this is achieved with a single transistor, but I most probably am totally wrong).

What I want to do is "customize" certain circuits like, for example, the one of a normal lamp. In this case, the lamp would always be plugged in with it's original switch always on, but what would control if the lamp is actually on or not should be my switch. So this switch I'm trying to make should be somewhere between the lamp and the power supply. At some point, I want to be able to control many appliances with these DIY remote controls, hence the question about multiple emitters and receivers.

Anyway, I'm probably making that kind of things later on, because I don't actually know how to connect this switch to the power supply (I believe 110V) without it blowing up. Right now, I think what I need to know is how to make a circuit open/close every time it receives the right signal. I hope I'm not being too confusing.
 
@GopherT

We're both right.

The output of the TSSOP has to be "pulled up". It will be active low in the presence of a carrier.

The actual carrier frequency and duty cycle though is "almost" irrelevant. Sensitivity is lost if the frequency is away from the pass band. I know for a fact that receivers designed for 72 kHz will work with a 36 kHz.

So, that said: Doing something like turning the carrier on and off at 1 kHz at say 10, 20, 30, 40, 50% could off a very "crude" way of controlling multiple items. You could also use the frequency of the modulation, not the carrier to control multiple devices.

IR codes are more complex than the simple example above.

You still, generally have to use the long pulses or the edges of the pulses to make them useful.

There are a number of devices on this http://tauntek.com/ website, that I think the OP might find useful for his project. e.g. receive a code from "a remote" and generate a toggle or a pulse or generate a learned code from a contact closure.
 
About the receiving end, my english isn't very good so I'll try to explain it as accurate as possible. Each time the sensor receives the right signal, it should change the state of a switch (I think that's how it's called) so that it "opens" or "closes" a circuit (which is the one I intend to control remotely in this project). Whether the circuit is opened or closed depends on it's previous state, and should change every time the emitter sends a burst (I believe this is achieved with a single transistor, but I most probably am totally wrong).
The word your looking for is "toggle". http://www.webopedia.com/TERM/T/toggle.html
 

Thread Starter

Deck

Joined Feb 8, 2017
12
@GopherT

We're both right.

The output of the TSSOP has to be "pulled up". It will be active low in the presence of a carrier.

The actual carrier frequency and duty cycle though is "almost" irrelevant. Sensitivity is lost if the frequency is away from the pass band. I know for a fact that receivers designed for 72 kHz will work with a 36 kHz.

So, that said: Doing something like turning the carrier on and off at 1 kHz at say 10, 20, 30, 40, 50% could off a very "crude" way of controlling multiple items. You could also use the frequency of the modulation, not the carrier to control multiple devices.

IR codes are more complex than the simple example above.

You still, generally have to use the long pulses or the edges of the pulses to make them useful.

There are a number of devices on this http://tauntek.com/ website, that I think the OP might find useful for his project. e.g. receive a code from "a remote" and generate a toggle or a pulse or generate a learned code from a contact closure.
So, instead of just emitting at, say, 36kHz, I should modulate said frequency? Which is the simplest option?

The word your looking for is "toggle". http://www.webopedia.com/TERM/T/toggle.html
Toggle, thanks!
 
So, instead of just emitting at, say, 36kHz, I should modulate said frequency? Which is the simplest option?
Not sure, because of the lack of the use of a ucontroller. In IR controls, the "length of the pulse" determines if it is interpreted as a 1 or a zero. The length is, I thin, the length of time the carrier is on.

From there, the better protocols use a carrier burst as a start bit so the receiver (TSSOP) module can adjust it's gain. Then you have the protocol definition. Lots of commands/devices can be controlled this way

Using the wrong magnitude of the units as an illustration: 1 sec burst toggles device A, x, a 2 second burst toggles device b... a 10 sec burst toggles device 10.

or, a frequency of 500 Hz, 750 Hz, 1000 Hz does the same sort of thing.

The carrier (38 kHz) is being turned on and off in a predictable manor.

Here http://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol is a little example of what makes up the NEC IR protocol.
 
Top