Interactive Single Color LED Matrix

designledraspberry pi

I'm trying to build an LED matrix (32×16) that lights up in certain areas in response to movement, as detected by another matrix (8×16) of infrared phototransistors.

Here's where I'm at:

  • Main controller: I chose the Raspberry Pi. It would give me the ability to control the LED matrix using other, more complex methods (ex/ drive from music, over the internet, etc) as compared to a simpler controller (Atmega, PIC, etc).
  • LEDs: single color LEDs in a matrix configuration, each column controlled by a transistor that allows the power to that column to be controlled by the Raspberry Pi. The matrix will use 74hc595 shift registers so it can be controlled using only 3 pins from the RPi.
  • Detectors: Will consist of 2 arrays; one of infrared phototransistors, and one of infrared LEDs. The IR emitters will be connected to power through a single transistor, giving the controller all on/all off options for the IR emitters. The detectors will consist of a matrix (8×16) of IR phototransistors. An object near the detectors will reflect IR light from the emitters onto the detectors, thus changing the resistance of the phototransistors, triggering action from the RPi.

So that seems great, but here's where I'm stuck: I don't know how to get the RPi to read that many values. For the outputs (digital) it was as simple as using shift registers. Does anyone have any ideas of how to get that many analog inputs into the RPi?

*An important piece to note is that the RPi lacks an ADC, so I would need to add my own IC for that.

Best Answer

You can get ADCs that have multiple inputs and speak SPI, eg: http://cds.linear.com/docs/en/design-note/dn274f.pdf (randomly selected example, in general Linear are good for this sort of IC)

So, build a matrix of phototransistors. Put the ADC across the columns and energise a row. Read off a set of values.

(This solution may require investigating what the minimum response and sample time of the phototransistors is)