Maker Pro
Maker Pro

Remote Control Circuit with CD4017 - counter decoder

Hi, I'm having a project of creating a remote control circuit for any home appliances, with the circuit shown below.
My problems/questions are

1) I dont understand when the TSOP1738 (IR receiver) DOESN'T NOT receive signal, what will it do? I'm guessing that it make the pnp reverse biased in BOTH junction as 5V is flowing out of the "out" pin, right?

2) Can someone explain to me what happen when the TSOP receive signal and not receiving signal? I just need to know HOW the CURRENT flow in the WHOLE circuit when OFF and when ON. (FYI, I understand how pnp, npn and relay works, so maybe can skip and no need to explain that)

Please help, been struggling and looking for answer through Internet for weeks! Will very appreciate your help
 

Attachments

  • remote-control-circuit-for-any-home-appliances.jpg
    remote-control-circuit-for-any-home-appliances.jpg
    43.6 KB · Views: 10,185

KrisBlueNZ

Sadly passed away in 2015
Start by reading the data sheet for the TSOP1738: http://pdf.datasheetcatalog.com/datasheets/208/301092_DS.pdf

The device has an active low output. That is, its output pulls low (to 0V) when it is receiving an infra-red stream modulated at 38 kHz.

The way the circuit is supposed to work, when the TSOP1738 is receiving infra-red from a remote control transmitter, it pulls its output low. This discharges the 100 µF capacitor and also forward-biases the PNP transistor, causing it to pull its collector high and clock the CD4017, changing the state of the appliance control output.

An infra-red remote control transmitter transmits modulated infra-red light in a series of bursts; the widths of these bursts, and the gaps between them, encode the particular command being sent. But this circuit doesn't care about that. The 100 µF capacitor ensures that the PNP is kept ON during the gaps in the infra-red signal. Only when the button on the remote control transmitter is released, and the infra-red transmission has stopped for a short time, can the PNP turn OFF ready for the next button-press.

This circuit has several errors. (1) There should be a decoupling capacitor across the power supply input to the TSOP1738. (2) There should be a resistor between the TSOP1738's output and the base of the PNP; without this resistor, a fairly high current will flow through the PNP's base-emitter junction and into the TSOP1738 when it tries to pull its output low; this current will exceed the TSOP1738's specification (5 mA maximum output current) and may damage it. It could also damage the PNP. (3) Another resistor should be added between the TSOP1738's output and VCC, or the 100 µF capacitor should be reduced so that the built-in pullup resistor in the TSOP1738 will produce an appropriate delay. (4) C2 is not needed. (5) A decoupling capacitor should be connected between the VDD and VSS pins of the CD4017 to ensure proper operation. (6) The CD4017 is a 10-output device; only two output states are needed, and the CD4017 can be replaced by a CD4013.
 
Hi Kris, thanks for your reply and I've understand better. I truly appreciate it :)

And, thanks for pointing out those errors. Will analyse all the error one by one. But before that, I still have some doubts here.

When the output of TSOP1738 is high, the PNP is off and there will be no pulse entering the "clock" pin, right? And based on the timing diagram, when no pulse entering the "clock", I thought it is then the CD4017 is not functioning? Then how come the RED LED is then lighted up?
 
The 4017 is configured to be in 1 of 2 states. Each press of the remote causes a pulse on the clock, which swithes it to the other state. I.e. one press ON next press OFF.

Bob
 
Hi Bob :)

Hmm, how does the switching occur? I got timing diagram here btw. A SINGLE pulse causes Decoded Output 0 (pin 3) to be high? then another pressing on the remote causes Decoded Output 1's turn to be high? I don't understand how this occur, would you mind explain further? Will be appreciating your help
 

Attachments

  • Timing Diagram.png
    Timing Diagram.png
    22.8 KB · Views: 1,581

KrisBlueNZ

Sadly passed away in 2015
The CD4017 responds to the rising edge on its clock input. That is, each time its clock input pin is brought from low (GND in that circuit) to high (+5V), it advances by one count.

Assume the 4017 is currently at count 0. This means that the "Q0" output, pin 3, is the only output that will be high, and this causes the green LED to light up, indicating that the switched appliance is OFF. The "Q1" output on pin 2 will be low, so the relay will not be activated and the appliance will not power up.

When the 4017 sees a rising edge on its clock input, it will advance from a count of 0 to a count of 1. The "Q0" output will go low, so the green LED will go out, and the "Q1" output on pin 2 will go high. This illuminates the red LED, and turns on the transistor, the relay, and the controlled appliance.

