iot project ideas using arduino with source code

30+ Awesome Arduino IoT Project Ideas with Source Code

By Rachel Lee
AD

Exploring Internet of Things (IoT) Projects with Arduino

The Internet of Things (IoT) has evolved to become a robust and accessible field, opening numerous opportunities for hobbyists and professionals alike. One of the most popular and user-friendly platforms for IoT projects is Arduino, an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.

Arduino boards can read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, or publishing something online. Here, we explore captivating IoT project ideas using Arduino, complete with source code snippets to get you started.

Temperature and Humidity Sensor with Arduino and IoT

Let's kick off with a classic IoT project: monitoring temperature and humidity using an Arduino board. We'll use the DHT11 sensor, which provides both temperature and humidity readings.

AD
Explore more than 500 Arduino Projects Ideas | Code and Diagram
Explore more than 500 Arduino Projects Ideas | Code and Diagram
the cover of an electronic book with text that reads 200 + arduino projects how to build your own arduino projects
the cover of an electronic book with text that reads 200 + arduino projects how to build your own arduino projects
Top 30 Arduino Projects for Beginners (Updated)
Top 30 Arduino Projects for Beginners (Updated)

Setting Up the DHT11 Sensor

The DHT11 sensor connects easily to Arduino. Simply connect VCC and GND to the Arduino's 3.3V and GND pins, and connect the data pin to a digital pin on the Arduino board. Here's how to initialize the sensor in your Arduino sketch:

#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

Reading Data and Publishing to IoT Cloud

Once initialized, you can read temperature and humidity data using the `dht.read()` function. To publish this data online, you can integrate services like Thingspeak or Blynk. Here's a code snippet for publishing data to Thingspeak:

List of IoT Projects for Beginners | Easy Ideas with Sensors & Arduino
List of IoT Projects for Beginners | Easy Ideas with Sensors & Arduino
7 Arduino Projects Every Beginner Should Build
7 Arduino Projects Every Beginner Should Build
Forget the Arduino IDE: 5 Awesome Arduino IDE Alternatives - Learn Robotics
Forget the Arduino IDE: 5 Awesome Arduino IDE Alternatives - Learn Robotics

float h = dht.readHumidity();
float t = dht.readTemperature();

WiFiClient client;
const int port = 80;
const char *host = "api.thingspeak.com";
String getStr = "GET /update?api_key=YOUR_API_KEY&field1=";
getStr += String(t);
getStr += "&field2=";
getStr += String(h);
getStr += "\r\n\r\n";

if (client.connect(host, port)) {
  client.print(getStr);
}

Arduino-based Smart Irrigation System

Another compelling IoT project is creating a smart irrigation system that automates watering plants based on soil moisture levels. We'll use a capacitive soil moisture sensor (FC-28), which alerts the Arduino when plants need water.

Connecting the Soil Moisture Sensor

Connect the VCC and GND pins of the FC-28 to the Arduino's 3.3V and GND. The DO pin should connect to a digital pin on your Arduino board. Here's how to read sensor data in your Arduino sketch:

AD
const int sensorPin = 2;
int sensorReading;

void setup() {
  pinMode(sensorPin, INPUT);
}

void loop() {
  sensorReading = digitalRead(sensorPin);
  if (sensorReading == LOW) {
    // Plants need water
  } else {
    // Plants don't need water
  }
}

Automating Water Pump based on Sensor Input

To automate the watering process, connect a water pump to a relay module controlled by the Arduino. When the sensor detects low moisture, the Arduino triggers the relay to activate the water pump. Here's a code snippet for this functionality:

50+ Arduino Projects with Code - 30+ Arduino Projects for Beginners Inside
50+ Arduino Projects with Code - 30+ Arduino Projects for Beginners Inside
Soil Moisture Sensor with Arduino
Soil Moisture Sensor with Arduino
IOT Project Guide
IOT Project Guide
Physical DIY Meets Online Business: A Practical Roadmap for Creators
Physical DIY Meets Online Business: A Practical Roadmap for Creators
How LED Works in IoT
How LED Works in IoT
Arduino IoT Cloud ESP8266 NodeMCU Alexa Home Automation System
Arduino IoT Cloud ESP8266 NodeMCU Alexa Home Automation System
const int pumpPin = 9;
const int sensorPin = 2;
int sensorReading;

void setup() {
  pinMode(pumpPin, OUTPUT);
  pinMode(sensorPin, INPUT);
}

void loop() {
  sensorReading = digitalRead(sensorPin);
  if (sensorReading == LOW) {
    digitalWrite(pumpPin, HIGH); // Turn on water pump
    delay(10000); // Water for 10 seconds
    digitalWrite(pumpPin, LOW); // Turn off water pump
  }
  delay(600000); // Check moisture every 10 minutes
}

Embracing Arduino and IoT for projects enables endless possibilities, from monitoring your home to controlling devices remotely. As you explore these project ideas, remember to keep an eye on your code organization and comment effectively for better maintainability. Happy coding, and here's to a future filled with innovative IoT creations!

Simple IoT Projects for Beginners
Simple IoT Projects for Beginners
Best Arduino Simulators- – Perfect for Testing Your Code!
Best Arduino Simulators- – Perfect for Testing Your Code!
Beginner Guide to 30+ Arduino Projects for Beginners (Free Tutorial)
Beginner Guide to 30+ Arduino Projects for Beginners (Free Tutorial)
Siri + Arduino
Siri + Arduino
Class of 2026 EEE Project - ESP32 LED Blink in Proteus 8 Inside
Class of 2026 EEE Project - ESP32 LED Blink in Proteus 8 Inside
the top 10 best arduino sensor kits for beginners infographical poster
the top 10 best arduino sensor kits for beginners infographical poster
50 Arduino Sensors Every Maker Should Know
50 Arduino Sensors Every Maker Should Know
Cool Arduino Projects: Arduino Dice Simulation - Learn Robotics
Cool Arduino Projects: Arduino Dice Simulation - Learn Robotics
Arduino IoT Projects: Beginner Guide to Smart Automation
Arduino IoT Projects: Beginner Guide to Smart Automation
the book cover for 35 + automated robotics projects you must try
the book cover for 35 + automated robotics projects you must try
Arduino Projects Beginner - Free Circuit & Code Files
Arduino Projects Beginner - Free Circuit & Code Files
100+ DIY Internet of Things Based Projects for Beginners
100+ DIY Internet of Things Based Projects for Beginners
Arduino Traffic Light Project [With Pedestrian Crossing]
Arduino Traffic Light Project [With Pedestrian Crossing]
AD