Electronic Circuits and Projects Forum



Light sensor with LED's

12 Last »
  1. #1
    mcs51mc mcs51mc is offline

    Light sensor with LED's

    After reading a thread started by "The Mad Professor" I start to experiment with this light-sensing-LED-thing. You can find the original thread here: Now that's a project..

    Circuit:
    You can see the circuit I made in attached file "Circuit.jpg"

    Measurements:
    With a multimeter between Vout and GND one can measure:
    1) +4.996V (Vcc) in full light.
    2) Decreasing voltage with decreasing light intensity.
    3) +2.514V (Vcc/2 ?) with LED’s completely covered.

    So everything is looking good, decreasing light intensity equals decreasing voltage.

    I feed a TLC549 ADC with this output voltage, write some code for a 80C31 µP and put the readings on a LCD display. What I saw on the LCD?
    1) Fixed data 255 in full light.
    2) Continuous varying data between 0 and 255 with decreasing light and no light at all.

    I then placed a scope on Vout and that’s what I saw, very weird…
    You can see the signals in attached file "Signals.jpg"

    Questions:
    These measurements solved the 0 and 255 ADC readings on the LCD but bring even more questions on. So, can some explain these signals to me?
    1) Why constant Tlow= 5ms as long as 0 volt isn’t reached and then increasing from 5 to 10ms with Vout= 0V and still decreasing light?
    2) Where is the 50Hz signal (no light) coming from? During the measurements, no power line light sources where on, only bright constant sunlight. Don’t tell me the sun is pulsing at 50Hz…
    3) Are these signals typical for LED’s or is there something wrong with my opamp circuit? Even with other LED’s, red and green one’s, the same type of signals but with lower levels…
    4) What do I need to “convert” such a signal to an averaged signal and stable ADC readout like the one on my multimeter (filter, caps, …)?
    5) All suggestions to read such a signal in a µP with an ADC are welcome… …

    Thanks for any reaction...
    Attached Images

  2. #2
    Nigel Goodwin Nigel Goodwin is offline
    Super Moderator
    What's your construction like?, it sounds like it may be picking up mains hum, is it built using shortest possible leads, and in a grounded metal box?.
    0
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  3. #3
    mcs51mc mcs51mc is offline
    I have two, both reacting the same way. One soldered on prototyping board, so very short leads, and one on a bread board, max lead length let say 5cm.
    None of them are inside a metal box. I placed the prototyping board one in a plastic IP55 housing of a mains power outlet with the led's coming out of the three whole's (2 for power and 1 for earth).
    It's powerd from mains 220Vac, transfo to 18Vac and finally 24 to 5V DC/DC converter.
    So far for my construction...

    "Picking up mains hum": never thought about that because of the varying Tlow. As long as the signal didn't reach 0V, Tlow is 5ms and Thigh is 15ms. Only when the output signal reach 0V Tlow start to increase to 10ms while Thigh decrease from 15 to 10ms. Writing this i'm realising that the period is always 20ms. So "mains hum"... possible.
    You know what? I will power the circuit from a 9 V battery and 7805 and let you know about the outcome.

    To be countinued
    0

  4. #4
    mcs51mc mcs51mc is offline

    New measurements...

    I removed the second opamp and did some measurements with only the first one battery and power supply operated.

    The output of the first opamp is a DC signal varying from 4 to 450mV in ambient light with a 80mV peak to peak 50Hz ripple on the DC voltage.
    How do I get rid of that ripple?
    Btw: With a 60W lamp above the led's the output goes to 4.941V.

    When I move my hand nearby the 20MOhm resistor that ripple get bigger. I then put some insulation tape tape on the resistor and wrap it in aluminium foil with the idea of making some shielding around that resistor. Even with the foil connected to ground, it was worse more ripple. So far for my shielding capability.
    Any better ideas?

    Let say I’m only interested in the range 0 to 250mV.
    What is the right way to amplify that range to a 0 to 5V range and avoiding the problems I described in my previous post?

    Thanks a lot for any suggestions…
    Attached Images
    0

  5. #5
    akg akg is offline
    eventhough the ckt is powered by bat: supply , if u stand near it, it can introduce 50Hz (u'll be acting like antenna) . so my suggestion ,power the ckt with a batt: , move the ckt as far as away from any ac power sources and you yorself keep a distance from , and monitor the cro. one more thing do u actualy need the 20M res ?, try it replacing with a 1M or 3.3M which will be sufficient to generate an o/p, also experiment with keep only 1 IR diode.
    0

  6. #6
    ZIGGY_DAN ZIGGY_DAN is offline

    I have the answer!!

    If your using a light source powered by the mains the source is actually flickering at 50Hz so your LED is picking this up, it might not look like it flickers to us but persistance of vision is the reason, use a torch or light source that runs of DC to test your circuit.

    I was re-reading this thread and suddenly the answer hit me, it's so simple.

    hope this helps
    0

  7. #7
    akg akg is offline
    If your using a light source powered by the mains the source is actually flickering at 50Hz
    he may be using an incandescent bulb, it won't flicker at 50Hz due to thermal inertia.
    But that is a point to be noted by OP.
    ..Btw: With a 60W lamp above the led's the output goes to 4.941V...
    0

  8. #8
    Nigel Goodwin Nigel Goodwin is offline
    Super Moderator
    Quote Originally Posted by akg
    he may be using an incandescent bulb, it won't flicker at 50Hz due to thermal inertia.
    He specified in the original post, that there were no electric lights turned ON, just sunlight.

    In any case, incandescent bulbs do flicker at the mains frequency, they obviously don't go fully ON and OFF, due to thermal inertia, but their brightness does vary considerably at the mains frequency.

    This effect is used for turntable strobe disks, for setting the speed accurately - incandescent lights work better than flourescent for this, and we used to have a table lamp specially for illuminating the strobe disk.
    0
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  9. #9
    mcs51mc mcs51mc is offline

    Amplification ?

    Quote Originally Posted by akg
    eventhough the ckt is powered by bat: supply , if u stand near it, it can introduce 50Hz (u'll be acting like antenna) . so my suggestion ,power the ckt with a batt: , move the ckt as far as away from any ac power sources and you yorself keep a distance from , and monitor the cro. one more thing do u actualy need the 20M res ?, try it replacing with a 1M or 3.3M which will be sufficient to generate an o/p, also experiment with keep only 1 IR diode.
    I already experiment with 1, 2 and 3 diodes and several xM resistors. I used the actual configuration because I had the best signal out of the first opamp (around 500mV).
    Then I added the second opamp to boost it to 5V to feed it into an ADC.

    I think something went wrong adding that second opamp also. If you compare both circuits you will notice that pin 3 of the first opamp was first connected to ground and then to Vcc/2.
    I did that because the output of the second opamp always kept the same level (can't recall 0 or 5V) even with a varying input signal. I think the design of the second opamp is not good but don't know how to make it good
    What is the right connection for the second opamp to boost that 500mV signal to 5V using single voltage opamps?

    If I can even boost that signal more I can reduce the 20M resistor and leave some led's out like akg suggested.

    Analog electronics is not my thing so all help is much appreciated.
    See you
    0

  10. #10
    rockin_rick rockin_rick is offline
    Perhaps I don't quite understand what you're trying to do, but I think that you want to measure the light level with a LED. You seem to be trying to use an A/D converter for this, but when I checked into this a few weeks ago, that wasn't the right approach. The .pdf doc in the first post of the thread that you referenced here says, IIRC, that you need to simply measure the time that the LED takes to 'discharge' with your micro. IOW, 'charge' the LED capacitance, change your I/O to input, and start a timer. The LED's small capacitance that was just charged will discharge (through CMOS input pin) at a rate determined by the ambient light level. Time the amount of time until the I/O pin on your micro goes from high to low (the decreasing voltage crosses the 'VINlow' boundry and causes the pin to read low). This time is your ambient light level.

    (All of this is how I THOUGHT this worked, recalling from memory, from my brief research and no testing... soooo I could be wrong...)

    Rick
    0

12 Last »
Tags
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.06855 seconds      Memory: 7,313 KB      Queries: 16      Templates: 0