Time-Lapse


Closed Thread
Results 1 to 40 of 43

Thread: Time-Lapse

Hybrid View

  1. #1
    Ted's's Avatar
    Ted's Guest

    Default Finding out whether a led is on or off using a phototransistor

    I own a L730

    Picture1:

    Picture2:



    This digital camera consists of a green LED next to the T on Picture2. I want the PIC to figure out whether the LED is on or off without opening the device(the camera). How can I do that - technically and in PBP?

    Thanks
    Ted's
    Last edited by Ted's; - 13th May 2008 at 03:02.

  2. #2
    Join Date
    Oct 2007
    Location
    The Netherlands
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    You could use an LDR (light dependant resistor) to check whether the LED is on. Use black tape or other stuff to make sure only the light from the LED reaches the LDR. Connect the LDR between an input pin of the PIC and ground, and a say 1 MOhm resistor between the same input pin and +5V (pull up). As soon as the LED lights the resistance of the LDR will go down, pulling the pin low. You might have to experiment a bit to get the right value for the resistor.

  3. #3
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    Fair enough.
    How fast can a ldr react? Is a light sensitive diode/transistor suitable aswell?

  4. #4
    Join Date
    Oct 2007
    Location
    The Netherlands
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    An LDR might be a little slow, depends on the speed you need. Photo transistor might work well too, again, you'll have to experiment a bit.

  5. #5
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Ted's,
    I'm a rooky at electronics, so what the other guys are suggesting is probably better, but here's how I use a CDS cell for detecting day and night on my circuit, and I think it would work here to, as long as no outside light can get to it. The part number is from digikey: PDV-P9203-ND The specs say:

    Rise Time (Typ) 70ms
    Fall Time (Typ) 15ms

    I don't know, but I'll bet that would work for ya.
    I connect one side directly to the +5V of my board, and the other side to a pin on the PIC. This is the code that I use, and it has worked really well. What I have found using this code, is that it works with pretty much any CDS cell. I had 5 different ones, and they all detected dark at about the same light level with this code. For really good measurement of changes in light level, I'm sure there are better, and more complicated, ways to do this, but this is great for detecting day or night (or light on/off). After reading how RC time works, I'm not real sure why the value of about 46 to 49 is consistently dark on all of the cells I tested, but hey it works.
    DayNight VAR BYTE
    DayOrNot VAR BIT

    Low PORTB.5 'Pin Connected to CDS Cell
    Pause 10
    RCTime PORTB.5,0,DayNight 'Read rctime value into DayNight variable

    If Daynight > 46 Then 'It's dark
    DayOrNot = 0
    Else 'It's Daylight
    DayOrNot = 1
    End If

    Gary

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    FYI g-hoot,
    http://en.wikipedia.org/wiki/Photoresistor
    Now Ted has code for his project too and what speed to expect.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 02:55
  2. Measuring time
    By AugustoPedrone in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th July 2007, 23:46
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. Alarm Time
    By Santana in forum Code Examples
    Replies: 1
    Last Post: - 8th December 2006, 13:58
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

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