When the 4017 sees another rising edge on its clock input, it will advance from 1 to 2 and its "Q2" output on pin 4 will go high. This output is connected to its reset input, so as soon as this happens, the 4017 resets back to a count of 0.

Therefore, each time the 4017 sees a rising edge on its clock input, it will alternate between a count of 0 and a count of 1. The LEDs will change state, and the controlled appliance will turn ON and OFF, as the 4017's count changes.
 
Thanks Kris! Now I've understand how this circuit works! ;) Finally. Been struggling for weeks.

Will take time to analyse the errors u mentioned now. Really appreciate your help Kris. Thank you.

And thanks to Bob, appreciate your response! :)
 
Hi Kris, what if there's no decoupling capacitor done on the certain sections you mentioned? I've not learn decoupling capacitor technique yet and I need to hand in this project soon and I don't think it's enough time learn and do the decoupling capacitor o_O

And one more thing, I still need to build a remote control actually, which consist of Infrared emitter, just to make this circuit off and on. Is the IR emitter in the picture below applicable to build emitting circuit? Or I need a 3-leg Infrared Emitter with IC timer 555?
 

Attachments

  • Infrared Emitter normal.jpg
    Infrared Emitter normal.jpg
    26.3 KB · Views: 864

KrisBlueNZ

Sadly passed away in 2015
A decoupling capacitor is just a capacitor that's connected between the VDD and VSS pins (pins 16 and 8 on a CD4017) as close to the IC as possible and with leads as short as possible. Typically a 0.1 µF ceramic capacitor is used. It is highly recommended for logic devices, especially MSI ones such as the 4017, to prevent misoperation. In other words, it makes the 4017 work more reliably. In that circuit, without a decoupling capacitor, the 4017 may sometimes fail to change state.

https://en.wikipedia.org/wiki/Decoupling_capacitor

As you suspected, that infra-red LED is not enough to activate the TSOP1738 receiver. It generates a continuous stream of infra-red light. That receiver needs the light to be modulated (turned on and off) at a frequency of around 38 kHz. That requires an oscillator of some kind.

You can use a 555 but they do not generate a very accurate frequency. Normal infra-red transmitters use a ceramic resonator to generate their frequencies, with an error of around ±1%. If you use a 555, use a good-quality, accurate capacitor such as this one: http://www.digikey.com/product-detail/en/CDV16FF561JO3F/338-3112-ND/1918669
 
Okay, it's better for me to do the decoupling. Anyway, did you mean that the 0.1 µF ceramic capacitor is connected in series with pin 16 and 8 ? or in parallel? :)

I will choose to use ceramic resonator. So, how should I connect that infrared emitter with a ceramic resonator so that it generate 38khz freq? Any sample schematic to guide me? I'm sorry that I have no idea at all, totally a newbie.

And I couldn't find any datasheet regarding the ceramic resonator (38khz) from Google and based on the document I just uploaded, I don't see any 38khz of ceramic resonator too o_O
 

Attachments

  • CSA1,500MK.pdf
    897.6 KB · Views: 435
Last edited:

KrisBlueNZ

Sadly passed away in 2015
The decoupling capacitor should be connected between those pins. One wire from the capacitor to pin 16, the other wire to pin 8. Keep the wires as short and direct as possible.

You won't find a 38 kHz ceramic resonator. They have frequencies from a few hundred kHz up to a few MHz. You use the resonator (or a crystal) to produce a higher frequency, then divide it down to get the frequency you want.

Normal remote control transmitters that operate at 38 kHz use a 455 kHz ceramic resonator and divide that frequency down by 12 using digital logic. This produces a frequency of 37.91667 kHz, which is 0.22% away from 38 kHz - plenty accurate enough, since the basic accuracy of a ceramic resonator is only ±1% anyway!

Actually the cheapest and most compact way to generate 38 kHz from a 455 kHz ceramic resonator would be using a small microcontroller such as a PIC. A little 8-pin PIC12F508 (see http://www.digikey.com/product-detail/en/PIC12F508-I/SN/PIC12F508-I/SN-ND/613186 for the SMT version and http://www.digikey.com/product-detail/en/PIC12F508-I/P/PIC12F508-I/P-ND/613185 for the through-hole version) includes circuitry to make the resonator oscillate, and can be programmed to generate an exact 38 kHz (actually 37.91667 kHz) signal on a pin. All you need then is a buffer (transistor or MOSFET) to drive the LED.

For a quicker solution, you could use an oscillator driving a divider. I can't see any way of doing this with less than two ICs. I can design you a circuit using two ICs (a CD4069U and a CD4024), a ceramic resonator, four capacitors, five resistors, two diodes, one transistor or MOSFET, and that infra-red LED. It would be powered from a 6V battery supply such as four 1.5V AAA cells. Does this sound reasonable?
 
Noted. Will start doing the decoupling now and also removed the C2. So, once after I did the capacitor decoupling and with correct connection, it should be working, right? Or do you still see any problem with the circuit?

Thanks for the clear explanation and yes it sound totally reasonable for me! I can't wait to get your circuit and learn more :) To appreciate your help, the circuit your design for me will be listed with your name down there in my presentation and report, would you be mind about that? :)
 

KrisBlueNZ

Sadly passed away in 2015
There is a problem with the connection between the TSOP1738 and the transistor. I will draw up a full schematic for the receiver along with the transmitter. Give me a day or two.

Sure you can credit me with the design, of course. Just credit me as KrisBlueNZ.
 

KrisBlueNZ

Sadly passed away in 2015
OK, sorry about the wait. Here's what I suggest.

EP268176.001.GIF

I'll come back and add a circuit description and component notes in a day or so. In the meantime here are the important components:

In the transmitter:

  1. U1 MUST have a "U" in the suffix. This is an "unbuffered" type of gate that is needed to make the resonator oscillate properly.
  2. C3 and C4 are decoupling capacitors, 100 nF (also known as 0.1 µF), ceramic. They must be connected as directly as possible between the power pins of their relevant ICs.
  3. Q1 should be a BC337-40 as shown, or some other transistor with high gain, to ensure that it saturates nicely so you get a good current flow in the LED. Let me know if you can't find a BC337-40 and tell me who your local suppliers are, so I can suggest the best alternative.
  4. R4 is specified as 100 ohms but you can change this to change the intensity of the infra-red light emitted by the LED. The LED current, in mA, is about 4500 / R4. So the value given, 100 ohms, gives a current of (4500 / 100) = 45 mA. This should give reasonable infra-red output. You can increase the current (by reducing R4) if you find the range isn't enough, but make sure you don't exceed the manufacturer's recommended maximum current for the infra-red LED you're using. The circuit pulses the LED at a duty cycle of 33%. The data sheet for the LED should have a graph that tells you the maximum allowable current for the LED at various duty cycles.
  5. LED1 is the infra-red LED. If possible, use one with a peak infra-red light wavelength of 840 nm, because that's where the TSOP1738 is most sensitive. Check that the specified forward voltage of the LED is around 1V. If it's much higher, you will need to decrease R4 to get the desired current.
  6. Don't try to power the circuit from a smaller battery such as button cells. It won't last long with button cells, and it may not work properly because of the high current pulses that it draws.
For the receiver:

  1. C1 and C3 are decouplers, yadda yadda yadda as before.
  2. Q2 can be any of the types listed. If you're already getting a BC337-40 for the transmitter, you might as well use one here too.
  3. K1 is the relay that controls your appliance. The two types I've specified are both DPDT (two sets of changeover contacts) which is much more than you need, but those relays are common, compact, and cheap. They are only rated for 2A switching and carrying current into a non-inductive load, so if you want to switch something big, or DC at more than 28V and 2A, you'll need a second "interposing" relay that is switched by K1. You can use other relay types for K1. The important factors are: (a) the coil must be designed for 5V DC, and (b) the coil current should not be more than 50 mA. The ones I've specified have a coil current of 28 mA which is good. Actually, there are other bigger relays that could be used instead of K1. the Omron G6M-1ADC5 can switch 3A. Beyond that, there are several that draw 40 mA coil current, which is a bit high but acceptable. The Omron G5T-1ADC5 can switch 5A. The Panasonic ALQ305 and the Omron G5Q-1ADC5 and G5Q-1A4DC5 can switch 10A, and the Panasonic ALE75B05 and ALE75F05 can switch 16A.
  4. A 5.0V power supply is needed, rated for at least 0.1 amps.
The remote control transmitter should not cause accidental operation of any other infra-red-remote-controlled equipment, but the receiver will respond to any infra-red transmitter.
 
Noted. Will study through both circuit and start doing later! :)
Ok I will come back here from time to time to check the updates. Thanks so much :)
 

KrisBlueNZ

