Software

Software

Table of Contents

Application

Introduction

This mobile application is designed to monitor and manage a smart bandage system. It provides functionalities for user authentication, data visualization, Bluetooth communication, and HTTP-based communication with a Python server. There are a total of three pages in the app, including the entrance page, main page, and communication platform. 

The key features are : 

  • User login: Users can create new accounts or log in with existing credentials using Firebase, a cloud-based authentication service.
  • Bluetooth Connectivity: The app connects to a Bluetooth module connected to an Arduino Nano for data transfer.
  • Data Visualization:
    • Battery Life: Displays the remaining battery power of the smart bandage system.
    • Usage Time: Tracks the duration for which the bandage has been in use.
    • Pandage Status: Visualizes the levels of medicine, bacteria, and probiotics using progress bars and percentages. Alerts are triggered when these elements reach critical thresholds.
      • Bacteria concentration and the remaining amount of medicine: Receives data from the bluetooth module. 
      • Probiotic Lifespan: Retrieves the lifespan of probiotics calculated by a growth curve model on a Python server.
  • HTTP Communication: Enables communication with a Python server running on a PC. Users can send requests and receive responses related to Probiotic Lifespan and Dosage & Threshold Determination. Additionally, they can send parameters for wound type, expected kill efficiency, and healing time to the server for simulation modeling.

Entrance page

This is the entrance page of the app. The included elements are: 

  • Product name and logo
  • Textboxes for username and password functions to create a new account or log in an existing one
  • An online database FirebaseDB

Let’s take a look!

Firebase

Firebase is a subsidiary acquired by Google, offering a platform service for mobile application development, known as BaaS (Backend as a Service). It helps us quickly develop our applications and supports cross-platform functionality, including Android, iOS, and Web. It integrates most of the backend features needed to set up a service for us. The main features include providing cloud hosting for users to set up web pages, offering databases for users to store and access data, and conducting backend analysis. Thanks to the collaboration with App Inventor, any changes we make are immediately reflected in the UI by storing data in Firebase’s Realtime Database.

Username & Password

In order to store personal data, we provide textboxes for users to fill in their account information, username and password, through the keyboard. For first-time users, they can create a new account and then log in. 

We use an online database Firebase to store all user information. A variable called global label in the form of a list is declared to get all the labels on FirebaseDB. During initialization, call FirebaseDB.GetTagList will make the app go on FirebaseDB website and get every label inside. Then, we will set global label to these information we got.

Create Account

To determine whether an account is successfully created when the “create account” button  is clicked, we first check if the username or password textbox is empty. If any fields are incomplete, a notifier will pop out, prompting the user to re-enter the information. Since at the beginning of the program, we already used call FirebaseDB.GetTagList to retrieve all the tags from the database and assigned the variable global label to the values we fetched, here we only need to check if the text in the text input box is in the global label list. This will allow us to determine whether the account has been used by someone before. So by this process, if the username already exists in the global label, the user will be notified to choose a different username. If no above errors occur, a message saying “Account created successfully” will appear on the screen. Then, call FirebaseDB.GetList will update the new user’s information into the database.

Login

To determine whether the login is successful when the “login” button  is clicked, we first check if the username or password textbox is empty. If any fields are incomplete, a notifier will prompt the user to re-enter the information. Furthermore, if the username is not found in the global label,  the user will be alerted that the account does not exist. Otherwise, call FirebaseDB.GetValue will call Firebase to fetch the value that its label is the username in the textbox.

When FirebaseDB gets the value, we will check whether the text in the password textbox suits the value in Firebase. If the password doesn’t match, a warning of “Wrong password” will appear, prompting the user to try again. Otherwise, the user will log in successfully and the main app page will open.

Main page

This is the main page of our app. The included elements are:

  • Bluetooth device connection
  • Battery life
  • Used time
  • Pandage status update.

Let’s check it out!

Bluetooth device connection

First of all, we need to connect our app to the Bluetooth module device that is connected to Arduino nano for data transfer. During initialization, ListPicker1 is enabled, allowing the user to interact with it and select their target Bluetooth device. Before the user makes a selection, ListPicker1.Elements displays the names and addresses of all the available devices using the BluetoothClient1.AddressesAndNames method. Once a device is selected and connected, the address of it is passed from ListPicker1.Selection and displayed in the ListPicker1.Text to let the user know what device is connected to. Also, a “Connected” text will become visible and all the functions on the screen are enabled simultaneously.

Battery Life

Efficient battery life management is critical for ensuring the reliability of our smart bandage system. Through the model written in arduino code, the app retrieves the remaining power of the battery via bluetooth. This tool makes it easy for users to manage and replace the battery as necessary before it runs out.

