Electronic – Reading Array of Phototransistors With Raspberry Pi

adcphototransistorraspberry pi

For a project I'm working on, I need to read the values from a matrix of phototransistors (8×16) into the Raspberry Pi.

I'm not exactly sure how to go about doing this, since I know I need to include an ADC somewhere in there. If I use shift registers to read the values from the phototransistors, how can I incorporate the ADC in there?

The problem is the ADC interface. I'm looking at the MCP3008, which apparently uses an SPI style interface. If it was just a simple analog in -> digital out style interface, it wouldn't be a problem.

Best Answer

To read 8 rows of 16 analog inputs, you should consider using 8 CD74HC4067E analog multiplexer chips. To gather their 8 output voltages, I can think of a few options:

  1. Use (part of) a ninth 4067 chip in mux mode. Connect the 8 analog outputs to the first 8 analog inputs of the ninth 4067. This is probably the cleanest, least hacky solution.

  2. Use (part of) a ninth 4067 as an 8 bit binary decoder to drive the output enable pins on the other chips, and just tie their outputs together. This would probably be easier to route, and may have lower distortion since the signal is only going through one mux chip instead of two.

Either way, you will have a 7 bit address that you need to generate. If you don't have enough output pins free, you could:

  1. User an 8 bit serial in parallel out shift register to drive the output enable pins on the 8 4067's, maybe another one to drive the address pins on the 4067's if you're really desperate for pins.

  2. Most "8 channel" ADC's are actually a single channel ADC with an 8 port analog mux built-in. They are usually lower spec, but if it works, one of these, plus the 8 4067's would probably be your lowest part count option.

Depending on your signal levels and how fast you need to operate, you may need to add an op-amp or buffer between the multiplexers and your ADC.

Note, I haven't tried any of these yet, but parts are in the mail (I'm working on something similar).

Update: If you want more noise robustness, you could run the sensing part of your circuit at a higher voltage and use DG506B mux chips instead.