0% found this document useful (0 votes)
14 views7 pages

Black

The document outlines two experiments using Arduino: one for measuring the rotation angle of a shaft with a potentiometer and another for detecting LPG gas leaks. The first experiment involves reading analog input, calculating voltage, and displaying results on the Serial Monitor, while the second focuses on monitoring gas concentration and triggering an alarm if levels exceed a threshold. Both experiments demonstrate key concepts in sensor calibration and analog-to-digital conversion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views7 pages

Black

The document outlines two experiments using Arduino: one for measuring the rotation angle of a shaft with a potentiometer and another for detecting LPG gas leaks. The first experiment involves reading analog input, calculating voltage, and displaying results on the Serial Monitor, while the second focuses on monitoring gas concentration and triggering an alarm if levels exceed a threshold. Both experiments demonstrate key concepts in sensor calibration and analog-to-digital conversion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Design a measurement system to measure

rotation angle of the shaft using Arduino


Exp no.: 08
Aim:
To read an analog input from a potentiometer using an Arduino and
display the rotation angle according to the sensor value and corresponding
voltage on the Serial Monitor.

Materials Required:
• Arduino Kit
• Jumper wires
• Potentiometer
• Arduino IDE software

Procedure:
1. Connect the Arduino kit to power source using connecting wires.
2. Connect the Arduino kit to the computer using USB port to upload
Arduino code.
3. Upload the code to the Arduino using the Arduino IDE:
➢ Declaring the Input:
▪ This line defines the analog input pin A3, where the
potentiometer's output is connected.
➢ Setup Function (setup()):
▪ pinMode(pot, INPUT); → Configures A3 as an input pin.
▪ Serial.begin(9600); → Initializes serial communication at a baud
rate of 9600 bps, allowing data transmission to the Serial Monitor.
➢ Loop Function (loop()):
▪ analogRead(pot); reads the analog value from pin A3, which
ranges from 0 to 1023 (since the Arduino ADC is 10-bit).
➢ Voltage Calculation:
▪ This line converts the raw sensor value into a voltage.
▪ The equation seems to be a custom calibration formula.
▪ Likely, sensorValue is being mapped from a specific range (200 to
160) to a voltage range of 270V.
➢ Printing Values to Serial Monitor
▪ Prints the raw sensor value followed by the calculated voltage.
▪ \t (tab) is used for better formatting.

➢ Delay for Stability


▪ Adds a 1-second (1000ms) delay between readings to avoid
excessive data flooding.
Arduino Code:
Result:

Conclusion:
This experiment successfully read the analog output of a potentiometer
using an Arduino and displayed the corresponding rotation angle and
voltage on the Serial Monitor. It demonstrated analog-to-digital conversion
(ADC) and sensor calibration, which are essential for applications like
robotics and motor control.
Design a system to detect gas (LPG gas in home) using Arduino

Exp no.: 07
Aim:
To develop an Arduino system to detect liquified petroleum gas(LPG)
leaks within a home environment, triggering an alarm.

Materials Required:
• Arduino Kit
• Jumper wires
• Gad sensor
• Buzzer
• Arduino IDE software

Procedure:
1. Connect the Arduino kit to power source using connecting wires.
2. Connect the Arduino kit to the computer using USB port to upload
Arduino code.
3. Upload the code to the Arduino using the Arduino IDE:
▪ gasSensorPin (A0) → Analog input pin for the MQ-2 sensor.
▪ buzzerPin (11) → Digital output pin connected to the buzzer.
▪ gasThreshold (400) → The gas concentration level at which the
buzzer should turn on.
▪ Sets the buzzerPin as an output using pinMode().
▪ Initializes serial communication at 9600 baud for debugging and
monitoring the gas value
▪ Reads the gas sensor value from pin A0 using analogRead(). The
value ranges from 0 to 1023 (10-bit ADC).
▪ Prints the raw sensor reading to the Serial Monitor for real-time
monitoring.
▪ If the gas concentration exceeds the gasThreshold, the buzzer
turns ON and a warning message is displayed.
▪ If the gas level is below the threshold, the buzzer stays OFF, and a
normal status message is shown.
▪ The 1-second delay ensures stable readings and prevents
excessive serial output.
Arduino Code:
Result:

Conclusion:
The MQ-2 Gas sensor contains a heating element and a metal oxide
semiconductor (SnO₂). When gas molecules interact with the
semiconductor, the electrical resistance changes, altering the output
voltage. This voltage change is then read by the Arduino to determine the
gas concentration.
Reads gas levels from the sensor.
Compares the sensor value with a predefined threshold.
Activates a buzzer if gas concentration is too high.
Displays real-time gas values and status messages in the Serial Monitor.

You might also like