Sadly passed away in 2015
No problem. Electronics Point should send you an email each time there's an update to a thread you're participating in. Check that you're "watching" this thread - if there's "Watch thread" near the top of the thread page, click it - and check your account preferences.
 

KrisBlueNZ

Sadly passed away in 2015
OK, here's a circuit description for the non-coded infra-red remote on/off controller design in post #16.

There is an error in the schematic in post #16: in the receiver circuit, the CD4017BE IC is identified as U1. It should be marked U2. (U1 is the TSOP1738 infra-red receiver device.)

The Transmitter:

U1 is a CD4069UBE hex inverter device. You MUST use a part with a "U" in the suffix, which indicates that the gates are "unbuffered". An unbuffered gate (containing only two MOSFET devices) is needed to make the oscillator work properly with those component values.

The first gate, on pins 1 and 2, is used as an inverter biased into its linear region by R1, with feedback through X1, a 455 kHz ceramic resonator. This arrangement is known as a Pierce oscillator and is widely used.

The output on pin 2 is buffered by another gate and comes out on pin 12, where it feeds U2, a CD4024BE ripple-carry binary counter, which divides the frequency down using cascaded "T"-type flip-flops.

D1 and D2 form a diode logic AND gate that detects when a count of 1100 binary (12 decimal) is reached, and resets U2. This causes U2 to divide by 12 and produce an output signal on pin 6 which is 1/12th of the 455 kHz clock frequency, i.e. 37.91667 kHz, and has a duty cycle of 33%.

This signal is inverted by another inverter gate in U1 then fed to the inputs of the three remaining inverters, whose outputs are also commoned together. This gives a combined output impedance three times lower than a single gate, which can drive more current through R3.

The signal at pins 4, 6 and 8 is a rectangular wave with 33% duty cycle. R3 feeds this signal into Q1's base with a current of about 8 mA.

Q4 drives LED1, the infra-red-emitting diode. Q4 should have a reasonably high gain so that it saturates well with the limited base current available; I've suggested a BC337-40 which has a current gain of 400 or more, and a maximum collector current of 800 mA (500 mA for NXP's version).

The intensity of the infra-red light emitted by LED1 is roughly proportional to the current that flows through it, which is set by R4 and can be calculated using Ohm's Law, I = V / R, where I is current in amps; V is the voltage across R4, in volts, and R is the resistance of R4, in ohms.

The voltage across R4 is equal to the battery voltage minus the LED's forward voltage (typically about 1V for an infra-red LED, but look on the LED's data sheet), minus about 0.3V for the collector-emitter saturation voltage of Q1.

You can increase the current (by reducing R4) if you find the remote control range isn't enough, but make sure you don't exceed the manufacturer's recommended maximum current for the infra-red LED you're using. The circuit pulses the LED at a duty cycle of 33%. The data sheet for the LED should have a graph that tells you the maximum allowable current for the LED at various duty cycles.

Ohm's Law can be rearranged to R = V / I so you can calculate the correct resistance for R4 from the other values.

The specified resistance, 100 ohms, gives a current of (4.7 / 100) = 47 mA, assuming an LED forward voltage of 1V (6V battery, minus 1V LED voltage, minus 0.3V Q1 saturation voltage, leaves 4.7V across R4).

These calculations assume a new battery. The LED current will drop as the battery runs down.

The infra-red LED, LED1, should have a peak infra-red light wavelength of 840 nm, because that's where the TSOP1738 is most sensitive.

Don't try to power the circuit from a smaller battery such as button cells. It won't last long with button cells, and it may not work properly because of the high current pulses that it draws.

C3 and C4 are decoupling capacitors, 100 nF (also known as 0.1 µF), ceramic. They must be connected as directly as possible between the power pins of their relevant ICs.

C5 is a decoupling and reservoir capacitor. It provides extra current during times when LED1 is illuminated, and reduces noise on the supply rail. It must be rated for 10V or higher. This power supply noise is also isolated from U1 and U2 by R5.


The Receiver:

The receiver needs a 5.0V power supply that is rated to provide at least 0.1 amps.

U1, a Vishay Telefunken TSOP1738, is an integrated infra-red receiver and demodulator that detects infra-red light modulated at about 38 kHz. It pulls its output low when this light is detected.

R1 and C1 isolate U1 from noise on the power supply rail.

When light is detected, C2 charges up via R2 and Q1 turns ON, pulling pin 14 of the CD4017 (incorrectly labelled U1; it should be U2) high. When the infra-red light stops, the internal weak pullup resistor in U1 discharges C2 slowly through R2 and Q1 turns OFF.

