Top 5 Simple Arduino Projects for Beginners (With Code & Schematics)

5 Simple Arduino Projects for Beginners (With Code & Schematics)

Looking to dive into electronics and programming? Here are five easy and practical Arduino projects that are perfect for beginners. Each project includes a schematic diagram, a detailed description, and example code.

Arduino PIR Motion Sensor Schematic Diagram

Recommended Starter Kits and Accessories

These are some helpful components and kits compatible with Arduino. (Note: These are affiliate links. You won't pay extra, but I may earn a small commission.)


1. LED Brightness Control Using a Potentiometer

This simple Arduino project lets you control LED brightness using a potentiometer and PWM output.

LED Potentiometer PWM Schematic

Arduino 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 Using a PIR Sensor

Detect motion and trigger an LED or buzzer using a PIR sensor. This project introduces digital input and serial debugging.

Arduino Motion Sensor PIR Schematic

Arduino 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. Build an Arduino Voltmeter with LCD Display

This project reads voltage through an analog input and displays the value on an I2C 1602 LCD display.

Arduino Voltmeter LCD Schematic

Arduino 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

Use an ultrasonic sensor (HC-SR04) to detect objects. Turn on an LED if something gets too close.

Ultrasonic Distance Sensor Schematic

Arduino 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. Button-Controlled 7-Segment Display Counter

Display numbers 0 to 9 on a 7-segment display by pressing a button. Great intro to multiplexing and digital output.

7 Segment Display Arduino Schematic

Arduino 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: Some links in this article are affiliate links to products compatible with Arduino or Raspberry Pi platforms.

Post a Comment

0 Comments