Pages: [1] 2   Go Down
Author Topic: How to connect LDR to arduino?(HELP)  (Read 2543 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8452
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12456
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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)
Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31458
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12456
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.

Logged

Rob Tillaart

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

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8452
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Belgium
Offline Offline
Full Member
***
Karma: 0
Posts: 187
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

+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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* LDR_read_bb.jpg (53.73 KB, 1566x1021 - viewed 33 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31458
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is that a proper connection for the LDR TinkerKit sensor?
No, you don't need that resistor.
Logged

Pages: [1] 2   Go Up
Jump to: