Hi guys, so I've been thinking of making some sort of sensor, essentially I want the sensor to move a servo 180 degrees one way, if there is a hand there, or stay still if there isn't. I was very very much hoping i could do this simply with LDR's I was even thinking of placing an LED in front of the LDR so that if the light path between the two was cut then it would move the servo and if not it wouldn't.
What I was wondering though was how would I deal with variable light conditions throughout the day, for example I looked at LDR values through the analog pin and with the room light on it differs quite a bit compared to the room light off, even if I add a LED beaming its own light at it it just changes the difference in values, not the complete value.
Is there any recommendations people have in countering this issue? both physical or coding wise, although I'm pretty limited in building something physical in shielding it from light.
Basically I want this to work in both night and day as well, which I'm guessing would mean I need an LED beaming light to it when it is night time.
I want the sensor to move a servo 180 degrees one way, if there is a hand there, or stay still if there isn't.
Do mean the servo moves back when the hand is moved away??
If you want this to be very directed, just put the LDR in a small tube of dark paper etc.
Light will vary a LOT from night/home illumination to day. You may need to save the data from "recent no-activity light level" and use that to adapt to changing light conditions.
It's a good easy-to-experiment-with example.
How about the servo runs a "hand" that moves towards your hand when you get close enough?
haha yeah my bad, thats exactly what I meant.
The cardboard idea is a good one though, even if the light changes it might at least make it slightly more accurate, or at least better then it is currently.
I was thinking of saving similar data as well to adapt to the conditions, the problem is I'm unsure exactly how I would code it so that it would know to adopt to the conditions instead of thinking that a hand was in the way of the LDR, also I was kinda hoping that I could get it working whether say the light was turned off in a room or not, which might not allow the code to adapt to know the difference.
I'm a little confused with this part?
terryking228:
How about the servo runs a "hand" that moves towards your hand when you get close enough?
Why not use a cheap infrared sensor ?
dr_watson:
Why not use a cheap infrared sensor ?
I would say the biggest reason was that I did not know there was one hahaha. Good idea though, I've never actually used one before though, are they much different from getting values from compared to the normal LDR?
Also is that the same as this
http://www.jaycar.com.au/productView.asp?ID=ZD1952
http://www.jaycar.com.au/productView.asp?ID=ZD1953
Everything I can buy easily is on that site, but I don't see a cheap infrared sensor, but at the same time I'm not too sure what I'm looking for (plus theres no such thing as jaycar and cheap :p)
Cheers
Looks like it do some research before getting that, but yr normal automatic flushes and taps are based on that technology.
LDRs have the advantage of being very simple.
I would be inclined to read the light value every few seconds and if it changed significantly (i.e got darker) between one reading and the next I would assume someone was near - and vice versa.
It should be very easy to try out.
...R
The sensors sound interesting, I'm wondering though since its infrared does this mean it can only view the infrared region and that means only an infrared LED would turn it on and off? Which would be fine, an infact perfect, but I'm unsure whether things such as normal light would go into the infrared region as well? Then again I'm assuming it would be similar to a TV and a remote, so I know it does work. I was actually wondering what happens for automatic taps and the like.
I was thinking of the reading light value for every few seconds part, its interesting but then I can't tell the difference between someone having their hand there and the light in the room being switched off, then again it would definitely be worth testing.
I had another idea as well, in testing the light I found that with the LED on the light was about 200 int values higher then the LED off, no matter what light I was in, that number would increase by 200, so it might be possible if I blink a LED at 1 second intervals, and then test from there, that way I will have a value with LED on, and a value with LED off, and those values will change depending on light, but if the value was found to be below 200 for longer then 1 second then it would mean there is a hand there??
Problem is I'm hoping to get this done by Monday, an am unsure whether using the LDR I have now will be the quickest way, or just buying the IR would be quickest and easiest.