2012B5A8662H SanneUjwalSriharsha Measuring Transmittance

download 2012B5A8662H SanneUjwalSriharsha Measuring Transmittance

of 16

description

2012B5A8662H SanneUjwalSriharsha Measuring Transmittance

Transcript of 2012B5A8662H SanneUjwalSriharsha Measuring Transmittance

  • A Project Report

    On

    Measuring Transmittance of Liquid using Arduino

    Sanne Ujwal Sriharsha

    2012B5A8662H

    Under the supervision of

    Mrs .MADHURI BHAYYA Dr. SANKET GOEL

    SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS OF

    INSTRF311: ELECTRONICS INSTRUMENTS AND INSTRUMENTATIONTECHNOLOGY

    INSTRF312: TRANSDUCERS AND MEASUREMENTS TECHNIQUES

    BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE PILANI (RAJASTHAN)HYDERABAD CAMPUS

    (1st semester 2015-16)

    1 | P a g e

  • Birla Institute of Technology and Science-Pilani,

    Hyderabad Campus

    Certificate

    This is to certify that the project report entitled Measuring Transmittance of liquid using Arduino submitted by Mr. Ujwal Sriharsha Sanne (ID No. 2012B5A8662H) in partial fulfillment of the requirements of the course INSTR F311, Electronics Instrumentation and Instrumentation Technology, INSTR F312,Transducers and Measurements, embodies the work done by them under our supervision and guidance.

    Date: 2311-2015 Dr. Sanket Goel,

    Mrs.Madhuri Bhayya

    BITS- Pilani, Hyderabad Campus

    2 | P a g e

  • ACKNOWLEDGEMENTSI would like to to extend my acknowledgment to our supervisors, Mrs.Madhuri Bhayya and Dr.SanketGoel. We would like to thank the Department of Electrical and Electronics Engineering at BITS Pilani, Hyderabad Campus, for providing us with this exciting opportunity to work in the field of instrumentation and transducers. This field has always interested us and to be working with its real-life applications is a unique experience.

    Lastly, we would also like to thank our institute, BITS-Pilani Hyderabad Campus, which continues to help students work in new and exciting areas and helps us gain valuable knowledge and experience.

    3 | P a g e

  • SCOPE OF THE PROJECT

    Spectrophotometry is an important analytical measurement tool used in diagnosis of patients.Due to the use of fragile and complicated optics and electronics, current spectrophometers areexpensive and fragile thereby depriving the ability to perform vital diagnostic tests in someparts of the world.

    The project aims to measure the transmittance of liquids at three of the visible regionwavelength light (RGB) using low cost components.

    4 | P a g e

  • CONTENTS

    Title page

    Certificate

    Acknowledgements

    Scope of the Project

    Introduction

    Circuit and Demonstration

    Results

    Conclusion

    Arduino code

    Bibliography

    5 | P a g e

  • IntroductionSpectrophotometry is a measurement of the transmittance of a material or solution, based on wavelength. According to Beer Lamberts law, the amount of light absorbed by a medium is proportional to the concentration of the absorbing material or solute present.

    In a clinical setting, spectrophotometry can be used to determine the presence of certain compounds in the body by using serum from the patients blood. For example, there are elevated levels of the enzyme creatine kinase (CK) in the blood, following a heart attack. Spectrophotometer can be a valuable tool for comparing a patients CK levels to a normal baseline.

    The transmittance of material is its effectiveness at which the radiant energy is transferred. It is the fraction of incident power that is transmitted through a sample. Internal transmittance refers to energy loss due to absorption and the total transmittance is from absorption, scattering, reflection etc.

    T = I()/I0()

    where T is the transmittance, I0 is the incident intensity atthe sample and I is the transmitted intensity from thesample. It is related to the absorbance by the Beer-Lambert Law

    I = I0exp(-()x)

    where is the linear attenuation coefficient and x is thedistance through which the light travels through.Absorbance is defined as:

    A = log(I0()/I()) = ()xlog(e) = 0.4343()x

    Spectrophotometer measures light intensity as a function of wavelength and measures the absorbance and transmittance.

    In this project, I use a RGB LED as a light source to obtain transmittance at three of the VR wavelengths. The transmitted light is detected using a Si photodiode which is connected to a transimpedance amplifier to produce output voltage which is measured by Arduino microcontroller.

    6 | P a g e

  • Measuring Transmittance Demonstration

    Equipment used:

    Arduino Uno: Arduino board is used to control the measurement process. It is used toswitch on RGB LED sequentially while simultaneously reading the output voltagefrom the amplifier to finally output the transmittance at the serial monitor.

    RGB LED: I used a common cathode RGB LED. Photodiode: When a photodiode is connected in the photoconductive mode, the

    photocurrent produced is proportional to the luminosity of the light falling on it. TheSi photodiode has a large bandwidth of light, covering the visible region that can bemeasured. However the response differs with wavelength. It was observed that out ofRGB wavelengths the peak response was for green wavelength followed by red andblue respectively.

    LM358: This is a low power dual-opamp with a single power source. Variable resistor: To manipulate the gain of the amplifier for suitable readings. Push button: It is used to initialize the measurement. Jumper Cables

    7 | P a g e

  • Operation:The input to the RGB LED is controlled using Arduino microcontroller. On pressing the switch the RGB LED flashes in Red, Green, Blue consecutively to measure the transmittance at each wavelength.

    The Silicon photodiode is used to detect the light and it is connected to transimpedance amplifier to convert the photocurrent to voltage which is then measured by Arduino ADC unitwhich maps the voltage to 0-1023 digital values.

    Incident Luminosity L isdirectly proportional to the reverse photocurrent of the photodiode Ip.

    The gain of the transimpedance amplifier is proportional to Ip and RF.

    Gain = -Ip*RF

    The variable resistor is used to adjust the RF such that the microcontroller can read the values.In this instance the resistor was manipulated such that the digital reading of the green voltage is near the maximum.

    First step is to make a calibration reading with clear water and the digital readings of the RGB voltages are used to find the transmittance. After calibration, the sample to be measuredis put in and the switch is pressed. The output, transmittance at RGB is shown on the serial monitor.

    8 | P a g e

  • Circuit Schematic

    9 | P a g e

  • Results:The transmittance values for two liquids were measured. The values are compared with the measured values of a UV-Vis Spectrophotometer.

    Sample 1 (Orange Soln):

    Red Transmittance = 0.80

    Green Transmittance = 0.20

    Blue Transmittance = 0.06

    Sample 2 (Blue-Green Soln):

    Red Transmittance = 0.95

    Green Transmittance = 0.10

    Blue Transmittance = 0.57

    The values obtained from the UV-Vis Spectrophotometer are (taken at three different wavelengths: Red-620nm, Green-520nm, Blue-465nm)

    Sample 1 (Orange Soln):

    620nm Transmittance = 0.8241

    520nm Transmittance = 0.7560

    465nm Transmittance = 0.1053

    Sample 2 (Blue-Green Soln):

    620nm Transmittance = 0.9039

    520nm Transmittance = 0.5764

    465nm Transmittance = 0.8736

    10 | P a g e

  • Conclusion:I have successfully made a spectrophotometer and interfaced it with Arduino microcontroller but calibration is still a problem which leads to error in values. In future, a separate calibration circuit could be added to automate the calibration process.

    Bibilography:1. Built-In Examples ; https://www.arduino.cc/en/Tutorial/BuiltInExamples

    11 | P a g e

  • Arduino Code:int redPin = 11;

    int greenPin = 10;

    int bluePin = 9;

    int buttonPin = 2;

    int sensorPin = A0;

    int redCalib = 644;

    int greenCalib = 1005;

    int blueCalib = 117;

    int sensorVal = 0;

    float value = 0.0;

    int buttonState; // the current reading from the input pin

    int lastButtonState = LOW; // the previous reading from the input pin

    // the following variables are long's because the time, measured in miliseconds,

    // will quickly become a bigger number than can be stored in an int.

    long lastDebounceTime = 0; // the last time the output pin was toggled

    long debounceDelay = 50;

    void setup()

    {

    Serial.begin(9600);

    pinMode(buttonPin, INPUT);

    pinMode(redPin, OUTPUT);

    12 | P a g e

  • pinMode(greenPin, OUTPUT);

    pinMode(bluePin, OUTPUT);

    }

    void loop()

    {

    // read the state of the switch into a local variable:

    int reading = digitalRead(buttonPin);

    // check to see if you just pressed the button

    // (i.e. the input went from LOW to HIGH), and you've waited

    // long enough since the last press to ignore any noise:

    // If the switch changed, due to noise or pressing:

    if (reading != lastButtonState) {

    // reset the debouncing timer

    lastDebounceTime = millis();

    }

    if ((millis() - lastDebounceTime) > debounceDelay) {

    // whatever the reading is at, it's been there for longer

    // than the debounce delay, so take it as the actual current state:

    // if the button state has changed:

    if (reading != buttonState) {

    buttonState = reading;

    13 | P a g e

  • // only toggle the LED if the new button state is HIGH

    if (buttonState == HIGH) {

    getReading();

    }

    }

    }

    // save the reading. Next time through the loop,

    // it'll be the lastButtonState:

    lastButtonState = reading;

    }

    int getAvgVal(){

    int n = 20;

    int sum = 0;

    for(int i=0; i

  • value = (float)sensorVal/(float)redCalib;

    Serial.println(value);

    Serial.println(sensorVal);

    delay(3000);

    //green

    setColor(0, 255, 0);

    sensorVal = getAvgVal();

    Serial.print("GREEN Transmittance = ");

    value = (float)sensorVal/(float)greenCalib;

    Serial.println(value);

    Serial.println(sensorVal);

    delay(3000);

    //blue

    setColor(0, 0, 255);

    sensorVal = getAvgVal();

    Serial.print("BLUE Transmittance = ");

    value = (float)sensorVal/(float)blueCalib;

    Serial.println(value);

    Serial.println(sensorVal);

    delay(3000);

    //dark

    setColor(0, 0, 0);

    sensorVal = getAvgVal();

    //voltage = sensorVal * (5.0/1023.0);

    15 | P a g e

  • Serial.print("dark voltage = ");

    //Serial.println(voltage);

    Serial.println(sensorVal);

    delay(5000);

    }

    void setColor(int red, int green, int blue)

    {

    analogWrite(redPin, red);

    analogWrite(greenPin, green);

    analogWrite(bluePin, blue);

    }

    16 | P a g e