The received data is stored in a variable named global battery. This value is displayed in Label2.text. Battery levels are categorized into three ranges: above 70%, between 40% and 70%, and below 40%. A corresponding image will also change based on these levels.

Used Time

By displaying the elapsed time, we can track how long pandage has been in use. A timer Clock1 is set up to track the time. After clicking the “START” button , it functions as a time counter in the format hr:min:sec.

Pandage Status design

At the bottom of Screen2, a status of the current pandage is displayed in three ways. First, the amount of the three elements — medicine, germs, and probiotics — are shown by progress bars and percentages. Second, these values are categorized into three levels : Overabundant, Balanced or Scarce, making the data easy for users to understand. Lastly, alerts are triggered when any of these elements reach their thresholds. Recent messages are saved and shown in Label9 for users to refer to at any time.

Data transfer via bluetooth (bacteria / medicine)

The values of bacteria concentration and the remaining amount of medicine are sent via bluetooth and are initialized at 0 and 100. The transfer process, coordinated between Arduino code and the app, follows this cycle : First, the app sends “49” to Arduino as a signal that it’s “ready to receive data.” Then, when the app receives “m” as global text, it waits for the next numerical value, saving it as global medicine. Then, the value is then displayed in TextBox4 and represented in the LinearProgress1 bar. Finally, the global text is cleared, ready to receive the next piece of data. Medicine amount is categorized into three ranges: above 70%, between 40% and 70%, and below 40%. The three levels : Overabundant, Balanced or Scarce will be displayed in Label16. The same process with “b” as  global text repeats for receiving information about the bacteria concentration.

Arduino code for bluetooth data transfer

The provided code is designed for a basic Arduino project using Bluetooth communication via a SoftwareSerial object. In the Setup, includes the SoftwareSerial.h library, allowing the creation of software-based serial communication. TXD (transmit) is set to pin 0, and RXD (receive) is set to pin 1 for Bluetooth communication. A SoftwareSerial object named BT is created for Bluetooth communication on the specified TX and RX pins. Both the serial monitor (Serial.begin(38400)) and the Bluetooth connection (BT.begin(38400)) are initialized at a baud rate of 38400.

In the Main Loop, a byte array Data[] is initialized with 4 elements representing characters (‘m’ for medicine,’b’ for bacteria) and numbers. The loop continuously checks if any data is available from the Bluetooth device using BT.available(). When data is received, the byte is read using BT.read() and stored in SerialA . This value is printed to the serial monitor for debugging purposes. If the value of SerialA is 49 (ASCII for ‘1’), a message “in” is printed to the serial monitor, and a loop iterates over the array Data[] , sending each element via Bluetooth using BT.write(Data[j]). After sending the data, SerialA is reset to 0, and the program waits for 1 second before repeating the process (delay(1000) function).

Data transfer via wifi (probiotic)

The probiotic lifespan is calculated using growth curve models and sent to the app via HTTP.  This transferring process is fully described at screen 3. Although the data is received in a different way, the display and design method of progress bar and percentage on the screen are consistent.

Notifier and alerts

Since notifiers aren’t triggered frequently, we set a separate timer Clock2 for pop-up messages. There are five notifiers with different matching conditions : First, when global medicine falls below its threshold, the system is running out of medicine to defend against growing germs. Second, when global bacteria exceeds its threshold, the bacterial concentration is too high and medicine is needed to reduce it. Third, when global medicine and global bacteria reach their own thresholds simultaneously, it’s an emergency alert. Insufficient medicine and excessive bacteria means the pandage needs replacement and the user should see a doctor immediately. Fourth, when global probiotics falls below its threshold , the system is running out of probiotics , which are essential for accelerating the wound healing process. Fifth, when global probiotics reach zero,a cautionary notifier prompts the user to choose whether to continue or stop using the pandage.  If the user decides to stop, Clock1 and Clock2 will halt time tracking and data retrieval.

Communication Platform

This screen is functioning as a communication platform between the phone and python code via http. It can send a http request and receive a http answer at the same time.

HTTP

HTTP (Hypertext Transfer Protocol) is a communication protocol used by devices to send and receive data over the web. We are using it to exchange data between an Android app and a Python server running on a PC. The Android app is built using MIT App Inventor, allowing the interface to send HTTP requests (GET or POST) to the server (your PC). The Python server runs and listens for incoming HTTP requests. It processes these requests and responds to the Android app.

Datatransfer

The user texts in the TextBox1 then sends it out by clicking the SEND button. Then the Url of the Web would be added by the text input. When Web receives the text, it goes into the python code we designed and gives a response afterwards. This response text would be sent back to the app by displaying in Label1. 

