Shop OBEX P1 Docs P2 Docs Learn Events
Infrared and the Sun.... — Parallax Forums

Infrared and the Sun....

eagletalontimeagletalontim Posts: 1,399
edited 2012-09-29 13:54 in Propeller 1
Hello all once again! I am sure this has been answered somewhere, but I can't seem to find anything that works for me. I have a project that reads IR pulses from my power meter but I can't seem to "ignore" the sun with this photo transistor. The photo transistor is one that I bought from RadioShack which I have used in several other projects. All I need to do is accurately detect each IR pulse without missing a pulse when the sun is out. I have the IR sensor mounted in a small plastic enclosure which is electrical taped on top of the power meter blocking out as much sun as possible. Some how, the IR sensor still picks up the sunlight.

I do not want to order more parts since this project is supposed to help me save money :p Currently, I have the sensor connected to a PNP 3906 transistor with a 100K pulling up the base and a 100K between the sensor and the base of the transistor. The PNP is connected to the 3.3v rail and then to a 10K resistor that goes to the input pin on the Prop. Everything works perfect when the sun is not shining on the meter. I cannot build an enclosure around the meter since that is illegal, nor can I "shade" the meter since it faces exactly where the sun comes up.

So, my question is..... how can I wire this photo transistor to "ignore" sunlight but accurately pick up the IR pulses from the meter without buying special chips? I have plenty of resistors and transistors on hand which should be able to do the trick.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-09-26 20:04
    Tim,

    What kind of pulses does the meter send out? It would help if it were modulating a carrier, since that's the way that most IR comms deal with ambient light. The problem is that sunlight is very rich in IR and is causing your phototransistor to saturate, so the signal is getting swamped out.

    BTW, you didn't mention what the phototransistor is connected to: Prop, BASIC Stamp, or ... ?

    -Phil
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-26 20:24
    I am using it on the Prop since it can multitask better than the SX :) The meter does not have any special "blink" pattern except for 1 blink per 1 watt hour used. I am calculating the distance between pulses which I can then calculate to current watts being used. This is why I cannot miss any pulses.

    I have an old DVD player I am tearing apart that has a 3 pin IR sensor in it. Maybe if I can salvage the whole circuit, I could use it? I don't understand how IR controlled toys work in direct sunlight and I can't seem to figure out how to read a single pulse during the day. Even if the toys had a specific pulse it read from, if in direct sunlight, any incoming IR pulses would be drown out by the sunlight itself. This is where I am confused!
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-26 21:16
    I was able to "hack" the sensor from the DVD player along with all of it's circuitry. I have it running from a 7805 and connected to my meter to see the change when I press buttons on one of my TV remotes. It seems to be working under bench test settings. I will have to try it tomorrow during the day to see if it works in sunlight the same way.
  • kwinnkwinn Posts: 8,697
    edited 2012-09-26 21:40
    Unfortunately there is no simple way to differentiate between the light from the meter and that from the sun. The sunlight being of much higher intensity will swamp the light from the meter. A good IR filter might help, but they cost $ and will still pass visible light.

    If this is for the electric meter from your earlier post you may have to find a way to block the sunlight. Perhaps you can put some kind of enclosure over the meter or focus the detector so it only picks up the IR from the meter.
  • ercoerco Posts: 20,256
    edited 2012-09-26 21:58
    Direct sunlight will swamp all phototransistors and most 38 khz IR receivers, which is the 3-pin job out of your DVD player. That receives a modulated 38 kHz carrier that your remote sends, not a simple DC pulse. There are MANY different types of 38 khz modules with different characteristics; some have better sunlight filtering capability than others, IF you can use a 38 khz type.

    But that might cost you a dollar to experiment. :)
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-26 22:04
    This is for the same project and I am still having problems detecting the pulses during the day. At night or when the sun is not shining on the meter, it is perfect. Now that I have the circuitry from the DVD player, I will try that out. I broke that part of the board off from the rest of the circuitry so It is a smaller more manageable size to use around my meter.

    Is there a way to detect the lowest voltage on a pin? Since the DVD circuit has a 3 pin IR sensor, the signal wire goes low when there is an IR signal picked up. If the sun is shining enough to make the sensor pick up the IR from the sun, it should be a semi gradual change in the output of the sensor which could be ignored by the Prop with coding I hope.
  • ercoerco Posts: 20,256
    edited 2012-09-26 22:19
    The module's output is pulsing low, in exact response to the IR signal received. See helpful SIRC info at http://www.electronics-base.com/index.php/general-description/ir-remote-control/137-sony-sirc-protocol

    Not sure what you mean by "lowest voltage on a pin". Different remote keys have different coding patterns, their output may read slightly different on a voltmeter, since you're sorta kinda changing the duty cycle.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-09-27 14:03
    You may be better off just getting a lens and focusing the phototransistor on the dot on the meter. The lens, if focused correctly, should direct IR from things other than the LED on the meter to places other than your phototransistor.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2012-09-28 05:59
    I have read that the bit of film that is before, or after, the pictures that gets blacked out is a good IR filter. I have never got around to proving it but it would be a free trial at least, if you have any celluloid still!
  • BitsBits Posts: 414
    edited 2012-09-28 18:05
    How about using a coding scheme like Manchester code. Another idea is to put a ball cap like hood over the sensor perhaps a long paper towel tube, assuming the sensor is somewhat horizontal.

    I remember meeting an old guy who dug wells by hand and he said that he would dig so deep he could see stars in mid day.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-28 19:53
    From what I gather from the Manchester code is to create some sort of function that will only look for pulses of a specific width meaning the time the IR light comes on till the time it goes off and count that as a pulse? Anything other than that pulse width will be ignored? The only thing I see that could be an issue there is that I am calculating the time between pulses to give me a reading of watt usage by the minute. Having additional coding running after a pulse has finished would mess up this timing correct?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-09-28 20:22
    Singular pulse detection is going to be a problem, no matter how you cut it. If the connection has to be wireless, you'd be much better off connecting an IR detector to a micro and RF transmitter right at the meter location. I see no hope whatsoever for detecting a simple IR pulse embedded in solar ambient light. You really need to find another solution.

    -Phil
  • BitsBits Posts: 414
    edited 2012-09-28 20:26
    So you think the tube idea will not solve this issue? Is the detector not in line of sight of the emitter? I say cut a paper towel tube to size and place it over the detector. unless there are other factors involved that I am missing here seems like it would solve the problem. Just make sure the tube is pointing in the direction of the emitter.

    Heck even paint the tube with flat black nail polish to improve its abilities.

    Edited..

    - Ah i think I see what Phil is talking about... The emitters signal is no good with all that sunlight so the detector is not the problem. Is this correct?
  • BitsBits Posts: 414
    edited 2012-09-28 20:39
    Eh never mind my last post. Seems that I needed to read post 1 over again. Boy, this seems simple to fix but might not be possible unless you change things as others stated.

    Perhaps placing a second detector near the original one and using a comparator or subtract the two levels leving the signal, but thats a shot in the dark
  • Prophead100Prophead100 Posts: 192
    edited 2012-09-28 20:44
    A polarized filter might help. Most of the sun light will be in a vertical orientation unless you are looking at it straight on so a horizontal filter may allow your signal and screen much of the sun.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-28 21:13
    The box that I have taped to my meter blocks out as much sunlight as I can without making the meter looked like it is being hacked :p The only thing inside the box is the sensor. I have shielded wire coming from the sensor to my breadboard. I have an 1/8" sponge sheet covering the entire top half of the meter with a small notch cut out of it to expose the IR light. Inside the meter, the IR light itself is not visible, but there is a plastic tube which the IR light travels through to shine upwards kind of like fiber optics.

    On the DVD player, it had a clear plastic piece that appeared to direct incoming IR light right to the sensor. I am wondering if this would help me any. I will test it tomorrow to see what it does. One thing I am still concerned about is the sun's IR light affecting the reading to the chip compared to the reading at night. Since the IR level will be higher during the day, I would need to design my circuit to trigger the pulses at a lower threshold since the IR sensor goes low when IR is detected. At night, the IR is not as intense so the IR sensor may not drop low enough to trigger a pulse.

    I recently freed up some space on my breadboard so I can work with more options and possibly put a few more test points for daytime and night time testing. I will get this working eventually :p
  • YanomaniYanomani Posts: 1,524
    edited 2012-09-28 22:40
    Hi eagletalontim
    When your think infrared, always think heat. If nothing reflects it, it will be absorbed. Absorption without cooling, means re-emission. Surround your box with reflective aluminium sheet or anything like it. Your sponge alone could be an accumulator that spreads heat inside the box. Remenber; Under sunlight, heat always scales up if not conveniently reflected or cooled, i.e., conducted to another direction, away from your sensor.
    Prophead100 also gave a good tip. Look at http://www.robotroom.com/Polarizers.html.

    Hope it helps.

    In the mean time... Pray God and pass the ammunition.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-28 23:07
    hmmm, I did not think about heat being an issue. Since putting aluminum foil by the power meter can affect the signal it sends to the power company, I will have to find an alternative solution if heat is actually my issue. I will continue testing tomorrow as it is 1am here and the sun is not out :p
  • kwinnkwinn Posts: 8,697
    edited 2012-09-29 11:51
    White paint will also reflect a lot of that heat produced IR. I don't know how or where your meter is mounted in relation to your house, but on a house I owned at one point the meter was out on the front of the house. It was a bit of an eyesore to me so I built a nice little box with a door around it. Never had a complaint from the utility company.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-09-29 12:34
    I think you can solve your problem by using a capacitor to block the DC offset produced by ambient light.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-09-29 13:08
    Thinking heat produces near IR is a common misconception. Near IR as used with remotes and IR LEDs etc is better thought of as a different color rather than heat.

    You can get things hot enough to "glow IR hot" but only if it's almost hot enough to "glow red hot".

    I've taken photos of a stove just barely too cool to glow red. With IR film in the camera I could capture an image of the heat with the film. So if something isn't almost red hot the heat wont affect the near IR light given off by it.

    Far IR is a different story.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2012-09-29 13:54
    Well, from testing today, I have found that the DVD player's IR sensor will not pick up the IR pulses from the power meter. I had it sitting directly on top of the IR output and there was no signal change. When I took a TV remote and pushed a button while pointing it in the general direction of the sensor, the signal pulsed as it should. Very strange! I also tried 2 different photocells to see if the could pick up the light but had no luck. I am now back to using the IR sensor from RadioShack and covered the top of the meter a little more to block more sunlight. I hooked up an OHM meter directly to the sensor and covered the top of the power meter till the ohms were as low as I could get them. I was using an analog meter to ensure I would get the best swing per pulse and to ensure that there was minimal light entering the sensor. Once it was all hooked back up to the breadboard, I had to re-tweak the resistor values to get the PNP transistor to trigger properly per pulse which triggers the input pin on the Prop. Everything is good so far. Depending on how sunny it is tomorrow, I will be able to see if the changes helped. Guess I have time to adjust some things in my program and fix a few bugs :)
Sign In or Register to comment.