Pages: [1]   Go Down
Author Topic: Arduino powered occupancy sensor  (Read 1098 times)
0 Members and 1 Guest are viewing this topic.
South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all. I want to use a 328 in my ceiling to work as an occupancy sensor for lighting and also to control the extractor fan by measuring humidity.

Everything seems straight forward, I have some of the bargain PIR sensors from eBay http://www.ebay.co.uk/itm/1x-Mini-Adjust-IR-Pyroelectric-Infrared-PIR-Motion-Human-Sensor-Detector-Module-/350789316726?pt=UK_BOI_Industrial_Supply_Security_Equipment_ET&hash=item51acac3076 which should do the job, but I'm not sure how to measure ambient light because I would want to mount a LDR inside or close to the PIR But I can see it causing issues when the lights have been turned on because the brightness would then more than likely be over the LUX threshold and the lights would cycle surely?

Hope that makes sense and I look forward to hearing any suggestions - maybe someone has torn down a standard PIR and seen how it is done?
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is what you almost always need to do when buying from ebay.

1. Roughly 98% of the time, they don't provide adequate documentation, but the products
   are almost always clones of someone else's IP, and who do provide documentation.

2. so, what you need to do is use "google images" search, and try to locate the original
    device, where someone does provide the correct documentation. Then, you'll know
    what you actually have.

3. in regards PIRs, a lot of these devices already have an LDR inside that's used to adjust
    the ambient light sensitivity - but of course, first you have to know what the heck it is
    that you actually have. So, go to #2.
Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi oric_dan. The PIR does not have a LDR built in and I know enough about it to use it but thanks for the tip smiley

I'm just wondering how to measure the ambient light without the room lights effecting the readings when they have been triggered?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12524
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the LDR is there so that the Arduino can know when to switch lamps on and off then presumably it already knows when the lamp is on and could apply the appropriate criteria to the LDR reading. In that case you just need to find out how much difference the lamp makes to the LDR reading and adjust the code to accommodate that.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there is no LDR there yet but I will be implementing one - I guess as you say maybe it will have to be a software thing to allow it to function properly once the lamp is on?

Thanks

Logged

UK
Offline Offline
Faraday Member
**
Karma: 101
Posts: 6155
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I assume you are measuring the ambient light so your PIR doesn't cause the lights to go on when someone enters the room during daylight hours.

Daylight to darkness doesn't change frequently so the logic for dealing with it seems simple.

1. If the room is empty the lights should be off regardless of ambient light.

2. If the room is occupied and the lights are off and the ambient light is high the lights stay off.

3. If the room is occupied and the ambient light is low the lights go on.

4. If the lights are on the ambient lighting is ignored and rule 1 is applied.

...R
Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Robin, I never really thought of it like that, I guess it will be a software thing then.

Thanks again!
Logged

UK
Offline Offline
Faraday Member
**
Karma: 101
Posts: 6155
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess with the logic I mentioned earlier there is a risk if the room is occupied prior to dawn that the lights won't go off when daylight comes if the room remains occupied.

If I was concerned about that I think I would locate my LDR so that it was looking out the window to detect outdoor light.

...R
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Another problem with this sort of project is reliably detecting the human, a PIR will only detect movement, if they sit still for 5 minutes it will think they have left the room.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

UK
Offline Offline
Faraday Member
**
Karma: 101
Posts: 6155
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the problem that gives substance to the expression "many hands make light work".

...R

if they sit still for 5 minutes it will think they have left the room.
Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Another problem with this sort of project is reliably detecting the human, a PIR will only detect movement, if they sit still for 5 minutes it will think they have left the room.

_____
Rob

I have thought quite a bit about this case, but can't think of a way around it using a standard PIR. You can get microwave occupancy sensors but I guess they also work on the principles of changing values.

I think if I go ahead I will have the lights fade out when the time has elapsed, then if the room is occupied it gives the occupier a chance to keep it on!

haha, many hands... I like it smiley
Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well, I was looking at the PCB and noticed through holes labelled cds. I have done some reverse engineering on the PCB, then I found a datasheet which confirms that the controller has a output disable function if the voltage on a pin is <2v http://www.ladyada.net/media/sensors/BISS0001.pdf

I had a 10k LDR lying around and tried it out, voltage was too low because the divider was only being pulled up to 3V via 1 1M resistor. I took it off and connected a 100K pot which seems to give a nice range of light to dark. Very chuffed with these little PIR's and they are so cheap!

Hopefully the only issue I have now is finding a bigger dome fresnel lense smiley



* IMG_20130517_014438.jpg (183.45 KB, 800x600 - viewed 35 times.)

* IMG_20130517_014458.jpg (237.6 KB, 800x600 - viewed 32 times.)
Logged

Pages: [1]   Go Up
Jump to: