Overview
This lecture explains how to create a visitor counter using a PIR sensor and Arduino Uno in the Tinkercad simulator, including component assembly and basic programming.
Project Setup in Tinkercad
- Open Tinkercad in your browser, create a new circuit project, and name it (e.g., "Visitor Counter").
- Assemble components: Arduino Uno R3, 16x2 I2C LCD (set type to pcf8574, addr to 0x27), two PIR sensors, push button, green LED, resistor, buzzer (piezo).
- Connect LCD: GND to Arduino GND, VCC to 5V, SDA to Arduino SDA, SCL to Arduino SCL.
- Connect PIR sensors: VCC to 5V, GND to GND, signal pins to Arduino analog pins A0 and A1.
- Connect LED cathode to GND and anode (with resistor) to Arduino pin 5.
- Connect buzzer negative to GND and positive to Arduino pin 6.
- Connect push button: one side to GND, other side to Arduino pin 7 (set as input pull-up).
Programming the Arduino
- Use the LiquidCrystal_I2C library for the LCD display.
- Assign PINs as follows: PIR 1 to A0, PIR 2 to A1, LED to pin 5, buzzer to pin 6, reset button to pin 7.
- Initialize serial communication and LCD in setup; turn off buzzer and LED at start.
- In the loop, read values from both PIR sensors to detect visitor movement.
- If PIR sensor triggers (HIGH), increment the relevant visitor count, and activate LED and buzzer.
- If no movement is detected, LED and buzzer remain off.
- Pressing the reset button resets all visitor counts to zero and updates the display.
Testing and Simulation
- Start simulation in Tinkercad and test by triggering PIR sensors; LCD displays visitor counts.
- LED and buzzer are activated when movement is detected.
- Press reset button to clear counts on the LCD.
Key Terms & Definitions
- Tinkercad — Online simulator for circuit design and Arduino programming.
- Arduino Uno R3 — Microcontroller board for prototyping.
- PIR sensor — Passive Infrared sensor detecting motion by changes in infrared levels.
- LCD 16x2 I2C — Display module showing 2 lines of 16 characters, using I2C protocol.
- Push button — Simple switch to reset visitor count.
- Buzzer (Piezo) — Emits sound when activated by Arduino.
- Input Pull-up — Arduino pin mode that uses an internal resistor to keep the pin HIGH until grounded.
Action Items / Next Steps
- Assemble the circuit in Tinkercad following the wiring steps.
- Copy the provided code from the video description and upload it to your Tinkercad project.
- Test the simulation to ensure visitor counting and reset features work as expected.