DIY Sanitizer Dispenser Kit with Timer Documentation
The DIY Sanitizer Dispenser Kit with Timer is an innovative IoT component designed to promote good hygiene practices in various settings, such as households, offices, schools, and public spaces. This kit enables users to create a customized hand sanitizer dispenser with a built-in timer, ensuring that individuals sanitize their hands at regular intervals. The kit consists of a microcontroller, a servo motor, a pump, a sensor, and a timer module.
Microcontroller: Arduino-compatible board (e.g., Arduino Uno or Arduino Nano)
Servo Motor: SG90 Micro Servo Motor
Pump: DC 3V Peristaltic Pump
Sensor: IR Infrared Obstacle Avoidance Sensor
Timer Module: DS1307 Real-Time Clock (RTC) Module
Power Supply: 3V-5V DC (via USB or battery)
| Component | Pin | Description |
| --- | --- | --- |
| Microcontroller | D2 | Servo Motor Signal |
| Microcontroller | D3 | Pump Signal |
| Microcontroller | D4 | IR Sensor Signal |
| Microcontroller | SCL, SDA | Timer Module (I2C) |
| Servo Motor | VCC, GND, SIG | Motor Power, Ground, Signal |
| Pump | VCC, GND | Pump Power, Ground |
| IR Sensor | VCC, GND, OUT | Sensor Power, Ground, Output |
| Timer Module | VCC, GND, SCL, SDA | Timer Power, Ground, I2C |
### Example 1: Basic Sanitizer Dispenser with Timer
This example demonstrates a basic implementation of the DIY Sanitizer Dispenser Kit with Timer. The dispenser will dispense sanitizer every 30 seconds.
```c++
#include <Wire.h>
#include <Servo.h>
// Initialize servo motor and pump pins
const int servoPin = 2;
const int pumpPin = 3;
// Initialize timer module
DS1307 rtc;
void setup() {
// Initialize servo motor and pump
pinMode(servoPin, OUTPUT);
pinMode(pumpPin, OUTPUT);
// Initialize timer module
Wire.begin();
rtc.begin();
// Set timer to dispense sanitizer every 30 seconds
rtc.setInterval(30);
}
void loop() {
// Check if timer interval has elapsed
if (rtc.isIntervalElapsed()) {
// Dispense sanitizer
dispenseSanitizer();
rtc.resetInterval();
}
}
void dispenseSanitizer() {
// Rotate servo motor to dispense sanitizer
Servo servo;
servo.attach(servoPin);
servo.write(0);
delay(500);
servo.write(180);
delay(500);
servo.detach();
// Activate pump to dispense sanitizer
digitalWrite(pumpPin, HIGH);
delay(500);
digitalWrite(pumpPin, LOW);
}
```
### Example 2: Advanced Sanitizer Dispenser with Sensor and Timer
This example demonstrates an advanced implementation of the DIY Sanitizer Dispenser Kit with Timer. The dispenser will dispense sanitizer only when an individual is detected by the IR sensor, and will also keep track of the number of dispenses.
```c++
#include <Wire.h>
#include <Servo.h>
// Initialize servo motor, pump, and IR sensor pins
const int servoPin = 2;
const int pumpPin = 3;
const int irSensorPin = 4;
// Initialize timer module
DS1307 rtc;
// Initialize dispense counter
int dispenseCount = 0;
void setup() {
// Initialize servo motor, pump, and IR sensor
pinMode(servoPin, OUTPUT);
pinMode(pumpPin, OUTPUT);
pinMode(irSensorPin, INPUT);
// Initialize timer module
Wire.begin();
rtc.begin();
// Set timer to dispense sanitizer every 30 seconds
rtc.setInterval(30);
}
void loop() {
// Check if timer interval has elapsed
if (rtc.isIntervalElapsed()) {
// Check if individual is detected by IR sensor
if (digitalRead(irSensorPin) == HIGH) {
// Dispense sanitizer
dispenseSanitizer();
dispenseCount++;
Serial.print("Dispense Count: ");
Serial.println(dispenseCount);
}
rtc.resetInterval();
}
}
void dispenseSanitizer() {
// Rotate servo motor to dispense sanitizer
Servo servo;
servo.attach(servoPin);
servo.write(0);
delay(500);
servo.write(180);
delay(500);
servo.detach();
// Activate pump to dispense sanitizer
digitalWrite(pumpPin, HIGH);
delay(500);
digitalWrite(pumpPin, LOW);
}
```
Note: These code examples are for demonstration purposes only and may require modifications to suit specific use cases. Additionally, proper safety precautions should be taken when working with electronic components and sanitizers.