Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

School project - Occupancy sensor light switch

Status
Not open for further replies.

Julie77

Newbie level 2
Joined
Apr 26, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hello there :)

I'm new on this Forum... but I need some help for my school project : :dance:
We came up with this project:

- It's a motion sensor that will be linked to a timer (5min) that will turn off the light(s) if no one is in the room after 5min.
The motion sensor and timer will be connected to the light switch.

Is anyone has any idea of how to make this ... ?

Thank you very much in advance for your help :)


Julie
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
Can you use PIC microcontroller for the project ?
 

Julie77

Newbie level 2
Joined
Apr 26, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hello Milan, yes I can use anything pretty much to build this project
 

SunnySkyguy

Advanced Member level 5
Joined
Sep 26, 2007
Messages
6,743
Helped
1,675
Reputation
3,348
Reaction score
1,644
Trophy points
1,413
Location
Richmond Hill, ON, Canada
Activity points
50,732
Driveway motion sensor work ok except have ambient light adj for disabling during daylight so adjustment needed.

To replicate the design with low voltage, you need several 100mA pulsed IR senders and a diffused wide angle IR detector.

The pulses are sent and detected by separating the light inside so only outside reflections are strongest. Then the level is high gain AC amplified and then peak detected. This DC is then rectified again for variation or a Photo Receiver chip with AGC on the same wavelength (e.g 850 nm) is bridge rectified for change in signal due to motion. A window comparator circuit with two open collector outputs are joined so that either a drop in refelction or a rise means motion has occurred.
The response time depends on the low pass filter so use 10 seconds or 1 minute with plastic film caps and 10Meg Rs to achieve .if the teacher is motionless, the lights will go off, so normally a CD4060 5 minute timer , reset by motion ( inverted window detector low = reset high ) is all you need.

Make sense?

The IR senders are cheap 1V 100mA 5mm IR diodes in series with R to 5V to limit current.
The rep rate can match a TV Rx chip at 22kHz or whatever with AGC works well up to 30m with analog AGC out . Ac amplify this to window detector. Use a fresnel film lens or similar plastic to disperse light with low ref
Internal refection if IR Rx is not black, (daylight blocking filter) it will pick up FL lamp flicker.
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
Fine the attached mikroC PRO PIC code. It uses PIC16F628A with 4 MHz internal oscillator. WDT is disabled. MCLR is disabled. See image for circuit. If you want to drive a light then remove the LED and connect a BC337 and a relay. Also connect a 1N4007 diode in parallel to relay coil so that cathode connects to Vcc and anode to collector of BC337.

Proteus 8.2 SP2 format file is also included. You have to use PIR sensor for motion detection. I don't remember whether the signal given by PIR sensor is high to low or low to high. I have coded for low to high. If it doesn't work with your PIR sensor then just change

Code:
INTEDG_bit = 1;
to

Code:
INTEDG_bit = 0;
in code and compile.

To do this you will need mikroElektronika's mikroC PRO PIC compiler. As the code is small it will compile in demo compiler. Just download and install mikroC PRO PIC compiler if needed.

Edit : Circuit with relay attached.

Edit: My mistake. The code is wrong. I will post the fixed code soon.

Edit: Fixed the code. When motion is detected it turns ON the light and starts a 5 minutes timer. If no motion is detected for 5 minutes then it turns OFF the light. I think this is what you need. If yes, use ver2 project.
 

Attachments

  • Light Switch.rar
    39.8 KB · Views: 5
  • Light Switch.png
    Light Switch.png
    13.2 KB · Views: 2
  • Light Switch Relay.png
    Light Switch Relay.png
    22.5 KB · Views: 4
  • Light Switch Relay.rar
    16.5 KB · Views: 6
  • Light Switch ver2.rar
    76.1 KB · Views: 5
Last edited:

SunnySkyguy

Advanced Member level 5
Joined
Sep 26, 2007
Messages
6,743
Helped
1,675
Reputation
3,348
Reaction score
1,644
Trophy points
1,413
Location
Richmond Hill, ON, Canada
Activity points
50,732
It may be excellent code, but excellent optical gain change or reflected IR change up or down with high sensitivity and threshold and time delay control comes first.
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
You can also use any 8 pin PIC12F for the project. I don't know which PIC is available at your place. If you decide to use 8 pin PIC12F device then let me know and I will post a project for it.

Edit WDT enabled project attached. Just to make sure that your project doesn't hang during demonstration.

- - - Updated - - -

Fixed code attached.
 

Attachments

  • Light Switch WDT enabled.rar
    44.5 KB · Views: 5
  • Light Switch PIC12F683.rar
    46.8 KB · Views: 9
  • Light Switch WDT enabled rev1.rar
    44.6 KB · Views: 6
  • light switch.png
    light switch.png
    27 KB · Views: 0
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top