Through this whole communication system, we can get information from the server and also send out requests to the server. We designed to get the Probiotic Life Span and Dosage & Threshold Determination by http while these values are calculated through a neural network model on the pc. Then, we can input some parameters — wound type, expected kill efficiency, and healing time  — from the app then send them through http for the stimulation model.

Module

Introduction

The core of our automated wound care system is a modular control unit based on the Arduino Nano, responsible for integrating sensing, data processing, and drug release functionalities. The module is designed to handle real-time cyclic voltammetry measurements, compute bacterial concentrations, control drug release based on preset thresholds, and monitor the system’s power consumption to ensure stable operation over extended periods. Each of these tasks is managed by separate sub-modules that communicate seamlessly within the Arduino framework, making the system scalable and adaptable for various wound healing scenarios (Li et al., 2021).
Our modular design strategy provides flexibility in both hardware and software, allowing us to modify or upgrade individual functions without disrupting the overall system architecture. This design approach not only simplifies development but also enables rapid adaptation to different wound types and treatment requirements.

System Architecture and Major Functional Blocks

The diagram provided illustrates the structure of the entire system, highlighting three primary functional blocks:

Cyclic Voltammetry Processor

Responsible for performing electrochemical measurements using cyclic voltammetry (CV) to monitor aptamer-biomarker interactions on the electrode surface. This block interfaces directly with the Screen Printed Electrode (SPE) and processes raw current data to detect binding events. A change in the redox current indicates conformational changes in the aptamer structure when a specific biomarker is bound (Smith et al., 2019).

Drug Release Controller:

This module manages the automated drug delivery system. It uses bacterial concentration data to trigger the release of antibiotics or probiotics through a dosage mechanism embedded in the hydrogel. When the bacterial level exceeds a preset threshold, a command is sent to the drug release unit, which administers a precise amount of treatment to the wound area (Brown et al., 2020).

Battery Life Monitor

Critical for ensuring long-term stability, this module tracks the power consumption of the entire system. By monitoring voltage and current draw from various components, it can estimate the remaining battery life and alert the user through the connected application when the battery needs to be recharged or replaced (Gonzalez-Gonzalez et al., 2020).

Detailed Module Descriptions

Each of the primary functional blocks is further divided into sub-modules, as described below:

Cyclic Voltammetry Processor

  • Signal Acquisition: Measures the current response at different applied potentials using a three-electrode setup (Working Electrode, Reference Electrode, Counter Electrode).
  • Data Processing: Converts raw current measurements into CV curves and calculates key metrics such as peak currents and peak potential shifts, which indicate the presence and concentration of specific biomarkers.
  • Bacteria Concentration Converter: The output from the CV processor is analyzed to estimate bacterial concentration in the wound. This estimation is based on changes in resistance and redox peak shifts, which correlate with bacterial metabolic activity (Wang et al., 2019).

Drug Release Controller

  • Dosing Trigger Mechanism: Uses bacterial concentration data to determine whether the level has exceeded a critical threshold. If triggered, a digital signal is sent to the actuator controlling the drug release channels.
  • Shrinkage Volume Calculator: Monitors changes in hydrogel size or volume, which are indicative of drug depletion or delivery success. This feedback is used to fine-tune the dosing frequency and amount.

Battery Life Monitor

  • Power Consumption Tracking: Continuously records voltage and current values to estimate the overall energy consumption.
  • Life Prediction Algorithm: Computes the remaining battery life using a regression model that takes into account usage patterns and environmental factors (e.g., temperature).

System Integration and Communication

All modules are interconnected through the central Arduino Nano unit, which manages data flow and decision-making. Data from the cyclic voltammetry module is passed to both the drug release controller and the app interface, allowing for real-time monitoring and intervention. The app, in turn, can send commands back to the Arduino to adjust treatment parameters based on external inputs, such as new wound images or updated medical guidelines (Cordova-Huaman et al., 2021).

The modular design allows for easy expansion. For example, new sensors (e.g., pH, temperature) can be added by simply integrating additional analog-to-digital conversion channels and modifying the software configuration. This scalability ensures that the system can adapt to new functionalities as needed.

Bacteria detection

Use Arduino Nano to conduct Cyclic voltammetry (CV) 

 

Cyclic voltammetry is highly sensitive to changes in the electrochemical environment, which makes it an excellent tool for detecting molecular interactions. So, it’s an often-used electrochemical technique for investigating the binding interactions between aptamers and biomarkers.

