You are on page 1of 18

CIRCUIT DIAGRAM

BLOCK DIAGRAM

BATTERY
POWER
SUPPLY

LED
SWITCH LIGHTING
SIGNAL
LCD DISPLAY
PROCESSING
OPTICAL
DETECTOR ALARM
SOUNDING
BATTERY POWER SUPPLY

This block is made up of components that supply stable electrical


power to other components in the circuit.
It’s made up of a charging module IC6, battery cell B3, switch SW4,
capacitor C14, resistor R16 and LED D10.
The charging module IC6 is used to add more energy to the storage
battery cell B3. It receives 5v from the power adaptor, which it lowers
to 4v for safe battery charging. The stored energy from the battery is
delivered to the circuit when SW4 is closed
C14 filters out any DC voltage variations that are caused when the
circuit is working.
LED D10 lights up to indicate that the circuit is powered. R16 limits
current flowing through the LED to prevent its damage.
The value of R16 is obtained from V

From V = I x R; V = 3.7v and I = 3.7mA

R = 3.7/0.0037
R = 1000 ohms
INPUT BLOCK

This block is made up of components that are used to generate


electrical signals for the microcontroller to interpret. These
components include;

 The blood glucose optical detector Q3

This is used to detect the level of blood sugars using infrared light.

This detector is made up of a sensor Q3 that uses infrared light.

It has got an infrared emitter facing directly to the infrared receiver.

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.

Since the absorption rate of infrared light by the blood is proportional


to its blood sugar level, therefore, the amount of infrared light reaching
the receiver will be directly proportional to the blood sugar level.

Resistors R15 and R20 limit current through the infrared receiver and
emitter respectively and their values are got from;

From V = I x R; V = 3.7v and I = 0.37mA

R15 = 3.7/0.00037
R15= 10000 ohms

From V = I x R; V = 3.7v and I = 37mA

R17 = 3.7/0.037
R17= 100 ohms

 The start switch SW8


This is a button switch that when pressed, sends a signal that causes
the microcontroller to start the process of reading the glucose blood
sugar.
When pressed, switch SW8 and resistor R18 form a potentiodivider
that generates a digital signal that is sent to the microcontroller for
processing.
R18 also limit current through SW8 when pressed, to avoid its
damage due to excess current flowing through it and its value is got
from;

From V = I x R; V = 3.7v and I = 3.7mA

R = 3.7/0.0037
R = 1000 ohms
SIGNAL PROCESSING

This block is used to execute commands and carry out as programmed


to interpret the input signals

It made up of a crystal oscillator X3, capacitors C16, C17; resistor R13


and a microcontroller IC5.

The microcontroller chip (IC5) is programed in C language such that if


the input signal states from the input components reach the
programmed conditions, it switches on the output components
respectively.

The crystal oscillator X3 generates a clock signal for timing processing


speed purposes in the microcontroller program whereas capacitors C16
and C17 filter out any noise induced in this signal before reaching the
microcontroller.

R13 prevents false resetting of the microcontroller process functions.

Below is a flow chart of a program written for a microcontroller to


execute.
OUTPUT BLOCK

These components are responsible for responding to the processed


signals from the microcontroller depending on the signal received from
the input components.

The components in this block are;

i. The liquid display screen LCD


This is used to display mainly the blood sugar level and other
notifications, in form of text for the user to read.
ii. Alarm sounding

This subsection is used to produce audio notifications to call the user’s


attention whenever there is an important message to be read from LCD
screen.

The buzzer BZ3 is switched on to sound an alarm; using a signal from


the microcontroller via current limiting resistor R19 and transistor Q4.

Resistor R19 limits current flowing through Q4 base and its value is got
from

From V = I x R; V = 3.7v and I = 3.7mA

R = 3.7/0.0037
R = 1000 ohms

iii. LED lighting

This lights up whenever the system is scanning for glucose level in the
blood.

The LED D9 is switched on using a signal from the microcontroller.

Resistor R20 limits current flowing through D9; and their value is got
from

From V = I x R; V = 3.7v and I = 3.7mA

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;

void setup() //....set up the mode of the appliance pins used ie


either output or input

{
pinMode(ALARM, OUTPUT); // Sets the trigPin as an Output
pinMode(LED, OUTPUT); // Sets the trigPin as an O

pinMode(SWITCH, INPUT); // Sets the as an Input


pinMode(Optical_detector, INPUT); // Sets the echoPin as an
Input

// digitalWrite ( LED, HIGH);

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() {

/// Serial.println (analogRead (Optical_detector));

if ((digitalRead(SWITCH)) == LOW) // if pressed


{
digitalWrite(ALARM, HIGH);

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++;

Optical_signal = analogRead(Optical_detector); // save


value

if (Reading > 20) //10s


{

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

Glucose_level = map (Optical_signal , 50 , 200,


60, 120 );

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");

if (Glucose_level < 70)


{

lcd.print(" LOW");

else if ((Glucose_level >= 70) &&


(Glucose_level <= 100 ))

lcd.print(" NORMAL");
}

else if (Glucose_level > 100)


{

lcd.print(" HIGH");

if ( Optical_signal > 200 )


{

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);
}

You might also like