![]() |
![]() |
![]() |
|
|
|||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
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: http://www.electro-tech-online.com/g...s-project.html
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... |
|
|
|
|
|
|
(permalink) |
|
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?.
|
|
|
|
|
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) |
|
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… |
|
|
|
|
|
|
(permalink) |
|
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.
__________________
Gods own Country Incredible !ndia www.flickr.com/photos/_akg/ "Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime." |
|
|
|
|
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) | ||
|
Quote:
But that is a point to be noted by OP. Quote:
__________________
Gods own Country Incredible !ndia www.flickr.com/photos/_akg/ "Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime." |
|||
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
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 |
||
|
|
|
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) |
|
You're right Rick that was one way of working.
But in another file linked to there is also aonther way of working, amplify the very small LED current caused by incoming light. Starting from a small 'Dark Current' it will increase with increasing light level. It work well except from the noise and amplification problems I encounter Like AKG suggested I replaced the 20M resisitor by a 3.92M one and placed a small capacitor 22pF over it. That give me an output voltage after the first opamp of 4mV in dark stage up to 50mV in "normal" sunlight condition. I placed a RC filter 100K/330nF on the output so that the 50Hz ripple is almost gone. Now I need an ampifier to boost up the 50mV to I hope 5V but don't know if it's possible I did some reading in a TI pdf about single supply opamp's and like I understood it, I need a "virtual ground", they propose Vcc/2. That way I can have a maximum working range of Vcc/2. All above it up to Vcc can be compared to the + range in dual supply opamp and all underneath it can be compared to the - range. Is this correct? So I need a 50 gain inverting opamp design to amplify my 50mV to 5V with a minimum of 2.5V. My (negative, lower than 2.5V) input range 4 to 50mV will be amplified to 2.7 to 5.0V (positive, higher than 2.5V) output range, right? Is there really no way to amplify it over a larger range? All suggestions for doing this the right way are welcome... Thanks a lot. |
|
|
|
|
|
|
(permalink) |
|
You just need an opamp!, it's a very trivial task, assuming you only have the 5V supply?, a rail to rail one that will work off a single 5V supply would be needed, or do what my PIC tutorial does and use a 7660 to generate a -5V rail as well (this makes the choice of opamp far easier!).
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
Gods own Country Incredible !ndia www.flickr.com/photos/_akg/ "Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime." |
||
|
|
|
|
|
(permalink) |
|
Once you got the right information...
No need of virtual ground, Vcc/2 and other things I reed first that Just the other half of my OPA2336 and some resitors in the right architecture Input range 4 to 75mV amplified to 0.2 to Vcc (approximate values) Thanks and see you later guys, lets code now As far as my concern, case closed. |
|
|
|
|