So (as some of you who have been a lot of help to me already have probably figured out...) I am working on this massive sensor array thingy.
I have my PCB's etched, my smd components soldered, all I am waiting for is for some more multiplexers before the whole thing is done. (for some reason customs or sparkfun or somebody does not want me to finish this. Its been in the mail for almost 3 weeks :-(...)
Anyway, I do have one multiplexers which I put into the circuit, and I should be able to test 16 sensors at a time. It does not work as expected.
About half of the sensors give me the readings I expect. The other half give readings which look reasonable: i.e. the arduino usually outputs ~1024 and when exposed to ambient light, the values drop more or less as one would intuitivly assume they should.
In truth however, there appears to be some sort of leakage. For example: Sensor 2 will just stay at around 1024. Even if I should get readings of 100 or less, it stays at 1024. But if Sensor1 is activated (i.e. Sensor1 value sinks to under 100), then sensor2 to will also respond, sink to about 200, even if it should not.)
Ok, here is a sketch of the circuit, so you know what I am talking about:
(the multiplexer circuit is just copied off of the sparkfun brakout board: http://www.sparkfun.com/datasheets/BreakoutBoards/Analog-Mux-Breakout-v10.pdf)
Possible reasons that I can think of:
a) There is a problem with my logic, and this circuit is wrong. b) There is a problem with my PCB, I have some connections which should not be there. (dont think thats the case. I checked this extensivly. Everything seems as it should be) c) I am pulling more power than the arduino can handle (in retrospect, maybe I should have used stronger resistors for the voltage dividers?). d) I fried some sensors when soldering (sort of doubt that). e) I fried the multiplexer when soldering it (How fragile are they? I have no experience how a semi-fried multiplexer could behave...) f) The code is whack. (pretty sure that is not the case. I used a modified version of this code: http://bildr.org/?s=mux)
Ok, about the power options. The sensor I am using is actually an IC with a led and a photodiode. The led is controlled by a separate circuit with its own power, that’s why Its not in the sketch I posted above. However, because of this, the datasheet confuses me, cause I never know which values refer to the sensor and which to the emitter. The datasheet can be found here: http://www.fairchildsemi.com/ds/QR/QRE1113.GR.pdf
These are the values which I think are relevant, but I am not realy sure:
Collector Emitter Voltage 30V Emitter Collector Voltage 5V Collector Current 20ma
I am running all of the sensors in parallel, so its 320ma, so I should be fine for now, right? The arduino can supply that current with the 5v pin, correct? I just double-checked the specs of the arduino mega and did not actually find any information on that. But then there are those 10k resistors which I don’t really know how to factor in :-/
Ok, I guess this already is quite a large "help me" post. If someone could take a look at this and help me eliminate the possible problems, or even point out new ones, that would be great. I am waiting until I get the other multiplexers tomorrow, before I do more trouble shooting, but any suggestions which will help me solve this are appreciated.