Davros- wrote: ↑Fri Apr 06, 2018 6:03 pm
The appeal of using less GPIO pins is powerful. Especially as I may want to attach buttons, swtiches, etc to the same Pi unit later. I did not realize that I could use all the IR emmitters at once with the AND gate chip though. That is not that important, but it has appeal for sure. Additionally, I did not realize the need for transisters on the demultiplexer chip and it would be nice to avoid soldering those on a bunch of wires.
Actually you should use the transistor with the AND gate as well.
To properly drive the IR LED you'll need typically around 20mA (it depends on the LED, you'll have to check the datasheet).
74HCxx and 74HCTxx chips are designed to source/sink typically around 4-5mA and although the absolute maximum spec is around 20-25mA I'd not recommend to go that far - if you exceed the limits you could damage the chips.
74LSxx can source even less current, typically less than 0.5-1mA (this is when you connect the LED + current limiting resistor between 74LSxx output and GND). But it can sink quite a bit more, typically around 15mA (when you connect the LED between VCC and 74LSxx output - eg in if you use inverting outputs).
There are 74xx chips that are designed as buffers/drivers can source/sink higher currents but they might be harder to get and/or you need separate driver chips, in addition to the AND/demuxer.
Using a transistor is probably easier and work with all setups, without you having to do a lot of research.
Reared your original post and it was very good, giving specific instructions, but I want to make sure I interpretted it correctly due to my lack of knowledge on the subject. If I were to use the 74HC08 chip I would use in total Power (3.3v), Ground, plus 5 other GPIO pins. Is that correct?
Yes.
When you say "output GPIO (18) to one input of each AND gate" I believe you mean solder 4 small wires to the wire going into GPIO pin 18, thus only using one GPIO pin to control the four AND gates. Is this correct?
Yes. This GPIO will be used in all 4 AND gates.
With the 74HC08 I can both control the IR LEDs individually and all at the same time? I realize you described the abilities of this approach but this aspect is important enough that I wanted to read it again to be sure before I commit.
Yes. Think of this chips as electrical versions of boolean logic - just like you have in programming languages. Each 74xx08 chip contains 4 AND gates, so you'll have
IROUT AND GPIO1
IROUT AND GPIO2
IROUT AND GPIO3
IROUT AND GPIO4
(GPIO1-4 just being arbitrary numbers, to illustrate what it'd look like)
By setting GPIO1-4 you can choose any combination of active inactive LEDs 0, 1, 2, 3, 4 - whatever you like/want.
If the above is correct, then I would still have a bunch of GPIO pins left to use. Super duper embarassed to ask this, but I am not sure if I can use the specific function GPIO pins as general purpose pins. Pins like Physical pin 8 (BCM 14) is a UART pin and Physical pin 19 (BCM pin 10) is a MOSI pin. Can they can be used for general purposes as well? I realize that if the answer is yes some configuration changes to the Pi may be needed in a few cases such as disabling the serial console to use an UART pin.
Yes, you can repurpose these as well. In addition to ALTx all the GPIOs (if I'm not mistaken) can be configured as normal GPIOs as well.
so long,
Hias