📡 ESP32 Projects

5 Simple Arduino Projects for Beginners

EmbedLab TeamApril 8, 20254 min read
5 Simple Arduino Projects for Beginners
5 Simple Arduino Projects for Beginners
PIR Motion Schematic

This guide combines five beginner-friendly Arduino projects. Each one includes a description, schematic, and code snippet to help you build and understand core electronics concepts.


1. LED Brightness Control with a Potentiometer

Use a potentiometer to adjust the brightness of an LED using PWM on an Arduino. This is a basic intro to analog input and output.

LED Brightness Schematic

Code:

int led_pin = 6;
int pot_pin = A0;
int output;
int led_value;
void setup() {
  pinMode(led_pin, OUTPUT);
}
void loop() {
  output = analogRead(pot_pin);
  led_value = map(output, 0, 1023, 0, 255);
  analogWrite(led_pin, led_value);
  delay(1);
}

2. Motion Detection with a PIR Sensor

Use a motion sensor to detect movement and trigger an LED. Learn digital input handling and serial output.

PIR Motion Schematic

Code:

int led = 13;
int sensor = 2;
int state = LOW;
int val = 0;
void setup() {
  pinMode(led, OUTPUT);
  pinMode(sensor, INPUT);
  Serial.begin(9600);
}
void loop() {
  val = digitalRead(sensor);
  if (val == HIGH) {
    digitalWrite(led, HIGH);
    delay(500);
    if (state == LOW) {
      Serial.println("Motion detected!");
      state = HIGH;
    }
  } else {
    digitalWrite(led, LOW);
    delay(500);
    if (state == HIGH) {
      Serial.println("Motion stopped!");
      state = LOW;
    }
  }
}

3. Arduino Voltmeter with LCD Display

Read and display voltage using an analog pin and a 1602 LCD with I2C.

Voltmeter Schematic

Code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int Vpin = A3;
float voltage;
float volts;
void setup() {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
}
void loop() {
  voltage = analogRead(Vpin);
  volts = voltage / 1023 * 5.0;
  Serial.println(volts);
  lcd.print("Voltage = ");
  lcd.print(volts);
  delay(500);
  lcd.clear();
}

4. Ultrasonic Distance Sensor with LED Indicator

Measure distance with an ultrasonic sensor and light up an LED if an object is too close.

Ultrasonic Sensor Schematic

Code:

const int trigPin = 9;
const int echoPin = 10;
const int ledPin = 8;
const int movementThreshold = 50;
void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("Starting distance sensor...");
}
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");
  if (distance > 0 && distance <= movementThreshold) {
    Serial.println("Object detected. Turning LED on.");
    digitalWrite(ledPin, HIGH);
  } else {
    Serial.println("No object detected. Turning LED off.");
    digitalWrite(ledPin, LOW);
  }
  delay(200);
}

5. 7-Segment Display Counter with Button

Press a button to cycle through numbers 0–9 on a 7-segment display.

7-Segment Display Schematic

Code:

int segmentPins[] = {2, 3, 4, 5, 6, 7, 8};
int buttonPins = A0;
byte numbers[10] = {
  0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D,
  0x7D, 0x07, 0x7F, 0x6F
};
int counter = 0;
void setup() {
  for (int i = 0; i < 7; i++) {
    pinMode(segmentPins[i], OUTPUT);
  }
  pinMode(buttonPins, INPUT);
}
void loop() {
  if(digitalRead(buttonPins) == HIGH){
    displayNumber(counter);
    counter = (counter + 1) % 10;
    delay(1000);
  }
}
void displayNumber(int num) {
  for (int i = 0; i < 7; i++) {
    digitalWrite(segmentPins[i], numbers[num] & (1 << i));
  }
}

Note: This article includes affiliate links to products compatible with Arduino and Raspberry Pi platforms.

ET

EmbedLab Team

Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.

Related projects

Browse all 50+ projects