3

I need to generate en (extended) NEC signal. I have connected an Arduino with a display-device via an IR cable.

Arduino --> IR-cable --> IR-input of display device

IR-cable: IR Cable datasheet

One plug is cutted and the 3 wires are connected with the arduino.

The arduino should generate NEC Signals, and the display shall react to it. Basically the arduino acts like a wired remote control.

The problem is: There are many tutorials around, that show how to do this with a sensor (e.g by using this library). But none of the tutorials says how to do it with a cable.

I found out, my previous attempts all failed, because I tried to generate a modulated NEC-signal to the display. The display however does not understand it, because there is no device that demodulates the signal. The IR sensor normally does this, which is missing in this case.

e.g. This is, what an modulated NEC signal looks like:

00 4e ff 61

The library generates the moduled signal (pulse bursts) and this is how it works for IR sensors.

But how do I have to send my IR-command, that the display understands it? How do I send a not-modulated IR signal?

The following graphic demonstrates the issue:

IR

I do not have IR-LED Transmitter, Amplifier, Limiter, Band Pass Filter, Demodulator, Integrator, Comparator.... I just want to create the green Output-signal directly from my Arduino

  • Does this cable thing have a datasheet? – Majenko Dec 10 '15 at 14:57
  • I have updated my post – Michael B Dec 10 '15 at 15:07
4

There are two major components to an infra-red signal. One is the high frequency carrier wave signal that pulses the LED on and off. This frequency has to match that of the receiver and is used with either a high-pass or band-pass filter to filter out ambient IR light and allow it to only react to a real signal.

The second component, and it sounds like this is the one you are interested in, is the on-off pulsing of that carrier wave in different combinations and with different timings to denote binary 0 and 1.

Without knowing what your cable actually is, and we'd need to see a datasheet to get all the proper information, all this is just surmising.

I would imagine that you provide power and ground to the emitter cable, and the third pin is a logical "on/off" signal that enables and disables the carrier frequency to the LED. That would allow you to send any codes you like as long as you know the timing of the signal.

In the library you link to is all the timing you need in the ir_NEC.cpp file. The times are defined as:

#define NEC_BITS          32
#define NEC_HDR_MARK    9000
#define NEC_HDR_SPACE   4500
#define NEC_BIT_MARK     560
#define NEC_ONE_SPACE   1690
#define NEC_ZERO_SPACE   560
#define NEC_RPT_SPACE   2250

The actual data format is defined in the sendNEC function:

void  IRsend::sendNEC (unsigned long data,  int nbits)
{
    // Set IR carrier frequency
    enableIROut(38);

    // Header
    mark(NEC_HDR_MARK);
    space(NEC_HDR_SPACE);

    // Data
    for (unsigned long  mask = 1UL << (nbits - 1);  mask;  mask >>= 1) {
        if (data & mask) {
            mark(NEC_BIT_MARK);
            space(NEC_ONE_SPACE);
        } else {
            mark(NEC_BIT_MARK);
            space(NEC_ZERO_SPACE);
        }
    }

    // Footer
    mark(NEC_BIT_MARK);
    space(0);  // Always end with the LED off
}

The mark and space functions take a number of microseconds to perform either an ON or OFF of the PWM signal. That is somewhat simpler for you, since it is just an ON or OFF of a digital IO pin to control the output of the emitter cable. So where you have a MARK you turn on the output, then delay for the specified time. For a space you turn off the output and again delay for the specified time.

So you can just replicate the operation of that sendNEC function but with your own output control and timing in it instead of using the functions in that library.


Edit: It seems the cable doesn't need power - just provide the ground connection and the signal connection. Of course, this is assuming that it isn't just an LED on a wire. If it is just an LED on a wire then you would need to just use the library you link to as it is.

  • You probably want to make sure the voltage level of the power wire is the same as the arduino. Otherwise you should buffer the signal. – Gerben Dec 10 '15 at 16:28
  • @Gerben Everything should be made clear by the datasheet that doesn't seem to be forthcoming. – Majenko Dec 10 '15 at 16:29
  • "So you can just replicate the operation of that sendNEC function but with your own output control and timing in it instead of using the functions in that library." This is exactly the point. I do not know how my own output should look like. I don't really understand the difference between "modulated" and "unmodulated"-signals. So how for example does my code 004eff61has to be sent? – Michael B Dec 11 '15 at 9:58
  • Voltage Level of cable and arduino are both 5V – Michael B Dec 11 '15 at 9:59
  • The difference between modulated and unmodulated is that the modulated is a series of pulses of a pwm signal, and unmodulated is a series of pulses of just steady 5v. – Majenko Dec 11 '15 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.