This quick response to light and slow response to no light is needed so the circuit can be used with a standard infra-red remote control transmitter which transmits its modulated infra-red light in bursts. The transmitter shown here transmits a continuous stream of modulated infra-red light, so it should not cause misoperation of any other remote-controlled devices. However, the receiver will respond to any infra-red remote control.

U2 (mislabelled U1) is a CD4017BE decade counter/divider IC. It has ten outputs; only one output is active at a time. It responds to rising edges on pin 14 by advancing to the next output.

Output Q2 (pin 4) is connected to the Reset input (pin 15) so when the count advances from 1 to 2, the device resets immediately. This means that on every rising edge on its clock input, it alternates between count 0 and count 1.

The count 0 output on pin 3 drives LED2, a red LED that lights when the appliance control is OFF. This LED and its current limiting resistor R4 can be omitted if they're not wanted.

The count 1 output on pin 2 drives LED1, a green LED that lights when the appliance control is ON. It also controls the appliance via Q2.

When U2 pin 2 is high, current flows through R6 and forward-biases Q2. This applies 5V across the coil of K1, the appliance control relay.

K1 is shown as a DPDT type (two sets of changeover contacts). The types listed, EC2-5NU and V23079A2001B301, are common, small, cheap, and available from Digikey. Their coil currents are 28 mA which is fairly low for a 5V coil. But their contacts are rated to switch only 2 amps, and that's into a non-inductive load.

If you want to switch something bigger, or DC at more than 28V and 2A, you will need a bigger relay. Any relay that has (a) a coil rated for 5V DC, and (b) a coil current of 50 mA or less, will work. Here are some suggestions.

Omron G6M-1ADC5: can switch 3A.
Omron G5T-1ADC5: can switch 5A. Coil current 40 mA.
Panasonic ALQ305: can switch 10A. Coil current 40 mA.
Omron G5Q-1ADC5: can switch 10A. Coil current 40 mA.
Omron G5Q-1A4DC5: can switch 10A. Coil current 40 mA.
Panasonic ALE75B05: can switch 16A. Coil current 40 mA.
Panasonic ALE75F05: can switch 16A. Coil current 40 mA.

C1 and C3 are decouplers; see the notes for C3 and C4 in the transmitter.

Q2 can be any of the types listed. If you're already getting a BC337-40 for the transmitter, you might as well use one here too.

D1 protects Q2 from damage when Q2 turns off and the supply to the relay coil is interrupted, by clamping the back EMF voltage from the relay coil. It is specified as 1N400x. This means any member of the 1N400x series, from 1N4000 to 1N4007 inclusive.

C4 is a power supply smoothing capacitor, like C5 in the transmitter. It must be rated for 10V or more. C2 has less than 1V across it.
 
Last edited:
Here are the doubts I'm having (just a little after your clear and detailed explanation) :)

Receiver :
1) Why is C2 arranged in different way compare to original? (Originally, positive to ground but yours is positive to the source)

2) R6, 2K2 means 2002ohms?

3) Q2 - I got BC548 instead of BC547B
U1 - I got HCF4017BE instead of CD4017BE
Can you please help me check whether the components I'm having now is ok to replace the one you mentioned in your schematic? Are they working in the same ways? If no, I will go get the BC547B & CD4017BE, no problem for me :)

4) Any idea on getting 5V of supply?



Transmitter :
Thanks to your clear explanation and it got me understand the overall schematic much, much quicker :) But I'm having some problem with the Pierce Oscillator and U1.

I've not learned about this and so I just checked them on wikipedia (http://en.wikipedia.org/wiki/Pierce_oscillator). Not really understand at the section of "Biasing Resistor". Anyway, I will do more research.

1) My question is, at pin 1, is the signal 0? And is it then inverted and come out as "1" at pin 2? Then is inverted to "0" again then enter CLK??

2) The signal entering CLK of U2 (from pin 12 of U1) is 455 kHz while the signal entering pin 11 of U1 is 37.91667 kHz (after being divided by 1100 binary), am I right?

3) And I'm wondering how the current flowing in the oscillator and U1.

4) Is the current having phase angle of 38kHz? Or else how the IR LED emit IR with 28kHz?

I'm very sorry of having low understanding on that particular section :/ You may find my analysis on that section sound ridiculous. Haha. Thanks for the circuit, will start hunting for the components :)
 
Top