I need to connect dozens of sensors based on QRD1114 to a central location. Don't need a super fast system. Every sensor must be read once every second.
So I imagine I would need to connect every mux to a i2C or SPI board and then each slave to a master Arduino.
How about feeding each 4067 output into 1 of the 8 inputs on a MCP3208,
and let an arduino select which output (4 pins to 4067) goes into the MCP3208 and which channel is then selected (SPI command, 4 pins). Leaves 12 pins free - keep 2 for serial, still have 10 pins free.
Can have several MCP3208 connected, just need an additional chip select for each one.
16 4067 into 8 channels = 128 inputs, 10 2/3 dozen.
Need more? Add a 2nd MCP3208 for another 128.
MCP3208 needs far fewer clocks (I think 12uS total) to obtain a signal than internal ADC (110uS).
If slower ADC is acceptable, than a Promini (or board with a surface mount '328 chip) with A6/A7 broken out can also handle the outputs from 8 4067's.
Thanks for the reply, but not being good in electronics, I’m perhaps missing something or not being clear myself.
I’ve attached a high level sketch of what I’m planning.
I have one “module”, let’s name it A. It has 12 QDR1114 IR photo sensors. In order to make the solution work, I need somethign between 6 to 30 modules.
So that’s the idea of make “stand-alone” modules, each one in a certain way independent from the other. This makes setup easy, as you only need to add more modules to teh system and in case of failure, it’s easy to diagnose and replace.
The idea of using the Pro Mini 328 (5v) is also interesting, but I would need to put 2 per “module”, as I need 12 sensors. And then connect everything via I2C. Depending on costs it seems interesting, as I might have more inteligence at each module.
Thanks for that. I checked that one, but since I need to get 12 analog sensors per "module" (as on the image), I would need 3x ADS1115 for the task, making the solution more expensive.
I may be wrong, but I think that using this solution I can only have a limted number of elements on the I2C bus.
If you use the 4 -channel ADS1115
and the 16 channel multiplexer,
and read four sensors with each ADC channel (sensors 1-4 => inputs 1-4 => ADC CH-1
(sensors 5-8 => inputs 5-8 => ADC CH-2
(sensors 9-12 => inputs 9-12 => ADC CH-3
(sensors 13-16 => inputs 13-16 => ADC CH-4
At first glance this doesn’t seem any better than multiplexing all 16 channels to one ADC channel.
The values would need to stored in an array and then displayed after “n” samples are averaged.
I was doing some tests with one QRD1114, but something might not be right on the emiter.
Testing it with the curtains open, you can see the values changing as I move from light to shadow. But if I close the windows to avoid any IR radiation from the sun, I get no response from the receiver. Even if I disassemble it and put one in front of the other I just get 0 as response.
In the mean time, I was checking a solution with push buttons and might me a solution as well, and it's working. The components are also cheaper.
I'll give it another try on the QRD1114. I ordered a few more components, as I might have got a bad one.