Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem to invert Infrared signal

Status
Not open for further replies.

savannahlexus

Newbie level 4
Joined
Oct 5, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,379
I've build an infrared repeater which was able to receive and transmit infrared signal to IR LED (refer to the diagram "Original"). For some reasons, instead of transmitting thru IR LED, my circuit need to connect the IR LED output pins directly to the pins of another IR receiver (i.e. "IR receiver B"). I learnt that the IR signal need to be inverted (i.e. HIGH -> LOW and vice versa) in order to simulate the signal received from IR receiver, so I add an invert circuit (i.e. NOT gate) in between.

The circuit is shown as follows:

**broken link removed**

And the invert circuit is shown below:

**broken link removed**

My problem is when the circuit directly transmit thru IR LED (refer to the diagram "original"), the signal was absolutely alright. When an invert circuit was added (refer to the diagram "New"), the IR signal become very unreliable. The IR signal was still occassionally able to transimit to the equipment but the success rate dropped to only about 30%. I have used BC548 NPN transistor in the invert circuit.

I'm an electronic beginner, any clue to improve the circuit?
 

Your receiver looks like one of those 3 pin receiver chips (because you draw 3 wires coming out of it). Is my guess right?

If so, then the IR Repeater output would be 38KHz (or 36 kHz or 40kHz - guessing again) for a mark and nothing for a space. 3 pin receiver output however would be low for a mark and high for a space, with no modulation.

All guesswork though until you tell me all about the component you list as "IR Receiver"

If my guesses are right, then the second circuit will never work correctly, as you are feeding a signal that is modulated with (say) 38kHz into a device that expects un-modulated signal

Check out this site to see what I am talking about:

https://www.sbprojects.com/knowledge/ir/index.php

Can't see any obvious problem with your inverter circuit, except that using Vs as common connection is unusal (I assume Vs is +5V?). I would have had a common ground to connect to "equipment"

EDIT: can you provide information about the repeater, about the equipment and about the sending device? The information so far is very sketchy.
 
Last edited:

Can you scope the signals? Any symmetry error caused by unequal latency for rising edges? Any overshoot affecting AGC in Rx chip? Any false transitions?
I would use a more symmetrical driver for the LED such as common collector after common emitter.

Basic troubleshooting.. Check sensitivity to signal level, high vs low, fading off walls etc. Also make sure Rx chip has good cap near chip with no ripple.
 

Your receiver looks like one of those 3 pin receiver chips (because you draw 3 wires coming out of it). Is my guess right?

If so, then the IR Repeater output would be 38KHz (or 36 kHz or 40kHz - guessing again) for a mark and nothing for a space. 3 pin receiver output however would be low for a mark and high for a space, with no modulation.

All guesswork though until you tell me all about the component you list as "IR Receiver"

If my guesses are right, then the second circuit will never work correctly, as you are feeding a signal that is modulated with (say) 38kHz into a device that expects un-modulated signal

Check out this site to see what I am talking about:

http://www.sbprojects.com/knowledge/ir/index.php

Can't see any obvious problem with your inverter circuit, except that using Vs as common connection is unusal (I assume Vs is +5V?). I would have had a common ground to connect to "equipment"

EDIT: can you provide information about the repeater, about the equipment and about the sending device? The information so far is very sketchy.


Hexreader. Thanks you for your advice. Your guess is right. The receiver chip is 3pins and the repeater output is 38K.

About the repeater, it was built on Arduino and an IR library provided by Ken Shirriff:

http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html

The whole purpose of building the repeater is to overcome a limitation of my existing IR repeater (I bought it from Taobao). I want to use the IR repeater to control the AV equipment (located in sitting room) from my bed room. However I'm having two identical LCD TV in sitting room and bed room. So everytime I turn on TV in my bed room, the same IR signal repeated to sitting room. This makes the TV in sitting turned on unwantedly. Therefore I got an idea to add an additional IR repeater, which would only repeat some pre-defined IR signal. Those from the TV will be ignored and would not be repeated to the sitting room. This special IR repeater built on Arduino does works if it transmits thru IR LED. However, to avoid laying the cable again, I want to build on my existing IR repeater. That's why I try to feed the IR signal into the pins of IR receiver (i.e. receiver B). This is the whole story.

