Page 1 of 1

Mod for 1127 light sensor

Posted: Wed May 30, 2018 7:25 am
by berkinet
I want to detect the presence of an object in a contained space (actually, a mailbox) h: 30cm x w: 30cm d: 38cm. I have tried various approaches (IR presence, IR distance, sonar distance) and all had issues. I.e. not enough clarity between a small object and no object.

However, it seems to me that all I really wanted was to detect light reflected off any surface. So, I then painted the inside of the mailbox flat black and then modified an 1127 light sensor to add an onboard white LED (3.2v with a 100 ohm resistor) in a tube, pointing down from the ceiling of the mailbox. This mostly works. The only problem is that there is still a very small difference between empty and non-empty. I.e. 0.030v = empty and >0.035v = something present. Unfortunately, the difference is so small that a threshold of two sometimes misses the transition from non-empty to empty and a threshold of one just thrashes the network with updates.

My guess is a brighter LED would provide more reflected light and, therefore, easier detection.

So, the question: On a 1018 interfaceKit (actually, an SBC3) how much current can I draw from the 5v supply on an analog sensor?

Re: Mod for 1127 light sensor

Posted: Wed May 30, 2018 11:05 am
by Patrick
Almost 500mA.

-Patrick

Re: Mod for 1127 light sensor

Posted: Wed May 30, 2018 11:07 am
by berkinet
WoW. Thanks. I'll try 2 LEDs and lower the resistance a bit.

Re: Mod for 1127 light sensor

Posted: Thu May 31, 2018 2:54 pm
by berkinet
Ok. Two nice bright LEDs, plus a little shielding around the light sensor, did the trick. I now get a difference between nothing and something in the mailbox that exceeds 3 times the sensor threshold. I.e., with the threshold set at 3, I see SensorValues with nothing present of 10. But, with a small postcard present, the SensorValue jumps to 18 or greater. So, no ambiguity and no thrashing web service output.

Now, a new thought. Instead of providing the +5vcc to the 1127 from the Analog input of the ifKit, I could control it from a Digital Output. This way, instead of leaving the 1127 and LEDs on constantly, I could turn the 1127 on at regular intervals, say once a minute or 5 minutes, take a reading, and then turn it off. I assume I'd have to use a relay to control the 5v power from the ifKit. Does this make sense?

Re: Mod for 1127 light sensor

Posted: Thu May 31, 2018 3:07 pm
by Patrick
Yes, you could use something like 3054.