POT with LDR


Closed Thread
Results 1 to 4 of 4

Thread: POT with LDR

  1. #1
    stu746's Avatar
    stu746 Guest

    Default POT with LDR

    Hi,

    I am trying to use an ldr with the pot command, i tried connecting it in this order - pin-> ldr-> cap -> gnd

    and it seems to work, but not very well, if i cover the ldr i get a value of zero from POT, at normal room light i get about 150, if I cover it slightly the vlaue goes down, but if i shine a torch on it it goes down again to about 30!?

    I tried connecting the pin to the cap to gnd, and the pin to the ldr to +5v, but could not get it to work at all.

    I belive the second way to be the correct way to wire it? I have tried different values from 1 to 255 for pot with no effect.i just get a reading of 0 which will not change.

    Thanks for any help, Stu

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Cool

    Hi, Stu

    Everything in the manual ; 5k to 50k for LDR resistance ... no less, no more

    Have a look to RCTime ... wider possible range !!!

    Alain

  3. #3
    stu746's Avatar
    stu746 Guest


    Did you find this post helpful? Yes | No

    Default

    in the end i connected both the cap and ldr to gnd but still was not right, so used to following code and seems to work fine

    aa var word

    trisd.7=0
    high portd.7
    pause 500
    trisd.7=1
    loop6:
    aa=aa+1
    if aa=65000 then aa=aa-1
    if portd.7 = 1 then loop6



    serout portb.0,n2400,[#aa,13,10]

    there is probably a better way to do it, but this seems to work for me

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Stu,

    as Alain already mentioned, it's all in the Manual.

    POT is a bit of a pain, does your PIC have a spare ADC?

    if yes, wire the LDR with an additional resistor as voltage divider and use ADCIN
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. Using the Pot command.
    By timseven in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th August 2009, 20:23
  2. POT command
    By Michael in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th December 2008, 22:33
  3. A/D, Pot, Input, A,B So lost now....
    By Helmutt in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th March 2008, 22:23
  4. Replies: 4
    Last Post: - 24th January 2007, 22:20
  5. pot controlled pwm -- help
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 29th January 2006, 12:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts