Professional Documents
Culture Documents
BLOCK DIAGRAM
BATTERY
POWER
SUPPLY
LED
SWITCH LIGHTING
SIGNAL
LCD DISPLAY
PROCESSING
OPTICAL
DETECTOR ALARM
SOUNDING
BATTERY POWER SUPPLY
R = 3.7/0.0037
R = 1000 ohms
INPUT BLOCK
This is used to detect the level of blood sugars using infrared light.
When a finger is placed in between the emitter and the receiver, the
infrared from the emitter will pass through it, though some will be
scattered, reflected, refracted and absorbed by the finger skin, muscles,
bone, and blood.
The receiver generates a proportionate signal it sends to the
microcontroller for processing.
Resistors R15 and R20 limit current through the infrared receiver and
emitter respectively and their values are got from;
R15 = 3.7/0.00037
R15= 10000 ohms
R17 = 3.7/0.037
R17= 100 ohms
R = 3.7/0.0037
R = 1000 ohms
SIGNAL PROCESSING
Resistor R19 limits current flowing through Q4 base and its value is got
from
R = 3.7/0.0037
R = 1000 ohms
This lights up whenever the system is scanning for glucose level in the
blood.
Resistor R20 limits current flowing through D9; and their value is got
from
R = 3.7/0.0037
R = 1000 ohms
PROGRAM CODE
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
int SWITCH = 8;
int ALARM = 11;
int LED = 9;
int Optical_detector = A3;
int Optical_signal = 0;
int Glucose_level = 0;
int Reading = 0;
int a = 0;
int X = 0;
int Y = 0;
{
pinMode(ALARM, OUTPUT); // Sets the trigPin as an Output
pinMode(LED, OUTPUT); // Sets the trigPin as an O
lcd.begin();
Serial.begin(9600);
delay(500);
/*
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" OPTICAL BLOOD");
lcd.setCursor(0, 1);
lcd.print("GLUCOSE DETECTOR");
delay(5000);
*/
}
void loop() {
delay(250);
digitalWrite(ALARM, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Initialising... ");
lcd.setCursor(0, 1);
lcd.print(" Please wait ");
delay(5000);
digitalWrite(ALARM, HIGH);
delay(250);
digitalWrite(ALARM, LOW);
digitalWrite(LED, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Reading... ");
lcd.setCursor(0, 1);
lcd.print(" glucose level ");
X = 1;
Y = 1;
}
while (X == 1)
{
Reading++;
digitalWrite(LED, LOW);
digitalWrite(ALARM, HIGH);
delay(250);
digitalWrite(ALARM, LOW);
delay(250);
digitalWrite(ALARM, HIGH);
delay(250);
digitalWrite(ALARM, LOW);
delay(250);
digitalWrite(ALARM, HIGH);
delay(250);
digitalWrite(ALARM, LOW);
Reading = 0; // reset
X = 0; // exit loop
}
delay(500);
}
if ( (Optical_signal > 50 )&& ( Optical_signal < 200 ) )
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Glucose level ");
lcd.setCursor(0, 1);
lcd.print("= ");
lcd.print(Glucose_level);
lcd.print("g/dl");
lcd.print(" LOW");
lcd.print(" NORMAL");
}
lcd.print(" HIGH");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Finger not ");
lcd.setCursor(0, 1);
lcd.print(" detected ");
if ( Optical_signal < 50 )
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Insert finger & ");
lcd.setCursor(0, 1);
lcd.print("press the button");
delay(500);
}