In the Arduino code, the voltage applied to an electrode is swept between two values (starting potential Ei and final potential Ef). Anodic scan, which is the forward scan, increases the voltage from Ei to Ef using analogWrite(). Cathodic scan, which is the reverse scan, decreases the voltage from Ef back to Ei by analogWrite() too. After the incremented voltage reaches the final potential, the voltage is decremented in the reverse direction then completes a cycle of the voltage sweep. During the process, the current at the working electrode is measured by using analogRead(). However, the measured raw data of current and potential will be converted into actual values by conversion factors based on the potentiostat calibration. At last, we print all the data out in the serial monitor for logging.

CV output

Resistance convert to bacterial concentration

When the biomarker comes into contact with the aptamer-modified electrode, the aptamer binds to it. This binding event can cause changes in the electron transfer properties at the electrode surface. During the cyclic voltammetry experiment, the electrochemical activity at the surface is recorded as the potential is swept. According to this phenomenon, the CV curve changes compared to a control status when aptamer and biomarker binding occurs. These changes reflect the binding kinetics and the interaction between them.

In our data of the relationship between LPS concentration and the measured resistance, it shows that when C=0, the measured resistance R = 5423Ω. When C=10^6 CFU/mL, R = 9885Ω. We used these two specific points as our first proof of concept for fitting. The model, Langmuir isotherm, is used to fit our data. The fitting equation used to model the resistance as a function of concentration is : 

R(C) = R0 + B*C/(Kd+C) . 

Where : 

  • R0 = 5489.20Ω , the baseline resistance when no biomarker is present.
  • B = 4894.70Ω, represents the maximum change in resistance.
  • Kd = 4.64*10^6 CFU/mL, represents the concentration at which half of the aptamer binding sites are bound to LPS. 
  • C is the concentration of LPS (CFU/mL).

Since the red curve of the model closely follows the measured points, it shows that the Langmuir isotherm is a suitable model for describing the binding interaction between LPS and aptamers. Then, we can finally derive our final transformation formula of the bacterial concentration : 

C = (R0*Kd – R*Kd) / (R-R0-B)

   = (5489.20*4.64*10^6 – R*4.64*10^6) / (R-5489.20-4894.70)

Drug Release Control

Introduction

The Drug Release Control module is a critical component of the smart bandage system that dynamically manages drug dosage and timing based on environmental feedback. While the CS Hydrogel Contraction Model determines the fundamental drug release dynamics, this section focuses on the electrical circuits and software integration that enable real-time control. By controlling the electrical field applied to the hydrogel matrix, the module adjusts drug delivery, ensuring optimal therapeutic effects at the wound site.

Circuit Design and Integration

The control module’s circuit, based on Arduino Nano, integrates multiple components including operational amplifiers, resistors, and capacitors that modulate the electrical field applied to the hydrogel. This circuit not only controls the electrical stimulation but also monitors real-time data from cyclic voltammetry readings to dynamically adjust drug release according to bacterial concentration changes.

This modular design allows for precise adjustments in drug delivery by controlling the voltage across the hydrogel. The circuit continuously monitors the electrical signals and feeds them into the software for real-time analysis and adjustment.

Dynamic Drug Control Algorithm

The core of the Drug Release Control module relies on real-time feedback from the cyclic voltammetry processor. When certain thresholds of bacterial concentration are detected, the module adjusts the electrical stimulation applied to the hydrogel, which directly influences the drug diffusion rate.

The module operates as follows:

  • Input from cyclic voltammetry: Determines the current bacterial load.
  • Feedback to control circuit: Adjusts the electrical signals based on the bacterial concentration to either increase or decrease the drug release rate.
  • Dynamic adjustment of μ\muμ: The concentration of the drug inside the hydrogel (μ\muμ) is dynamically modified using a closed-loop system.

Here’s an example of the real-time control algorithm implemented in the software:

# Real-time drug control function

def adjust_drug_release(cyclic_voltammetry_data, target_concentration):

    if cyclic_voltammetry_data['bacteria_concentration'] > target_concentration:

        # Increase electrical field to speed up drug release

        apply_electrical_field(intensity='high')

    else:

        # Maintain or lower the drug release rate

        apply_electrical_field(intensity='low')

This algorithm ensures that drug release is continuously fine-tuned based on bacterial concentration, preventing over- or under-dosage.

Add Your Heading Text Here

Although the CS Hydrogel Contraction Model is detailed in the hardware section, it is directly integrated into this software module. The hydrogel’s contraction is monitored through sensors, and the software calculates the real-time shrinkage using pre-determined constants. This data informs the control module to adjust the electric field strength. The equation governing this relationship is:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.