Oil Viscosity Measurement

Introduction

This experiment demonstrates how to measure the viscosity of oil using a rotational viscometer and an Arduino.

Oil Viscosity Sensor

Components Needed

Circuit Setup

  1. Connect the motor to the rotational viscometer.
  2. Connect the motor's speed control to a PWM-capable pin on the Arduino.
  3. Use a force sensor to measure resistance caused by the viscosity of the oil.

The motor rotates the sensor, and the resistance is measured to determine the oil's viscosity.

Oil Viscosity Circuit Setup

Code for Oil Viscosity Measurement

Upload the following code to your Arduino to measure oil viscosity:


const int motorPin = 9;
const int forceSensorPin = A0;
int sensorValue;

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

void loop() {
  sensorValue = analogRead(forceSensorPin);
  float viscosity = map(sensorValue, 0, 1023, 1, 100);
  Serial.print("Oil Viscosity: ");
  Serial.println(viscosity);
  delay(500);
}
            

Explanation

The rotational force generated by the motor is affected by the viscosity of the oil. The force sensor detects this change, and the Arduino calculates the viscosity based on the sensor's readings.

Troubleshooting