Ad Code

Responsive Advertisement

Arduino Fundamentals with Mini Projects(Part-2)

Sensor-Based Arduino Projects

Introduction

In PART 1, we learned Arduino fundamentals using basic output and input projects such as LED control, PWM, and timing logic.
Now it’s time to move one step forward.

In PART 2, we will work with real-world sensors. Sensors allow Arduino to sense temperature, light, distance, and environmental conditions, making projects more practical and intelligent.

This part focuses on reading sensor data, processing it, and taking action based on that data.

What You Will Learn in PART 2

  • Analog and digital sensors
  • ADC (Analog to Digital Conversion)
  • Sensor calibration basics
  • Decision-making using sensor data
  • Real-life automation concepts

Required Components

  • Arduino UNO / Nano
  • Breadboard & jumper wires
  • TMP36 or DHT11 temperature sensor
  • LDR (Light Dependent Resistor)
  • Ultrasonic sensor (HC-SR04)
  • Relay module (optional)
  • Resistors (10kΩ, 220Ω)
  • DC fan or LED

Project 5: Temperature Monitoring System (TMP36)

Project Objective

To measure temperature using a sensor and display the value on the Serial Monitor.

Circuit Description

  • TMP36 VCC → 5V
  • TMP36 GND → GND
  • TMP36 OUT → A0
Temperature Monitoring System (TMP36) with Arduino

Arduino Code



int tempPin = A0;

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

void loop() {
  int sensorValue = analogRead(tempPin);
  float voltage = (sensorValue * (5.0 / 1023.0))-0.5;
  float temperature = voltage * 100;

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  delay(1000);
}

Working Principle

  • The TMP36 outputs a voltage of 750 mV at 25°C temperature.
  • Output changes 10 mV per 1°C with a temperature range of -40 to 125°C.
  • Arduino converts analog voltage to digital data
  • Temperature is calculated mathematically

Applications

  • Weather stations
  • Industrial temperature monitoring
  • Home automation systems

Project 6: Automatic Fan Using Temperature Sensor

Project Objective

To automatically turn ON a fan when the temperature exceeds a preset value.

Automatic Fan Using Temperature Sensor by Arduino

Click here for schematic diagram of this project

Circuit Description

  • The TMP36 is connected as in the previous project
  • Relay module input → Digital pin 8
  • Fan connected via relay

Arduino Code

int tempPin = A0;
int fanPin = 13;
void setup() 
	{
  	Serial.begin(9600);
  	pinMode(fanPin, OUTPUT);
	}
void loop()
		{
  		int sensorValue = analogRead(tempPin);
 		float voltage = (sensorValue * (5.0 / 1023.0))-0.5;
  		float temperature = voltage * 100;
  		Serial.print("Temperature: ");
  		Serial.print(temperature);
  		Serial.println(" C");
  	    if (temperature > 30) 
        			{
    			digitalWrite(fanPin, HIGH);
  			} 
    		else 
    			{
    			digitalWrite(fanPin, LOW);
  			}
    	delay(1000);
		}

Applications

  • Automatic cooling systems
  • Server room protection
  • Smart home ventilation

Project 7: Light-Activated Street Light Using LDR

Project Objective

To automatically switch ON a light when it becomes dark.

Circuit Description

  • LDR + 10kΩ resistor → voltage divider
  • Divider output → A1
  • LED/Relay → pin 9
Light-Activated Street Light Using LDR by Arduino

Click here for a schematic diagram of it.

Arduino Code

int ldrPin = A1;
int lightPin = 9;

void setup() {
  pinMode(lightPin, OUTPUT);
}
void loop() {
  int ldrValue = analogRead(ldrPin);

  if (ldrValue < 400) {
    digitalWrite(lightPin, HIGH);
  } else {
    digitalWrite(lightPin, LOW);
  }
}

Working Principle

  • LDR resistance increases in darkness
  • Arduino detects low light level
  • The light turns ON automatically

Real-Life Applications

  • Street lighting
  • Garden lights
  • Energy-saving systems

Project 8: Distance Measurement Using Ultrasonic Sensor

Project Objective

To measure distance using sound waves.

Circuit Description

  • HC-SR04 Trig → Pin 6
  • HC-SR04 Echo → Pin 7
  • VCC → 5V, GND → GNDDistance Measurement Using Ultrasonic Sensor by Arduino

Click here for a schematic diagram of it.

Arduino Code


int trigPin = 6;
int echoPin = 7;

void setup()
    {
     Serial.begin(9600);
     pinMode(trigPin, OUTPUT);
     pinMode(echoPin, INPUT);
    }

void loop() {
      digitalWrite(trigPin, LOW);
      delayMicroseconds(2);
      digitalWrite(trigPin, HIGH);
       delayMicroseconds(10);
      digitalWrite(trigPin, LOW);
       long duration = pulseIn(echoPin, HIGH);
      int distance = duration * 0.034 / 2;
      Serial.print("Distance: ");
      Serial.print(distance);
      Serial.println(" cm");
      delay(500);
        }

Applications

  • Obstacle detection
  • Smart parking systems
  • Robot navigation

Common Errors & Troubleshooting

  • Wrong sensor pin connection
  • No common GND
  • Incorrect threshold values
  • Using noisy power supply

Frequently Asked Questions (FAQ)

Q1: Can I use DHT11 instead of LM35?
👉 Yes, but it uses a digital protocol and requires a library.

Q2: Why does my ultrasonic sensor give unstable readings?
👉 Check wiring, power supply, and object alignment.

Q3: Is Arduino Nano suitable for these projects?
👉 Yes, Nano and UNO are fully compatible.

Conclusion

In PART 2, you learned how to:

  • Read sensor data
  • Make decisions based on real-world conditions
  • Build useful automation projects

These skills are essential for IoT, robotics, and industrial systems.

Next Part

PART 3: Display & User Interface Projects
(LCD, Keypad, Voltmeter, Menu System)

Post a Comment

0 Comments

Ad Code

Responsive Advertisement