Reading 10+ LDR with Arduino

Hey Folks,

I am brainstorming for a project that I am about to do, and It would need me to read 10+ LDRs. As There arent that many analogue input pins, whats the workaround that I can put to use? :(

Thanks :)

Use a Mega

AWOL: Use a Mega

I am assuming there is a workaround than buying another Arduino. :~

AWOL: Use a Mega

Too expensive, and the guy already has an Arduino (not Mega, I suppose)

My suggestion is to use a multiplexer IC, like the CD4051.

Personally, I like and use the MAX4617 (datasheet)

External analogue muxes, like a couple of 4051.

Too expensive, and the guy already has an Arduino

He never stated that.

As There arent that many analogue input pins

By that, I meant I had an Arduino. Sorry for not making it clear. I have an Arduino UNO R3.

So a multiplexer is what I should use?

Since I am new to all these, can someone give me a little insight? a circuit diagram or something so?

Cheers! :)

http://playground.arduino.cc/learning/4051

Is this for a (low res) vision sensor?

I remember seeing something like that on BBC Click that controlled an array of mirrors (I think)

AWOL:
http://playground.arduino.cc/learning/4051

Seems like this is what I am looking for :smiley:

Can I breadboard it? or it should be bought as a chip? (For both saving money and for satisfaction of doing it.)

You can breadboard it with just the chip.

The CD4067 has 16 "inputs" if you need more than 8

MikMo: You can breadboard it with just the chip.

The CD4067 has 16 "inputs" if you need more than 8

8 would be fine, 16 would be better if there isnt much price difference with the chip.

Sorry for asking this, but I will appreciate a right circuit diagram for bread boarding it, because I am new to this. I tend to make mistakes when it comes to where I should be applying the voltage and so. (Happened before :D )

Thanks a lot :)

ADD : Or the 4051 would be fine because after a bit of reading, I see the 16 inputs one needs 4 pins from my arduino.

xkishorx: ADD : Or the 4051 would be fine because after a bit of reading, I see the 16 inputs one needs 4 pins from my arduino.

of the 4 pins required, 3 of them are digital pins, OUTPUT, used to select which input in the 4051 (or 4050) is to be read. The other pin is one of the Analog inputs of the arduino that will receive the output of the 4051 for its selected input.

AlxDroidDev:

xkishorx: ADD : Or the 4051 would be fine because after a bit of reading, I see the 16 inputs one needs 4 pins from my arduino.

of the 4 pins required, 3 of them are digital pins, OUTPUT, used to select which input in the 4051 (or 4050) is to be read. The other pin is one of the Analog inputs of the arduino that will receive the output of the 4051 for its selected input.

I have bit of an understanding about Multiplexer now, but I thought that was 4 output Pins and another 1 analogue pin. For my project, I can give 3 Output pins for this. Yeah, thats fine. Looking forward for a clear circuit diagram if one is available :)

For two muxes, you'll need four digital outputs and two analogue inputs.

AWOL: For two muxes, you'll need four digital outputs and two analogue inputs.

Point taken.

But I am looking for 1 Input instead of 2. Do I still need 4 digital outputs? Well, but the other member here said they are 3 outputs and 1 input.

Sorry, two muxes need three digital outputs as select lines and two analogue inputs. Brain fart.

What about using the Arduino itself to multiplex. A digital output pin can feed the LDR + resistor.

LDR select version This example uses 10 digital pins and 1 analog pin for 10 LDRs.

Use a resistor to ground and measure the voltage over the resistor with an analog input. Connect 10 LDRs to the resistor, but don't tie them to 5V, but to digital outputs. To select a LDR, make that output HIGH, the other outputs stay inputs (floating).

Multiplex version It needs either diodes or a lot digital pins.

This example uses 8 digital pins and 4 analog inputs for 16 LDRs. 4 digital pins for the rows, they are set as inputs (floating) if not active. 4 analog inputs for the columns. Each column is with a resistor to another 4 digital pins. Each crossing is connected with an LDR.

To select an LDR, select the row by making that digital pin as output HIGH. The other rows are inputs (floating). Connect one resistor of a column to the ground with an digital output. Read the voltage over the resistor with an analog input.

I'm still not sure if I get this right. There must be a better way to do this.

Erdin: What about using the Arduino itself to multiplex. A digital output pin can feed the LDR + resistor.

It needs either diodes or a lot digital pins.

This example used 8 digital pins and 4 analog inputs. 4 digital pins for the rows, they are set as inputs (floating) if not active. 4 analog inputs for the columns. Each column is with a resistor to another 4 digital pins. Each crossing is connected with an LDR, so that are 16 LDRs.

To select an LDR, select the row by making that digital pin as output HIGH. The other rows are inputs (floating). Connect one resistor to the ground with an digital output. Read the voltage over the resistor with an analog input.

I'm still not sure if I get this right. There must be a better way to do this.

I am not getting your logic completely, as I am new to this. (Mechanical and Web dev background is what I have :) )

What I thought I would do is, Connect a multiplexer to Arduino. 4 Outputs, and 1 input for the multiplexer. Is there something wrong with this? I can then add 16 LDRs to the multiplexer and select the one I need.

I havent seen a circuit diagram for the connection yet though :(

ADD : Got the point what you are trying to convey. Using the Arduino as a multiplexer. Well, I cant dedicate majority of the OUTPUT pins for this. LDR section is just a subsection of the project. :)

I havent seen a circuit diagram for the connection yet though

The three select lines are common for the two devices, and the outputs go to separate analogue input pins. Everything else is the same as for a single mux.

Edit. Spelling correction. Bloody auto-spell, mumble mumble.

AWOL:

I havent seen a circuit diagram for the connection yet though

The three select lines are common for the two devices, and the outputs go to separate analogue input pins. Everything else is the same as for a single mix.

I was to breadboard the multiplexer circuit by just buying the IC instead of buying it as a chip. Are we talking the same thing? I think you were telling me about how connections go to the Multiplexer CHIP.