Here is the my Arduino sketch. I have just learnt Arduino for few weeks.

**broken link removed**

In fact I've tried inverting the output within my "special IR repeater" but I failed because I don't even understand all those Timer and PWM statement in Ken Shirriff's library. I've exacted those relevant part and see if you or someone could help:

IRremoteint.h

...
...
// defines for timer1 (16 bits)
#elif defined(IR_USE_TIMER1)
#define TIMER_RESET
#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1))
#define TIMER_DISABLE_PWM (TCCR1A &= ~(_BV(COM1A1)))
#define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A))
#define TIMER_DISABLE_INTR (TIMSK1 = 0)
#define TIMER_INTR_NAME TIMER1_COMPA_vect
#define TIMER_CONFIG_KHZ(val) ({ \
const uint16_t pwmval = SYSCLOCK / 2000 / (val); \
TCCR1A = _BV(WGM11); \
TCCR1B = _BV(WGM13) | _BV(CS10); \
ICR1 = pwmval; \
OCR1A = pwmval / 3; \
})
#define TIMER_CONFIG_NORMAL() ({ \
TCCR1A = 0; \
TCCR1B = _BV(WGM12) | _BV(CS10); \
OCR1A = SYSCLOCK * USECPERTICK / 1000000; \
TCNT1 = 0; \
})


IRremote.cpp

...
...

void IRsend::sendNEC(unsigned long data, int nbits)
{
enableIROut(38);
mark(NEC_HDR_MARK);
space(NEC_HDR_SPACE);
for (int i = 0; i < nbits; i++) {
if (data & TOPBIT) {
mark(NEC_BIT_MARK);
space(NEC_ONE_SPACE);
}
else {
mark(NEC_BIT_MARK);
space(NEC_ZERO_SPACE);
}
data <<= 1;
}
mark(NEC_BIT_MARK);
space(0);
}

void IRsend::enableIROut(int khz) {
// Enables IR output. The khz value controls the modulation frequency in kilohertz.
// The IR output will be on pin 3 (OC2B).
// This routine is designed for 36-40KHz; if you use it for other values, it's up to you
// to make sure it gives reasonable results. (Watch out for overflow / underflow / rounding.)
// TIMER2 is used in phase-correct PWM mode, with OCR2A controlling the frequency and OCR2B
// controlling the duty cycle.
// There is no prescaling, so the output frequency is 16MHz / (2 * OCR2A)
// To turn the output on and off, we leave the PWM running, but connect and disconnect the output pin.
// A few hours staring at the ATmega documentation and this will all make sense.
// See my Secrets of Arduino PWM at http://arcfn.com/2009/07/secrets-of-arduino-pwm.html for details.


// Disable the Timer2 Interrupt (which is used for receiving IR)
TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt

pinMode(TIMER_PWM_PIN, OUTPUT);
digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low

// COM2A = 00: disconnect OC2A
// COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
// WGM2 = 101: phase-correct PWM with OCRA as top
// CS2 = 000: no prescaling
// The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A.
TIMER_CONFIG_KHZ(khz);
}

void IRsend::mark(int time) {
// Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency.
TIMER_ENABLE_PWM; // Enable pin 3 PWM output
delayMicroseconds(time);
}

/* Leave pin off for time (given in microseconds) */
void IRsend::space(int time) {
// Sends an IR space for the specified number of microseconds.
// A space is no output, so the PWM output is disabled.
TIMER_DISABLE_PWM; // Disable pin 3 PWM output
delayMicroseconds(time);
}
 

Can you scope the signals? Any symmetry error caused by unequal latency for rising edges? Any overshoot affecting AGC in Rx chip? Any false transitions?
I would use a more symmetrical driver for the LED such as common collector after common emitter.

Basic troubleshooting.. Check sensitivity to signal level, high vs low, fading off walls etc. Also make sure Rx chip has good cap near chip with no ripple.


Sorry that I'm totally a beginner and I don't quite understand your meaning. I don't have oscilloscope but I also believe it is latency or sensitivity of the the IR signal. You have mentioned putting a cap in Rx chip. Would you elaborate what exact you mean?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top