Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2025:eradu:iulian_adrian.andrei [2025/05/26 00:13]
iulian.andrei2608
pm:prj2025:eradu:iulian_adrian.andrei [2025/05/26 18:15] (current)
iulian.andrei2608
Line 48: Line 48:
  
 | **Component** ​               | **Arduino Pin(s)** ​     | **Reason for Selection** |                                                                                  ​ | **Component** ​               | **Arduino Pin(s)** ​     | **Reason for Selection** |                                                                                  ​
-| **Sensor Output (from OP07)**| ​A0                   | Analog input pin used to read the amplified voltage proportional to glucose level via ADC.|+| **Sensor Output (from OP07)**| ​A2                   | Analog input pin used to read the amplified voltage proportional to glucose level via ADC.|
 | **LEDs** ​        | D3, D5, D6, D9, D10, D11 | PWM-capable digital pins allow brightness modulation of LEDs to indicate different alert levels clearly. ​    | | **LEDs** ​        | D3, D5, D6, D9, D10, D11 | PWM-capable digital pins allow brightness modulation of LEDs to indicate different alert levels clearly. ​    |
 | **LCD 1602 I2C Module** ​      | SDA, SCL   | Dedicated I2C pins on Arduino Uno, used for communication with the LCD to display glucose values and status. ​ | | **LCD 1602 I2C Module** ​      | SDA, SCL   | Dedicated I2C pins on Arduino Uno, used for communication with the LCD to display glucose values and status. ​ |
Line 56: Line 56:
 == Interfaces and Communication:​ == == Interfaces and Communication:​ ==
  
-  * **Analog Input (A0):** Reads the output voltage from the OP07 amplifier via the ADC.+  * **Analog Input (A2):** Reads the output voltage from the OP07 amplifier via the ADC.
   * **Digital Outputs (D3, D5, D6, D9, D10, D11):** PWM-capable pins used to drive LEDs for visual alerts based on glucose classification,​ allowing brightness modulation.   * **Digital Outputs (D3, D5, D6, D9, D10, D11):** PWM-capable pins used to drive LEDs for visual alerts based on glucose classification,​ allowing brightness modulation.
-  * **I2C (A4 – SDA, A5 – SCL):** For communication with the 1602 LCD module displaying measurement data. +  * **I2C (SDA, SCL):** For communication with the 1602 LCD module displaying measurement data. 
-  * **UART ​(D0, D1):** Used for serial communication with a PC for debugging or data logging.+  * **UART:** Used for serial communication with a PC for debugging or data logging.
  
 == Power and Consumption:​ == == Power and Consumption:​ ==
Line 98: Line 98:
 ===== Software Design ===== ===== Software Design =====
  
 +=== Development Environment ===
  
-<note tip> +The firmware ​was developed using the **Arduino IDE**, targeting the **ATmega328P** microcontroller on the Arduino Uno platform. Code is written in **C/C++** using only core Arduino libraries
-Descrierea codului aplicaţiei (firmware)+  * '''​Wire.h'''​ – for I2C communication
-  * mediu de dezvoltare (if any) (e.g. AVR StudioCodeVisionAVR) +  * '''​LiquidCrystal_I2C.h'''​ – for interfacing with the LCD display.
-  * librării şi surse 3rd-party (e.gProcyon AVRlib) +
-  * algoritmi şi structuri pe care plănuiţi să le implementaţi +
-  * (etapa 3) surse şi funcţii implementate +
-</​note>​+
  
-===== Rezultate Obţinute =====+No third-party libraries beyond the standard Arduino ecosystem were required.
  
-<note tip> +=== Algorithm and Logic ===
-Care au fost rezultatele obţinute în urma realizării proiectului vostru. +
-</​note>​+
  
