Close

pin money

A project log for Over-engineered LED strip controller

Way too much stuff to light my garage MY way.

WJCarpenterWJCarpenter 08/06/2017 at 21:420 Comments

Well, I've done it again. With all the bells and whistles, I don't have enough GPIO pins on the NodeMCU. Here's what I need right now:

4 outputs with PWM

8 inputs with interrupts

2 outputs with simple on/off

That's 14 pins, but the NodeMCU only has 13 available. If I deduct the two pins used for the serial console (in case I need that for debugging), there are only 11 available.

Here are some strategies I am contemplating for handling this:

Before I started pondering the above, more fruitful, options, I was thinking about more traditional pin count solutions. I could mux the plain on/off outputs with a SIPO shift register, but that's pretty boring since there are only 2 of those outputs. I thought about some way of multiplexing the PWM outputs but didn't get very far down that path. 

The 8 inputs that need interrupts seem ripe for consolidation. There is such a thing as an 8-input OR gate in a 16-pin package (for example http://www.ti.com/product/cd4048b). That could tell me if some interrupt occurred. I could run the same 8 inputs to a PISO shift register and read them out as the first part of the response to an interrupt. That's pretty simple, but also simple-minded because it ignores a few edge cases. Luckily, in this application, I can tolerate a lost interrupt here and there. (I also briefly looked for an interrupt controller, but it seems the world didn't any simpler than the Intel 8259. Besides being a pretty big chip, it also seems pretty complicated. I grant you, it does some pretty sophisticated things. I just don't need those things.)

Discussions