Project Link: https://github.com/ntdinh05/321_project
- Arduino R3 UNO
- Breadboard
- Jumper wires
- 2 ultrasonic sensors
- 16x2 LCD Display
- Joystick
- Push button
- RTC module DS1307
- LED
- Resistors for LCD and LED wiring
- Ultrasonic 1: trigPin1 = 9, echoPin1 = 10
- Ultrasonic 2: trigPin2 = 11, echoPin2 = 12
Note: ideally, the 2 sensors should be placed horizontal separately (trig/echo face of the sensors facing the same direction) by 5 - 7 inches in between to prevent crosstalk.
- LED: lightPin = 8
- Joystick: joyXPin = A0, joyYPin = A1, joySWPin = 13
- Push button: menuButtonPin = A2
- LiquidCrystal
- RTClib
- Use the Arduino IDE, open the code.ino file, choose your board, and upload the code
- Note: if you run the RTC in the first time, you have to write some scripts to set up the time for RTC
- After having your system set up, walk by the 2 sensors normally to see the occupancy increasing and decreasing
- For the menu, press the push button (not the joystick switch)
- For navigation in menu, move the joystick UP/DOWN. To select an setting in menu, press the joystick switch.
- For navigation in setting, move the joystick LEFT/RIGHT to select Min/Sec or Hr/Min, UP/DOWN to increment/decrement the selecting variable
- To save the setting/go back to the main screen, press the push button again
- x2 Ultrasonic sensors (main feature): measure the occupancy, using a threshold distance value. Objects in the threshold means a sensor is triggered. We decide entry/exit based on which one is triggered first.
- Set Timeout: set how long will the lights go off
- Set Do not Disturb: the lights will not off if in that time range
- Set Occupancy: declare how many people in the room