-===== Concluzii ​=====+The application firmware performs the following main steps: 
 + 
 +  - **System Initialization** 
 +    * Sets pin modes for analog input, LEDs, LCD, and the interrupt pin for the button. 
 +    * Initializes the I2C communication and LCD display. 
 + 
 +  - **Measurement Trigger** 
 +    * A measurement is initiated by pressing a push button connected to digital pin `D2`. 
 +    * This pin is configured to trigger an **external interrupt**. 
 +    * The interrupt sets a flag that is handled in the `loop()` function. 
 + 
 +  - **Analog Signal Acquisition** 
 +    * The analog signal (a voltage) from the output of the OP07 amplifier is read using `analogRead()` on pin `A2`. 
 +    * The ADC returns a value between 0 and 1023, corresponding to a voltage between 0 and 5V. 
 +    * This voltage is proportional to the current generated by the simulated test strip (using potentiometer). 
 + 
 +  - **Current and Glucose Calculation** 
 +    * The current in microamperes is calculated using Ohm’s law: //I Vout / Rf// 
 +    * The glucose level (mg/dL) is then estimated using a fixed proportionality factor derived during calibration:​ //​Glucose ​(Current_in_uA) * Sensitivity_Coefficient//​ 
 +    * The sensitivity coefficient was selected manually during testing using reference glucose values. 
 + 
 +  - **Classification and Output** 
 +    * Based on calculated glucose value, the result is categorized into: 
 +      - Hypoglycemia,​ 
 +      - Normal, 
 +      - Hyperglycemia. 
 +    * A corresponding LED is lit using PWM pins (D3, D5, D6, D9, D10, D13) for visual alert. 
 +    * The result is also displayed on the I2C LCD, showing both the glucose level and category. 
 + 
 +=== Current Implementation Status ​=== 
 + 
 +  * Analog signal reading via ADC (A2) – fully functional. 
 +  * Glucose calculation and classification – implemented and verified. 
 +  * PWM output on LEDs (pins D3, D5, D6, D9, D10, D13). 
 +  * LCD display via I2C – correctly displays readings and thresholds. 
 +  * External interrupt on D2 – used for manual measurement triggering. 
 + 
 + 
 +=== Implemented functions === 
 + 
 +  * **handleButtonInterrupt()** – Interrupt service routine (ISR) called when the user presses the button. It toggles the state of the glucometer (//​glucometerON//​) and sets a flag (//​buttonPressed//​) for state management. 
 + 
 +  * **turnOffAllLEDs()** – Sets PWM output of all six LEDs to zero using //​analogWrite//​. This ensures a clean reset when the system is turned off or reinitialized. 
 + 
 +  * **adjustRedPWM(diff)** – Called when hyperglycemia is detected. It calculates the intensity of red LEDs proportionally to how far the glucose level exceeds 150 mg/dL. 
 + 
 +  * **adjustYellowPWM(diff)** – Called in hypoglycemia cases. It increases the brightness of yellow LEDs proportionally to how far below 100 mg/dL the glucose level is. 
 + 
 +  * **adjustGreenPWM(glucose)** – Called when glucose levels are within normal range. It calculates a ratio within the 100–150 mg/dL band to smoothly vary the intensity between the two green LEDs. 
 + 
 +===== Results Obtained ===== 
 + 
 +During the operation of the project, the current value generated by the potentiometer,​ which simulates the current from an electrochemical test strip, is read through the Arduino’s analog input pin. Based on this current, the code calculates the estimated glucose concentration and displays it on the 1602 LCD screen. 
 + 
 +According to the calculated glucose level, RGB LEDs are controlled via PWM signals to indicate different glycemic states: 
 +  * For values below 100 mg/dL, yellow LEDs light up, indicating hypoglycemia. 
 +  * For values between 100 and 150 mg/dL, green LEDs are active, indicating a normal level. 
 +  * For values above 150 mg/dL, red LEDs turn on, signaling hyperglycemia. 
 + 
 +These results were validated through manual testing by adjusting the potentiometer and observing the corresponding changes on the display and LED intensity, confirming the correct operation of the system in simulating glucose measurement. 
 + 
 +The system responds quickly to changes in current and provides a clear user interface through the LCD display and visual LED indicators. 
 + 
 + 
 + 
 +===== Conclusion ===== 
 + 
 +This project successfully demonstrates a basic but functional glucometer built with Arduino. By simulating the sensor signal with a potentiometer and using an operational amplifier, we were able to measure small currents and convert them into glucose levels. The system provides clear feedback through an LCD display and colored LEDs, offering both visual and numerical information to the user.
  
 ===== Download ===== ===== Download =====
  
-<note warning> +Source code: 
-O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectuluisurse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-).+ 
 +https://github.com/​AdrianIulian26/​GlucoMeter
  
-Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:​pm:​prj20??:​c?​** sau **:​pm:​prj20??:​c?:​nume_student** (dacă este cazul). **Exemplu:​** Dumitru Alin, 331CC -> **:​pm:​prj2009:​cc:​dumitru_alin**. 
-</​note>​ 
  
 ===== Jurnal ===== ===== Jurnal =====
Line 133: Line 194:
 ===== Bibliografie/​Resurse ===== ===== Bibliografie/​Resurse =====
  
-<​note>​ +==== Hardware ==== 
-Listă cu documente, datasheet-uri,​ resurse Internet folosite, eventual grupate pe **Resurse ​Software** şi **Resurse Hardware**+ 
-</note>+  OP07 Operational Amplifier Datasheet  
 +    [https://​www.ti.com/​lit/​ds/​symlink/​op07.pdf TI OP07 Datasheet] 
 + 
 +  ​How Electrochemical Glucose Sensors Work   
 +    [https://​www.ncbi.nlm.nih.gov/​pmc/​articles/​PMC6790891/​ PMC Article on Electrochemical Glucose Biosensors] 
 + 
 +  * Principles of Glucose Meter Operation (Explanation) ​  
 +    [https://​www.ncbi.nlm.nih.gov/​pmc/​articles/​PMC3904486/​ NIH PMC Article on Glucose Meter Principles] 
 + 
 +==== Software ​==== 
 +  ​PWM Control with Arduino (Explanation and Examples) ​  
 +    [https://​www.arduino.cc/​en/​Tutorial/​PWM Arduino PWM Tutorial] 
 + 
 +  * Arduino Serial Communication Basics ​  
 +    [https://​www.arduino.cc/​en/​Serial/​Begin Arduino Serial] 
  
 <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​ <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​
  
  
pm/prj2025/eradu/iulian_adrian.andrei.1748207587.txt.gz · Last modified: 2025/05/26 00:13 by iulian.andrei2608
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0