Go Down

Topic: How to connect LDR to arduino?(HELP) (Read 3314 times) previous topic - next topic

yss31610165

Hi everyone,

I am testing the LDR recently, but I have no breadboard,(I found most project with LDR is done through a breadboard).

My question is, can I connect my LDR directly to my arduino, and to control the LED on my arduino (13)?  If it can, how to connect?

Thank you.

Sarah

Graynomad

If the leads are long enough you could just poke them into the appropriate header holes. If not extend them with some wire soldered on.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

tkbyd

a) Get some breadboards! There's a nice one available from....

http://wulfden.org/TheShoppe/accessories.shtml
($6, incl p&p to USA)

or....

http://shop.moderndevice.com/collections/prototyping-breadboards-wires
($3 + P&P)

b) Go to your profile, and fill in at least a vague indication of where you are. For the breadboards, the suppliers will mail them anywhere in the world for a sensible price, although your local authorites may make a nuisance of themselves. In the UK, about 9 parcels in 10 go through with no hassle.

c) You need to connect the LDR **and** a fixed resistor. Covered at....

http://arduino.cc/forum/index.php/topic,66680.0.html

robtillaart


TO connect an LDR correctly it must be part of a voltage divider

+5V ---- [ LDR ] -----* ------[Resistor] ----- GND

Connect analog port of Arduino to * in the middle
The valueof resistor must be in the same order as the LDR when in the dark. (a 10 K will work probably too)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

yss31610165


If the leads are long enough you could just poke them into the appropriate header holes. If not extend them with some wire soldered on.

______
Rob


Could you please tell me which leads should poke into which header holes?

yss31610165


a) Get some breadboards! There's a nice one available from....

http://wulfden.org/TheShoppe/accessories.shtml
($6, incl p&p to USA)



Thank you for your reply, but I don't want to use a breadboard, I want to know if I can connect them together without a breadboard?

retrolefty

Well as already drawn for you:

Quote
TO connect an LDR correctly it must be part of a voltage divider

+5V ---- [ LDR ] -----* ------[Resistor] ----- GND


So, one end of the LDR goes to a +5vdc pin, one end of the resistor goes to a ground pin. Now the problem, the other ends of both the LRD and resistor must connect to the analog input pin you are using. As usually two wires won't fit into one pin hole, and you don't want to use a breadboard, then you must solder the connection between the LRD and resistor and then add a single wire from that junction connection to the analog input pin.

Lefty


Grumpy_Mike

Quote
but I don't want to use a breadboard

Good for you I hate those things, they are more trouble than they are worth.

I always solder stuff up an a small piece of strip board. If you keep the wires long you can always use the components again.
The thing to remember is that physically you can make the topological arrangement of components any way you like. What is important is that they are all connected electrically in the right way. You tell that from a schematic.

yss31610165

I have got a breadboard, but with no resistor, do I have to get one, why?


Well as already drawn for you:

Quote
TO connect an LDR correctly it must be part of a voltage divider

+5V ---- [ LDR ] -----* ------[Resistor] ----- GND


So, one end of the LDR goes to a +5vdc pin, one end of the resistor goes to a ground pin. Now the problem, the other ends of both the LRD and resistor must connect to the analog input pin you are using. As usually two wires won't fit into one pin hole, and you don't want to use a breadboard, then you must solder the connection between the LRD and resistor and then add a single wire from that junction connection to the analog input pin.

Lefty



robtillaart


Quote
I have got a breadboard, but with no resistor, do I have to get one, why?


Yes, you have to, there should be a flow from + to GND and the Arduino measure the voltage drop.  - http://en.wikipedia.org/wiki/Voltage_divider -
If you connect the LDR to 5V and the other end to the Analog in the voltage will allways be 5 Volt as there is nothing that pulls it to GND level.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Graynomad

You have to form a voltage divider and take your reading from the centre (the * in the above drawing). Without two resistors (the LDR is just a special type of resistor) you are just pulling the Arduino pin low and so will always read a value of 0.

Now if for some reason you live in outer mongolia and can't get a resistor and just want to play to see what happens there are two ways to do this.

1) If you have a second LDR use that instead of the fixed resistor, as you light and shade either of the LDRs the reading will change.
2) Use the internal pullup resistor instead of the external resistor (I'm pretty sure this will work with an analogue input).

Both these methods will be very imprecise but will at least allow you to have a play.

Personally I'd just go and get a resistor.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

ksobon

Does anybody can post a simple Fritzing wiring diagram. I think people will be able to better understand what you mean by creating a power divider and taking the input from the middle. Thanks a lot!

Steen


+5V ---- [ LDR ] -----* ------[Resistor] ----- GND


it's not more than this :o maybe this is clearer (?)

+5V [ wire ] [ LDR ] [ wire ] [ wire to analog in ] [ wire ] [ Resistor ] [wire] GND

ksobon

Is that a proper connection for the LDR TinkerKit sensor? I think I am getting the right reads as they vary from 20 to about 900 when put under light bulb. Resistor shown is a 10k resistor. Thank you in advance.

Grumpy_Mike

Quote
Is that a proper connection for the LDR TinkerKit sensor?

No, you don't need that resistor.

Go Up