Go Down

### Topic: LDR (Read 3931 times)previous topic - next topic

#### 000

##### Nov 07, 2008, 04:42 am
hi guys...
i put together a LDR using the potetial divider circuit(see this link http://www.doctronics.co.uk/ldr_sensors.htm#circuit%203 ) and i am using arduino to read the values of LDR. i am getting values like 800 wen bright light is shown and around 300 wen light is off... wat basically r these values??? is it the p.d across the ldr??? and in wat format is it showing (like the 800 range)?? is it ascii?? wat do need to do to get say p.d in volts and to print it to serial port the same value say which i will get if i connect a multimeter across it ends?? (ie. say x volts...)

#### John_Ryan

#1
##### Nov 07, 2008, 09:58 am
Your using one of the analog pins? if so, analogRead gives values from 0 to 1024. 0 equals 0V, 1024 equals 5V.

So ...

800 is 3.9v
300 is 1.46v

= )

#### 000

#2
##### Nov 07, 2008, 12:05 pm
yup i use analog pins... thanx 4 that info mate...
is 1024 for 5V only?? or if i give a 9V input , 1024 implies 9V?? :-?

#3
yup = )

#### mem

#4
##### Nov 07, 2008, 12:40 pmLast Edit: Nov 07, 2008, 12:41 pm by mem Reason: 1
You don't want to put 9v directly on the pin, the maximum is 5 volts for a board that is running on 5 volts! If you want to measure 9v you would use a voltage divider.  The value you read will always be 5v divided by 1024 but  if using a divider ( say with  two equal value resistors to divide the voltage in half) 1024 would equal 10 volts.  A search on voltage divider should yield more info on this

(John I think you need your morning coffee   )

#### 000

#5
##### Nov 07, 2008, 03:23 pm
hey sorry, but i didnt understand....

#### mem

#6
##### Nov 07, 2008, 05:31 pmLast Edit: Nov 07, 2008, 05:35 pm by mem Reason: 1
[glow]>you don't want to put 9v directly on the pin[/glow]
This means don't connect 9 volts to any arduino digital or analog input pin

[glow]>the maximum is 5 volts for a board that is running on 5 volts![/glow]
The maximum voltage you should connect to these pins is the voltage powering the controller chip  (usually 5 volts)

[glow]>If you want to measure 9v you would use a voltage divider.  [/glow]
The method called a voltage divider is used to measure more than 5 volts

[glow]>The value you read will always be 5v divided by 1024 but  if using a divider ( say with  two equal value resistors to divide the voltage in half) 1024 would equal 10 volts. [/glow]
If you use a voltage divider to divide the voltage in half (using two equal value resistors) then the maximum value from analogRead will actually be 10 volts ( you get 5 volts on the pin because you have given 10 volts into the voltage divider and that has divided the voltage in half)

[glow]A search on voltage divider should yield more info on this [/glow]

I hope that (and a read on some of the hits from google ) will help.
Here is one of the threads where this has been discussed: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226005458

Have fun !

#### John_Ryan

#7
##### Nov 07, 2008, 11:28 pm
lol I still have sleep in my eyes and the nuke is busy churning out the coffee = )

#### 000

#8
##### Nov 08, 2008, 04:44 am
Quote
>you don't want to put 9v directly on the pin
This means don't connect 9 volts to any arduino digital or analog input pin

>the maximum is 5 volts for a board that is running on 5 volts!
The maximum voltage you should connect to these pins is the voltage powering the controller chip  (usually 5 volts)

>If you want to measure 9v you would use a voltage divider.
The method called a voltage divider is used to measure more than 5 volts

>The value you read will always be 5v divided by 1024 but  if using a divider ( say with  two equal value resistors to divide the voltage in half) 1024 would equal 10 volts.
If you use a voltage divider to divide the voltage in half (using two equal value resistors) then the maximum value from analogRead will actually be 10 volts ( you get 5 volts on the pin because you have given 10 volts into the voltage divider and that has divided the voltage in half)

thanx mate understood... except 4 the first part...
you don't want to put 9v directly on the pin

i got a 9V pin i audrino board so i can take a 9v output rite??

#### mem

#9
##### Nov 08, 2008, 04:16 pmLast Edit: Nov 08, 2008, 04:20 pm by mem Reason: 1
Quote
i got a 9V pin i audrino board so i can take a 9v output rite??

I am not sure I understand your question. These comments above refer to the data input and output pins.

The only pin you can put 9 volts onto is the power input pin. This voltage is fed into a voltage regulator which on most boards provides the chip with 5 volts.  The voltage on the input pins must not be higher than 5 volts.

If something is still not clear, perhaps try and re-phrase your question.

#### 000

#10
##### Nov 08, 2008, 04:50 pmLast Edit: Nov 08, 2008, 05:08 pm by dev_000 Reason: 1
http://www.mediafire.com/imageview.php?quickkey=xjdts4ismzd&thumb=5
plz see this
i meant the power pin i can take a output of 9V 4m that rite???

#### mem

#11
##### Nov 08, 2008, 05:36 pm
Yes, the 9v pin can take positive nine volts. But you must not connect that voltage to any other pin on the arduino board. If you want to measure this voltage using the arduino analogRead, you must reduce the voltage (for example by two resistors connected as a voltage divider) so it is not higher than 5 volts when connected to one of the analog pins.

#### 000

#12
##### Nov 08, 2008, 06:25 pmLast Edit: Nov 08, 2008, 06:26 pm by dev_000 Reason: 1
k now understood... 8-)
sorry for the trouble....

Go Up

Please enter a valid email to subscribe