I have an idea where I need to read data from many, many, many analog inputs. Sure, there are bigger Arduino boards (MEGA) and there are MUX-solutions. But taking the Uno as example, I can connect 6 Analog inputs, each of them connected to a 16 channel multiplexer, which will give med 96 analog inputs. A simliar calculation would give me 512 channels using the MEGA.
But what if I said I need 5000 inputs, how would I solve that?
Is there a way I can "cluster" multiple Arduino boards and have them to work together, i.e. report the result of all 5000 inputs as one sampling?
5000 inputs? What is the application if you do not mind me asking?
In theory you could have a giant mux array and squash all the inputs down to 1 analog input pin. The performance would likely be terrible but if you do not need a fast refresh rate on each input it may work.
I do not know, however, what kind of draw backs there might be in terms of signal quality w/ piping a signal through a large number of muxing stages.
jwallinder:
Maybe I should not use Arduino for this...?
Probably not. To sequentially read 5000 inputs would be time consuming but to read them all at the same time is not something the arduino is suited to without a lot of external hardware.
My application is like this proximity sensing coffe table http://www.instructables.com/id/Infrared-Proximity-Sensing-Coffee-Table-Module/
But with a much higher resolution. I'm thinking of using photosensors (diode, transistor or resistor?).
To achieve high resolution in aspect of length I need many many many of them...
jwallinder:
My application is like this proximity sensing coffe table http://www.instructables.com/id/Infrared-Proximity-Sensing-Coffee-Table-Module/
But with a much higher resolution. I'm thinking of using photosensors (diode, transistor or resistor?).
To achieve high resolution in aspect of length I need many many many of them...
But someone here might have a better solution?
Cool. I recently completed pretty much the same projects. It only had 128 sensor nodes though and I was able to mux them down in a 2-stage 16:1 mux ( 8:1 followed by 2:1 ) for each of the 8 analog inputs I used. For 128 nodes I had no problems with the performance on a Due but 5K is way more. What resolution / size is this thing going to be?
bad_crc:
Cool. I recently completed pretty much the same projects. It only had 128 sensor nodes though and I was able to mux them down in a 2-stage 16:1 mux ( 8:1 followed by 2:1 ) for each of the 8 analog inputs I used. For 128 nodes I had no problems with the performance on a Due but 5K is way more. What resolution / size is this thing going to be?
Really cool project.
For what I can see, the resolution of the inputs is a little less than I have in thought. Looking at your video http://youtu.be/6ytknUFyIfs?t=9m32s I would say I would like a more smooth style of the diodes that is lighten up. Maybe an increase of 50% would be enough. I need to prototype this to find the best resolution for my case. Start small! And also, my project is of a size about 4 times your coffe table.
I would appreciate more info how you have solved it, the 2-stage 16:1 mux for instance. Maybe som code sharing etc? I have read your tumblr-blogg, but I'm missing som details.
16 into 16 into 1 ADC would be a lot of chips on one board.
Probably want to go surface mount.
Lot of input wires to bring into 1 place.
Maybe do 20 boards with 32 muxes, 2 ADCs, then can spread out a little more and only have 256 inputs into each card. Connect up SPI bus between cards in smart way.
jwallinder:
Really cool project.
For what I can see, the resolution of the inputs is a little less than I have in thought. Looking at your video http://youtu.be/6ytknUFyIfs?t=9m32s I would say I would like a more smooth style of the diodes that is lighten up. Maybe an increase of 50% would be enough. I need to prototype this to find the best resolution for my case. Start small! And also, my project is of a size about 4 times your coffe table.
I would appreciate more info how you have solved it, the 2-stage 16:1 mux for instance. Maybe som code sharing etc? I have read your tumblr-blogg, but I'm missing som details.
The 16:1 mux per analog input pin is done with 3 ICs. I have 2 4051 8:1 muxes taking in 16 inputs and reducing down to 2. The outputs of those feed 2 channels on a 4053 2:1 mux whose output feeds an analog pin on the Arduino. I have 4 select lines fed from digital outputs on the Arduino. The 3 least significant bits for the 4-bit select vector feed the 3 select inputs on the 4051. The 4th bit (MSB) for the selects feeds the 4053 select pin.
As far as code, I have the inputs read via a timer interrupt sequence. Each time the interrupt fires, all 8 analog inputs are read and the data stored out into an array I have for all 128 nodes. Inside the interrupt I also update the mux selects so that the next time the interrupt occurs, I'll be reading the values from the next 8 sensors. This process just repeats over and over when I'm in a mode where I care about the IR sensors. When not in IR sensing mode, I just disable the interrupt and turn off the IR LEDS.
Here's the code for the interrupt.
// interrupt routine to read IR array
void TC4_Handler() {
TC_GetStatus(TC1, 1);
// now read analog inputs and store sense data into sense array
ir_sense_data[64 + ir_group_adder] = analogRead(A0);
ir_sense_data[80 + ir_group_adder] = analogRead(A1);
ir_sense_data[96 + ir_group_adder] = analogRead(A2);
ir_sense_data[112 + ir_group_adder] = analogRead(A3);
ir_sense_data[0 + ir_group_adder] = analogRead(A6);
ir_sense_data[16 + ir_group_adder] = analogRead(A7);
ir_sense_data[32 + ir_group_adder] = analogRead(A4);
ir_sense_data[48 + ir_group_adder] = analogRead(A5);
// update sensor group and mux selects for next time through
if (ir_group < 15 ) {
ir_group++;
} else {
ir_group = 0;
}
ir_group_adder = (ir_group >> 1) + 8*(ir_group & B00000001);
// update mux controls for next round ( 4 bit mux control )
digitalWrite(sense_select0, bitRead(ir_group, 3)); // sense mux MSB
digitalWrite(sense_select1, bitRead(ir_group, 2));
digitalWrite(sense_select2, bitRead(ir_group, 1));
digitalWrite(sense_select3, bitRead(ir_group, 0)); // sense mux LSB
}
I have 16 "sense groups" of 8 sensors. The ir_sense_data[] array stores the analog read data ( 8-bit resolution ). The indexing into the array is a little weird just based on how I have my muxes and IR nodes connected physically. So I read from 1 sense group each time through and my interrupt runs every 6ms or so IIRC so I get a full refresh of all the sensor values every ~50ms. It seems to give good enough responsiveness for object detection.