Dia-Smart logo
Dia-Smart
A Third-Year Project of the Department of Computer Engineering, University of Peradeniya

Smarter and Safer
Diabetes Management
for Elderly Insulin Users

Dia-Smart is an IoT-based diabetes-management ecosystem that connects insulin-dose tracking, glucose readings, storage safety, inventory monitoring, alerts, and caregiver visibility through one integrated platform.

Dia-Smart Care Gateway Interface Preview — Demo Data
Latest Glucose
112 mg/dL
Connected Device
Last Insulin Dose
6 Units
Taken 45m ago
Storage Temperature
4.2 °C
Safe Range
Insulin Inventory
120 Units
~8 days remaining
System status: Storage temperature within the configured safe range.
3 Connected Hardware Units
AWS Cloud Deployment
4 Role-Based User Views

Diabetes management is fragmented and difficult for elderly patients

Elderly insulin users must coordinate glucose measurement, insulin administration, safe storage, and inventory management. Existing devices usually operate independently, creating incomplete records and increasing dependence on memory and manual tracking.

Dose Uncertainty

Missed, repeated, or incorrectly recorded insulin doses.

Storage Safety

Insulin may be exposed to unsuitable refrigerator temperatures.

Inventory Gaps

Patients may not identify low insulin availability in time.

Limited Visibility

Caregivers and doctors lack a single, complete patient timeline.

One connected ecosystem for safer diabetes management

Dia-Smart combines three connected hardware units with a secure cloud platform and role-based dashboard to create a unified patient-management workflow.

Inner Unit — Smart Insulin Vault

Installed inside the refrigerator to monitor insulin-storage temperature, remaining inventory, and storage activity.

Outer Unit — Data Hub

Acts as the elderly-friendly patient interface, local processing unit, fallback confirmation device, and cloud communication gateway.

Pen Unit — Dose Detection Module

Attaches to the insulin injector pen and uses a magnetic encoder to detect dial rotation and estimate the selected insulin dose.

Secure Cloud Platform

Combines dose, glucose, storage, inventory, prescription, and alert records within one patient timeline.

Essential diabetes-management functions connected in one platform

Dia-Smart brings together physical hardware, wireless networks, and secure software applications to streamline daily clinical operations.

Automated Dose Tracking

Uses magnetic-encoder readings to monitor insulin-pen dial movement and record estimated dose events.

Glucose Integration

Retrieves readings from supported Bluetooth Low Energy glucometers.

Storage Safety Monitoring

Tracks refrigerator temperature and storage activity.

Inventory Monitoring

Uses weight measurements to estimate the remaining insulin quantity.

Alerts and Caregiver Visibility

Provides relevant system notifications and remote access to patient records.

Offline Reliability

Buffers important events locally and synchronizes them after reconnection.

Manual Confirmation Fallback

Allows the patient to confirm or correct uncertain dose readings using the Outer Unit display and keypad.

Security Architecture
  • BLE pairing
  • MQTT over TLS
  • AWS IoT X.509 certificates
  • HTTPS REST APIs
  • JWT authentication
  • Role-Based Access Control
  • Backend-mediated database access
Reliability Mechanisms
  • Offline data buffering
  • Automatic synchronization
  • Event persistence
  • Duplicate prevention
  • Timestamp synchronization

How Dia-Smart works end to end

A four-layer IoT architecture connecting sensing devices, secure communication, cloud processing, and role-based user interfaces.

Layer 1

Edge / Device Layer

Inner Unit — Smart Insulin Vault Outer Unit — Data Hub Pen Unit — Dose Detection Module Compatible BLE Glucometer
Layer 2

Communication Layer

ESP-NOW: Inner Unit to Outer Unit BLE: Pen Unit and glucometer to Outer Unit Wi-Fi MQTT over TLS: Outer Unit to AWS IoT Core HTTPS REST API: backend to dashboard
Layer 3

Cloud Backend Layer

AWS IoT Core Spring Boot backend on Amazon EC2 Amazon RDS PostgreSQL Alert processing Business logic Secure data storage
Layer 4

Presentation Layer

Patient View Caregiver View Doctor View Administrator View
Data Processing & Forwarding flow: The Outer Unit receives local device data, performs validation, correlation, timestamping, JSON packaging, and temporary buffering, and securely transmits verified records to the AWS cloud platform.

Three connected units built for practical home use

Custom microcontrollers, sensors, and structural enclosures integrated to support daily routines.

Inner Unit — Smart Insulin Vault

  • ESP32 development board
  • DS18B20 temperature sensor
  • Load cell with HX711 interface
  • Reed sensor for storage-activity detection
  • Li-ion battery and battery-management circuitry
  • Custom 3D-printed enclosure
Purpose: Monitors refrigerator temperature, insulin inventory, and storage activity and transmits readings to the Outer Unit through ESP-NOW.

Outer Unit — Data Hub

  • ESP32-S3 microcontroller
  • TFT display
  • Numeric keypad
  • Buzzer
  • BLE connectivity
  • Wi-Fi connectivity
  • Power-supply circuitry
  • Custom enclosure
Purpose: Receives information from the Inner Unit, Pen Unit, and compatible glucometer, provides elderly-friendly guidance and fallback confirmation, and sends verified events to the cloud.

Pen Unit — Dose Detection Module

  • Seeed Studio XIAO ESP32-C3
  • Magnetic rotary encoder
  • 250mAh Li-Po battery
  • Custom attachment enclosure
Purpose: Mechanically attaches to the HumaPen Ergo injector pen, monitors dial rotation, estimates the selected dose, and transmits the event to the Outer Unit through BLE.

Hardware Design & Calibration Evidence

PCB Design
Enclosure Design
Sensor Calibration

Coordinated sensing, communication, and reliable event handling

Firmware has been developed for the Inner Unit, Pen Unit, and Outer Unit using the ESP32 Arduino framework and PlatformIO. Modular services and FreeRTOS-based tasks allow sensing, communication, storage, and user-interface operations to run independently.

Inner Unit Firmware

  • DS18B20 temperature acquisition
  • Load-cell and HX711 weight measurement
  • Reed-sensor storage-activity detection
  • Sensor validation and threshold handling
  • ESP-NOW transmission
  • Local buffering
  • Retransmission of unsent events
  • Power and sleep management

Pen Unit Firmware

  • Continuous magnetic-encoder rotation tracking
  • Dose-selection and injection-event detection
  • Encoder movement to dose conversion
  • BLE communication
  • Persistent dose-event storage
  • Automatic retransmission after failure
  • Low-power task management

Outer Unit Firmware

  • ESP-NOW reception from the Inner Unit
  • BLE communication with the Pen Unit and glucometer
  • Event aggregation and time synchronization
  • TFT display control
  • Keypad-based dose confirmation and fallback entry
  • JSON event generation
  • Wi-Fi and MQTT communication
  • Offline message queuing
  • Automatic replay after reconnection
  • Acknowledgement handling
  • Duplicate-event prevention

Firmware Validation Evidence

PlatformIO Build Output
Communication Logs
Outer Unit Display

Secure interfaces for patients, caregivers, doctors, and administrators

The software tier coordinates clinical tasks, aggregates records, and manages user views securely.

Dia-Smart Care Gateway Dashboard

Cloud Backend Capabilities

The Spring Boot backend processes MQTT telemetry, applies business rules, manages users and devices, generates alerts, and provides secure REST APIs.

  • Telemetry reception and processing
  • JWT-based security & RBAC
  • Patient-caregiver relationships
  • Patient-doctor relationships
  • Device registration and assignment
  • Glucose & dose event records
  • Storage & inventory monitoring
  • Alert evaluation and resolution
  • Prescription & schedule checks
  • System auditing & admin functions

Web Dashboard Features

A responsive React web interface accessible on desktop, tablet, and smartphone web browsers.

  • Patient summary and timeline
  • Glucose trend analytics
  • Insulin dose history & logs
  • Prescriptions & dose schedules
  • Storage temperature alerts
  • Inventory level estimation
  • Alert triggers & notifications
  • Patient and care-team matching
  • Caregiver and Doctor portals
  • System configuration console

Deployment Infrastructure

Implemented on AWS cloud infrastructure for scalability and security.

  • AWS IoT Core MQTT broker
  • Spring Boot EC2 container
  • Amazon RDS PostgreSQL database
  • React dashboard on AWS Amplify

Technology Badges

Validation from sensor to cloud dashboard

Continuous integration checks run alongside hardware validation benches to confirm system functionality.

Hardware and Firmware Testing

  • Completed Initial temperature-sensor calibration
  • Completed Initial load-cell calibration
  • Completed Basic Pen Unit dose-detection testing
  • Completed Basic hardware communication demonstration
  • In Progress Sensor and dose-detection accuracy
  • In Progress BLE and ESP-NOW reliability
  • In Progress Offline buffering and reconnection behaviour
  • In Progress Long-duration system operation
  • In Progress Enclosure and hardware refinement

Software and Cloud Testing

  • Completed Backend automated tests
  • Completed Frontend automated tests
  • Completed API validation using Postman
  • Completed Authentication and access-control implementation tests
  • In Progress MQTT-to-backend integration validation
  • In Progress Cloud-data synchronization
  • In Progress Alert-generation validation
  • In Progress End-to-end dashboard validation
  • In Progress Continuous AWS deployment testing

Testing & Automated Verification Evidence

Backend Tests
Frontend Tests
API Validation (Postman)

Prototype development cost

Consolidated prototype construction costs and testing expenditures.

From problem identification to integrated prototype validation

Schedule of the research, development, and validation milestones spanning November 2025 to August 2026.

Task Description
Nov '25
Dec '25
Jan '26
Feb '26
Mar '26
Apr '26
May '26
Jun '26
Jul '26
Aug '26
Research and Requirement Analysis
Nov–Dec 2025
System Architecture and Design
Jan–Feb 2026
Hardware, PCB & Enclosure
Feb–Apr 2026
Firmware Development
Mar–Jun 2026
Backend, Dashboard & Cloud
Apr–Jul 2026
Integration Testing & Validation
Jul–Aug 2026
Current Phase: Integration Testing and Validation

Dia-Smart currently has a working basic integrated prototype. Current testing focuses on sensor and dose-detection accuracy, device communication reliability, offline buffering, cloud synchronization, alert generation, dashboard usability, long-duration operation, and enclosure refinement.

From a retrofit attachment to a fully proprietary Dia-Smart insulin pen

The current Dia-Smart Pen Unit already supports dial-rotation sensing, dose estimation, embedded processing, and wireless transmission through a compact attachment fitted to a HumaPen Ergo injector pen. The future plan is not to add a missing feature, but to redesign the validated mechanism as a complete Dia-Smart insulin pen with an integrated smart cap. This will replace the external commercial pen body with a more compact, adaptable, manufacturable, and fully proprietary Dia-Smart design.

Current Prototype

Dia-Smart sensing and communication attachment fitted to a commercial HumaPen Ergo injector pen.

Future Product

Purpose-built Dia-Smart insulin pen and integrated smart cap retaining the validated sensing and communication functionality.

The people behind Dia-Smart

Department of Computer Engineering, Faculty of Engineering, University of Peradeniya.

Project Supervisors

Team Members