sensor-experiments

Introduction

This experiment shows how to use a liquid level sensor to detect the oil level in a tank using an Arduino.

Components Needed

No Ads Available.

Circuit Setup

  1. Connect the VCC and GND of the oil level sensor to the 5V and GND pins on the Arduino.
  2. Connect the sensor’s output pin to an analog pin on the Arduino (e.g., A0).

The oil level sensor detects the oil level in the tank, sending signals to the Arduino to process the data.

Code for Oil Level Measurement

Upload the following code to your Arduino to detect oil level:


const int sensorPin = A0;
float oilLevel;

void setup() {
  Serial.begin(9600);
}

void loop() {
  oilLevel = analogRead(sensorPin) * (5.0 / 1023.0);
  Serial.print("Oil Level: ");
  Serial.println(oilLevel);
  delay(1000);
}
            

Explanation

The oil level sensor uses resistance to measure the height of the liquid, sending data to the Arduino for analysis.

Troubleshooting

Contact Us

If you have any questions or inquiries, feel free to reach out to us at Microautomation.no@icloud.com .

Follow our Socials for the newest updates!