Dissolved oxygen sensor giving questionable readings

Hello! I'm wondering why my dissolved oxygen sensor is giving rather questionable readings. aside from licking the tip of the sensor I did everything correct from calibrating it correctly. also I set an led to whenever the dissolved oxygen levels go low it blinks. nut it does not. is this normal?




const int sensorPin = A0;   // DO sensor analog signal
const int ledPin = 9;       // LED pin
float voltage = 0.0;
float doLevel = 0.0;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // Read raw value from sensor
  int sensorValue = analogRead(sensorPin);  // 0–1023
  voltage = sensorValue * (3.3 / 1023.0);   // Convert to voltage (0–3.3V)
  
  // Convert to DO (mg/L), assuming 0–3.0V = 0–20 mg/L range
  doLevel = (voltage / 5.0) * 20.0;
  
  // Print debug info
  Serial.print("Voltage: ");
  Serial.print(voltage, 2);
  Serial.print(" V | DO: ");
  Serial.print(doLevel, 2);
  Serial.println(" mg/L");
  
  // If DO < 4 mg/L → blink LED
  if (doLevel < 4.0) {
    digitalWrite(ledPin, HIGH);
    delay(300);
    digitalWrite(ledPin, LOW);
    delay(300);
  } else {
    digitalWrite(ledPin, LOW);
  }
  
  delay(200);
}

See post #2 in you other identical topic

Duplicate topic