How to connect a light dependent resistor to a picaxe 28X1

Hi,

I recently go a light dependent resistor

http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/SEN001

and i cant seem to figure out how to connect it to my picaxe28X1, would anybody here know how ???

Any help would be apreciated !!!!!

Try the manual.
Try the manual. http://www.rev-ed.co.uk/docs/picaxe_manual1.pdf page 62.

thanks, will see if that
thanks, will see if that helps

tryed it but i am not able

tryed it but i am not able to figur out how to connect th LDR, would need to see a pic something more detailed

I would assume that one pin
I would assume that one pin goes to ground and the other to an input pin on your picaxe.

**LDR Description **
That diagram on page 62 of the manual, has one lead of the LDR connected to +5 volts. The other lead of the LDR is connected to a 10 K resistor. The other lead of the 10K resistor is connected to ground. The connection between the 10k and the LDR has a wire that goes to your ADC input if the PICAxe. (ADC1 in the example code). THe example appears to also have LEDs attached to ouputs 0 and 4, to show what the ADC is reading.

yes
I have done exactly that, set up a voltage divider with an LDR and 10K resistor. It works fine for me and is quite easy to build on the end of the ribbon cable, which has connections to +5V and ground as well as the inputs.

would the 10 K resistor be

would the 10 K resistor be 1/2 W or 1/4 W ?

this site sells them for a good price so… http://www.futurlec.com/ValuePacks.shtml

so, a 10K resistor would be
so, a 10K resistor would be : Brown, Black, Red ?

resistor
What does the resistor do?

I’m guessing limmit the
I’m guessing limmit the voltage going to the LDR

No, brown, black orange. 10K
No, brown, black orange. 10K = 10.000. The first two digits are determined by the first two rings, brown = 1, black = 0. The last ring is the multiplier, in this case 3, because 10^3=1000, and 3 is orange. See http://n1ofz.connares.org/resources/resistor_code.gif

** Well finaly got the time**

 

Well finaly got the time to wire it up. i modifided the code that is in the manuel to make it work with servos instead of LEDs

here is the code

main:
readadc 1,b0
if b0 > 150 then top
if b0 < 150 then bot
goto main


top:
servo 0,125
goto main

bot:
servo 0,030
goto main

 

the thing is that the servo turning seems mostly random, has anybody had these problems?

Servo code…

bot:
servo 0,030
goto main

 

servo 0,03 is beyond picaxe limits I think.

 

 

Voltage divider

The resistor and the LDR form a voltage divider circuit:

http://en.wikipedia.org/wiki/Voltage_divider

The voltage at the junction between resistor and LDR wil go up and down according to the resistance of the LDR, which will itself vary according to light.

blank_pageokay, this is
blank_page

okay, this is realy starting to become anoying…

here is my code, well … the manual code

main: ‘ make a label called main
readadc 2,b0 ‘ read channel 1 into variable b0
debug b0 ‘ transmit value to computer screen
pause 500 ‘ short delay
goto main ‘ jump back to the start

 

In the pic the LDR is connected to a 10k resistor.

The black wire is connected to +5V, red to analouge input and the yellow to ground.

12-04-09_1911.jpg

The problem is that the debug constantly reads 225 and i an i have absolutely no idea what i am doing wrong !

 

check your code…

readadc 2,b0 ‘ read channel 1 into variable b0

That’s the first one I see, be sure you are looking at the right adc channel.

Also, the ADC’s on the 28x1 board are a little funny. Signal is in the middle and with this you could easily have you servo connector in backward. Double check your pin-outs and be sure you have ground on the resistor side and + going directly to the ldr. Also, to check the LDR is not fried, use a measure-thingie (multi-tester) the reading should fluctuate as you wave your hand over the sensor.

about the channel, it is

about the channel, it is from the manual, i modified the code to see if channel 1 was not working but the code is programmed for the right channel that the LDR is plugged into.

I tryed testing it as you said, i was hopeing that the LDR was fried so that the problem would be solved unfortunately the resistance changed depending on the light!!

i gave up the idea of trying to move a servo, onece i get the debug working i will be able to figure it out.

this seems soooooo simple
this seems soooooo simple yet i still can get it to work :frowning:

HMM.

The picaxe manual says you’d need about 100K resistor. You might try a different one.

Measure the resistance of the LDR with a multimeter. to see if the value changes under different lightings.