Page 171 - Toucpad robotics C11
P. 171
7. Attendance option:
RFID (Arduino): MFRC522 module via SPI (SDA, SCK, MOSI, MISO, RST) to respective pins.
°
QR (Pi): Connect camera; no extra wiring.
°
E. Software Setup
Arduino path: Install Arduino IDE libraries: NewPing (ultrasonic), Servo, MFRC522 (RFID).
l
Raspberry Pi path: Boot Pi OS sudo apt install python3-opencv python3-pip pip install gpiozero qrcode
l
pyzbar (or opencv-python) enable camera in raspi-config.
F. Control Logic (write first as blocks/flowcharts)
1. Main loop (navigation):
Read front distance (or left/right IR).
°
If distance < threshold stop turn away (short reverse + spin) continue.
°
Else drive forward with PWM for smooth motion.
°
2. Servo lid:
On button press or arrival flag servo open wait close.
°
3. Energy saver:
Read LDR (ambient light).
°
If dark and motion (optional PIR) detected relay ON; else OFF.
°
4. Attendance (choose one):
RFID: On tag detect log ID + timestamp to Serial/SD.
°
QR (Pi): Capture frame decode QR log to CSV + show status.
°
G. Step-by-Step Execution (Arduino path example)
1. Test modules individually:
a) Blink test; b) Read ultrasonic; c) Spin motors via L298N; d) Move servo; e) Toggle relay; f) Read RFID tag.
°
2. Integrate mobility:
Combine ultrasonic + motors basic obstacle avoidance (forward/turn).
°
3. Add servo lid:
Trigger via push-button; verify open/close angles (e.g., 0°/90°).
°
4. Add energy saver:
Calibrate LDR threshold (note ADC value for lights ON/OFF).
°
5. Add RFID attendance:
Store known tag IDs; print “Present: Name” on serial/LCD; optional SD log.
°
6. Full system run:
Start robot navigate corridor model (masking tape lanes) stop at a “delivery spot” mark open lid
°
return attendance check at a station energy saver demo in a darkened box/room.
7. Tuning:
Adjust ultrasonic threshold, motor PWM, servo angles, LDR threshold.
°
8. Document:
Block diagram, wiring photo, flowcharts, evidence (serial logs/video), and a 1-page reflection (what worked/
°
what to improve).
H. Step-by-Step Execution (Raspberry Pi path example)
1. GPIO quick tests with gpiozero: LED blink motor driver control.
2. Camera test: OpenCV preview capture frame save.
3. QR decode: Use pyzbar/OpenCV to read sample QR; write CSV log.
4. Ultrasonic or IR read: Print distance/proximity; define threshold.
169
Assignments

