# Daily Reminder - IoT Medication Reminder System

## Project Description
The Daily Reminder is a medication reminder system designed to help elderly users take their medication on time. This project utilizes Internet of Things (IoT) technology to manage medication schedules, utilizing a wearable wristband for direct notifications and a smart pillbox for tracking medication intake behavior.

## System Architecture
The system consists of three main components communicating via MQTT over Wi-Fi:
1. **Wearable Wristband (Board 1):** Alerts the user using a vibration motor/buzzer and displays the medication name and amount on an OLED screen.
2. **Smart Pillbox (Board 2):** Detects when the user opens the pillbox using a PIR motion sensor to confirm that the medication has been taken.
3. **Application/Dashboard:** Acts as the central controller to set daily routines, send notifications, and log medication intake history.

---

## Project File Structure

The project files are organized into the following directories based on the hardware components:

```text
.
├── wristband/           # Board 1: Wearable Device (ESP32-S3)
│   ├── boot.py          # Main execution script (OLED, Motor, MQTT sync)
│   ├── ssd1306.py       # OLED display driver
│   └── config.py        # Configuration file for WiFi and MQTT credentials
├── pillbox/             # Board 2: Smart Pillbox (ESP32-S3)
│   ├── main.py          # Main execution script (PIR Sensor, MQTT publish)
│   └── config.py        # Configuration file (Needs to be copied from wristband/)
├── schematic/           # Hardware wiring diagrams
│   ├── Board_1.png      # Circuit diagram for the wristband
│   └── Board_2.png      # Circuit diagram for the pillbox
├── LICENSE.txt          # License file (GNU General Public License v3)
└── README.md            # Documentation file describing the project

```

---

## Hardware Components & Pin Configuration

### 1. Board 1: Wearable Wristband

* **Microcontroller:** ESP32-S3-DevKitC-1
* **Display:** OLED Display (I2C) - Driven by `ssd1306.py`
* **Actuator:** Micro Vibration Motor / Buzzer (Connected to **GPIO 13**)

*Please refer to `schematic/Board_1.png` for the detailed wiring diagram.*

### 2. Board 2: Smart Pillbox

* **Microcontroller:** ESP32-S3-DevKitC-1
* **Sensor:** PIR Motion Sensor (Connected to **GPIO 21**)

*Please refer to `schematic/Board_2.png` for the detailed wiring diagram.*

---

## Setup and Installation Guide

### Step 1: Network & MQTT Configuration

1. Open the `config.py` file located in the `wristband/` folder.
2. Update the credentials to match your local Wi-Fi and MQTT Broker:
```python
WIFI_SSID = 'Your_WiFi_Name'
WIFI_PASS = 'Your_WiFi_Password'
MQTT_BROKER = 'your.mqtt.broker.address'
MQTT_USER = 'your_mqtt_username'
MQTT_PASS = 'your_mqtt_password'
TOPIC_PREFIX = 'your_topic_prefix'

```



### Step 2: Flashing Board 1 (Wristband)

1. Connect the first ESP32-S3 board to your computer.
2. Using Thonny IDE (or your preferred MicroPython tool), upload the following files from the `wristband/` directory to the root of the board:
* `boot.py`
* `ssd1306.py`
* `config.py`


3. Restart the board.

### Step 3: Flashing Board 2 (Pillbox)

1. Connect the second ESP32-S3 board to your computer.
2. Upload the `main.py` file from the `pillbox/` directory.
3. **Important:** Copy the updated `config.py` file from the wristband step and upload it to this board as well.
4. Restart the board.

---

## Contributors

| Name | Student ID |
| --- | --- |
| Thitiwat Somphong | 6810503480 |
| Pasavich Loyma | 6510503689 |

## Affiliation

Department of Computer Engineering

Faculty of Engineering

Kasetsart University

---

## License

This project is licensed under the **GNU General Public License v3 (GPL v3)**.

See the `LICENSE.txt` file for more details.

```

```