I have connected a Mikroe Fiber opt click board to an Arduino Uno for measuring the output voltage while measuring glucose in urine.
The fiber optic cable is coated with gold nanoparticles.
I have followed the following connection, 5 V and GND pins or Arduino to 5 V and GND pins of the Mikroe Fiber opt click board. Then connected the Tx of the Arduino to the Rx of the click board and vice versa.
I am getting the light passing through however, the output voltage is not changing at all. I am sharing the Arduino code and also the output. Please help me figure out where have I gone wrong.
#include <Wire.h>
// Fiber Opt Click I2C address
#define FIBER_OPT_CLICK_ADDRESS 0x28
// Registers
#define CONFIG_REG 0x00
#define STATUS_REG 0x01
#define DATA_MSB_REG 0x02
#define DATA_LSB_REG 0x03
void setup() {
// Start I2C communication
Wire.begin();
Serial.begin(9600);
// Set the maximum light output
setLightOutput(0xFF);
}
void loop() {
// Read the output voltage from the Fiber Opt Click module
float voltage = readOutputVoltage();
// Print the output voltage
Serial.print("Output Voltage: ");
Serial.print(voltage);
Serial.println(" V");
// Wait for 1 second
delay(1000);
}
void setLightOutput(uint8_t lightValue) {
// Set the light output by writing to the configuration register
Wire.beginTransmission(FIBER_OPT_CLICK_ADDRESS);
Wire.write(CONFIG_REG);
Wire.write(lightValue);
Wire.endTransmission();
}
float readOutputVoltage() {
uint8_t msb, lsb;
uint16_t data;
// Read the data from the Fiber Opt Click module
Wire.beginTransmission(FIBER_OPT_CLICK_ADDRESS);
Wire.write(DATA_MSB_REG);
Wire.endTransmission(false);
// Request 2 bytes of data from the Fiber Opt Click module
Wire.requestFrom(FIBER_OPT_CLICK_ADDRESS, 2);
// Read the data bytes
if (Wire.available() == 2) {
msb = Wire.read();
lsb = Wire.read();
}
// Combine the bytes into a 16-bit value
data = (msb << 8) | lsb;
// Calculate the output voltage based on the data value
float voltage = (data * 5.0) / 1023.0;
return voltage;
}
The idea is to study the change in the intensity of light at 650 nm in terms of output voltage. However, I dont see any change in the output voltage with or without the optical fiber placed between the photodiode and the LED