1

I have been working on a small project recently. I have a circuit like in the image below:

Hardware Setup Demultiplexer IR Test

enter image description here

As you can see I have 8 IR LEDs, which are driven by an MC14051B Multiplexer/Demultiplexer. My goal is to select each IR led individually and send data over the selected IR LED. None of the other LEDs can send signals. Only one LED at a time can be sending IR codes.


Hardware Setup Single IR Test

enter image description here

Below is the code I used to send the signal using the IR Library over one LED (no demultiplexer was used in this test).

// New function to send 'items' codes which are held in the array 'data'
void sendMulti (const uint8_t& items, const uint32_t* data) {
  for (int i = 0; i < 2; i++) {
    for (uint8_t itemIndex = 0; itemIndex < items; ++itemIndex) {
      irsend.sendNEC(data[itemIndex], 32);
      delay(1000);
    }
  }
  delay(5000); //5 second delay between each signal burst
}

void loop () {
  static const uint8_t MaxItems = 3;
  uint32_t  data[MaxItems] = {0x1067E21D,0x106722DD,0x106722DD,0x106722DD,0x106722DD,0x106722DD,0x106722DD,0x10676897,0x10676897,0x10676897,0x10676897,0x10676897,0x10676897,0x10678877,0x10676897,0x1067A857,0x1067A857,0x10678877,0x1067A857};
  sendMulti(MaxItems, data);
}

The Single IR Test was a success. However now I want to use the demultiplexer. Any advice or pointers will make me very happy.

migrated from stackoverflow.com Feb 13 '17 at 9:24

This question came from our site for professional and enthusiast programmers.

  • Explain the usage of pin A0. – Mikael Patel Feb 13 '17 at 23:47
1

The most important document you have to read is called a datasheet. Here you can find the MC14051's.

I assume you already know how a mux/demux work, so... Well, you have eight LEDs, one on X0, another on X1, ... up to X7. The one connected to the pin X, which is your A0 (the pin used on irsend, I assume) is indexed by the three inputs A, B and C.

On page 5 you see the truth table. According to that table, you have to write a 0 on inhibit, and the value on ABC. So, to select led on X0, you have to write 0 on pins 7, 8, 9 and 10. If you want to select led X1, 8 should go high. For led X7, 8, 9 and 10 should be 1, while 7 is low. And this is for all the combinations...

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.