Skip to content

pasindudarshana/Medibox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🩺 MediBox – Smart Medicine Management System

EN2853 - Embedded Systems and Applications | Semester 4 Project

📘 Overview

MediBox is an intelligent embedded system designed to manage and monitor medicine dispensing and storage conditions. Built around the ESP32 platform, it integrates environmental sensing, actuator control, real-time scheduling, and an IoT dashboard via Node-RED using MQTT communication. The goal is to assist users—especially the elderly or chronically ill—in maintaining timely medication habits while monitoring the surrounding environment.

🔧 Features

  • 🌡️ Environmental Monitoring

    • DHT22 sensor tracks temperature and humidity inside the medicine box.
    • Light intensity sensing with LDR to detect ambient conditions.
  • ⚙️ Servo-Controlled Dispenser

    • Servo motor dynamically adjusts based on light, temperature, and configurable thresholds.
  • Alarms & Scheduling

    • Multiple daily alarms with options to snooze or delete via button interface.
  • 🖥️ OLED Status Display

    • 0.96" OLED screen shows real-time temperature, time, alarm notifications, and system status.
  • 📡 MQTT Integration

    • Publishes sensor data and receives real-time parameter updates using MQTT topics.
  • 🌐 Node-RED Dashboard

    • Visualizes sensor data and allows real-time parameter tuning remotely via web interface.

🧰 Hardware Requirements

  • ESP32 Dev Board
  • DHT22 Temperature and Humidity Sensor
  • LDR (Light Dependent Resistor)
  • SG90 Servo Motor
  • 0.96" OLED Display (128x64 I2C)
  • Buzzer
  • Push Buttons (Menu navigation, Acknowledge, Snooze/Delete)
  • LEDs (System and Alarm indicators)
  • 5V Power Source / USB

💻 Software Stack

  • Development Tools

    • Arduino IDE or PlatformIO
    • Node-RED for Dashboard
    • MQTT Broker (e.g., Mosquitto, HiveMQ Cloud)
  • Key Libraries

    • Adafruit_SSD1306, Adafruit_GFX
    • DHTesp
    • PubSubClient
    • ArduinoJson
    • ESP32Servo

📁 Project Structure

MediBox/
├── src/
│   └── main.cpp                # Main firmware source code
├── Node-RED/
│   └── flows.json              # Dashboard flow for Node-RED
├── platformio.ini              # PlatformIO config (if used)
└── README.md                   # This file

⚙️ System Workflow

  1. Startup Initialization

    • Connects to WiFi and MQTT broker.
    • Initializes sensors, OLED, and actuators.
    • Publishes initial parameter settings.
  2. Sensor Sampling & Actuation

    • Periodically reads DHT22 and LDR values.
    • Computes new servo position based on parameters (e.g., temperature thresholds, gamma scaling).
    • Triggers alarm buzzer and updates display when alarm time matches.
  3. MQTT Communication

    • Publishes:
      • Sensor Data → medibox/sensor_data
      • Parameters → Medibox/ts, Medibox/tu, etc. or combined as JSON at Medibox/params
    • Subscribes:
      • Parameter updates from Node-RED → changes are applied live.
  4. Node-RED Dashboard

    • Visual elements: gauges, charts, sliders, and fields.
    • Users can remotely:
      • View live data (temperature, humidity, light)
      • Adjust parameters like ts, tu, gammaValue, Tmed, etc.
      • Monitor system status

🌍 Node-RED Dashboard Setup

  1. Import the flow:
    Node-RED/flows.json

  2. Configure MQTT broker settings in both firmware and Node-RED.

  3. The dashboard displays:

    • 🔢 Sensor values in real-time
    • 🎛️ Live-configurable parameters
    • 📝 System configuration summary

🛠️ Troubleshooting

  • Ensure all components are wired correctly.
  • Use the Serial Monitor to check for connectivity/debug messages.
  • Confirm broker credentials and topic names match.
  • Use Node-RED’s debug panel to inspect incoming MQTT messages.

👨‍💻 Author

Pasindu Dodampegama
Department of Electronic and Telecommunication Engineering
Faculty of Engineering, University of Moratuwa


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages