Shop OBEX P1 Docs P2 Docs Learn Events
LED as Photodiode question — Parallax Forums

LED as Photodiode question

eagletalontimeagletalontim Posts: 1,399
edited 2014-08-30 10:01 in Robotics
As some of my other posts are related, I am working to build a solar tracker and have learned that I can use LED's as the sun sensor. I was trying to get it to work with an ADC, but just can't seem to figure it out to have more than 5 "point" difference from dark to light. I did find a post on here using RCtime, but I am worried that the sensor having to be mounted up to 6 feet away will cause the wire to act as an antenna and throw off the readings. I have not tested the RC time yet, but before I waste a bunch of time trying to figure this out, maybe someone has already done this and has a good way for me to complete this task?

Comments

  • Hal AlbachHal Albach Posts: 747
    edited 2014-08-27 10:34
    This site specializes in building LED solar trackers. Note that they heavily depend on green LEDs.

    http://www.redrok.com/electron.htm
  • LevLev Posts: 182
    edited 2014-08-27 16:23
    I think the solution is to amplify the voltage signal from the LED, before the ADC. We recently did this with an IR and UV LED on a recent high altitude balloon flight and saw a lot of variation. I got the idea from an article in Nuts and Volts, and made a few modifications. I am being beckoned and have to go, but I'll post the circuit later if you are interested.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-27 16:52
    I think I just got it :) I ended up using a 555 timer to have a fixed frequency. The Prop converts this into a usable number and it is quite consistent. The LED is connected across one of the resistors which makes the frequency change. I will need to use 4ea 555 timers to have a 2 axis setup, but for the money and accuracy, I think it is well worth it and it is very simple. All the prop code needs to do is calculate the difference between the "east" and "west" and figure where center is. I will have to figure out how to make a cloud detection setup. That may have to be done with a photocell or with code that determines the rate of change. If the rate of change is too much, it will ignore the change and "guesitmate" when the next move will need to happen (average rate of change).
  • ercoerco Posts: 20,255
    edited 2014-08-29 00:24
    Good work, ET Tim. Silly question : why not simply use a phototransistor?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-29 04:28
    Well, I don't have any :( I am very impatient and hate ordering things if I already have something that would work. I try my best to make use of what I already have here if you can't tell by my other threads :)

    I did find that I need shielded wire since we had some lightning yesterday and it threw off the readings by > 1,000,000. The average readings between the 2 are +/- 3 including the offset I had to put on one side due to a slight frequency difference probably because i am using 5% components instead of 1%.
  • ercoerco Posts: 20,255
    edited 2014-08-29 07:09
    Repurposing is good. :) Hope you get it working with LEDs.

    But if you have any trouble, a phototransistor is much more sensitive than an LED. If you don't want to wait to order, Radio Shack has one for $2. Might be worth testing one just to see the difference.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-29 07:29
    I have it outside testing right now. Got it working using green LED's like a previous post mentioned. Got to figure out a way to determine the rate of change since the system moves every minute or so depending on the clouds. Need to see if there is a way to make the code know the difference between a cloud and the sun :)
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2014-08-29 07:44
    "Need to see if there is a way to make the code know the difference between a cloud and the sun" - Arrange 4 LED sensors and compare opposite LED's differentially to one another.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2014-08-29 19:07
    This is actually how I have it so I can determine rotation and angle. The left and right LED's are for "east" and "west", and the other 2 are for up and down. I added some code to "average" the readings so the motor did not turn on as much when the clouds come overhead. Still need to see if there is a way to check for maybe brightness level? If the brightness level adjusts up and down, the system will know a cloud is passing and not move.

    I did have a mishap today since I was using all bread boards for my project :( The rotating base was my test platform with the sensor breadboard on it. It was working just fine when I left for radioshack... When I got back, the rotation base was constantly on and the bread board wires were wrapped around the spindle... I now have a fully soldered perf board and the accuracy seemed to have gone up. I also switched to using 556's instead since I can just use 2 IC's.

    The base frequency with 0 light is 128 and when in low light, it is around 135 which is the lowest it can accurately track. In full sunlight it can go up to 205. Maybe I can use this data to check for clouds or maybe I should not be lazy and use a photocell :p
  • ercoerco Posts: 20,255
    edited 2014-08-30 10:01
    Tim: You might find this old thread about LEDs as light sensors interesting and "illuminating".

    http://forums.parallax.com/showthread.php/125233-Led-Touch-Sense-quot-Case-Re-opened-quot
Sign In or Register to comment.