Introduction
This experiment demonstrates how to measure the viscosity of oil using a rotational viscometer and an Arduino.
Components Needed
- Rotational Viscometer
- Arduino
- Motor
- Power Supply
Circuit Setup
- Connect the motor to the rotational viscometer.
- Connect the motor's speed control to a PWM-capable pin on the Arduino.
- 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.
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
- If the viscosity reading is inconsistent, check the motor's speed and sensor calibration.
- Ensure that the oil sample is free of impurities that may affect viscosity readings.