Arduino UNO is a popular choice among Arduino boards, based on the Atmel ATmega328P microcontroller, suitable for a variety of learning and prototyping applications. In this article, TechSparks will introduce 6 simple Arduino UNO projects suitable for beginners.
Marquee Lights
The marquee lights project is a straightforward endeavor, achieving a flashing and alternating effect for multiple LED lights in an external circuit by controlling the I/O port of the microcontroller, switching between high and low voltage levels. In this project, we utilize an Arduino UNO to control six LEDs in the external circuit, making them blink at 1-second intervals. Below, you will find the project’s circuit diagram and core code:

int startPin = 2;
int numLeds = 6;
int currentIndex = 0;
void setup() {
// Configure pins as outputs
for (int i = startPin; i < startPin + numLeds; i++) {
pinMode(i, OUTPUT);
}
}
void loop() {
// Turn off all LED lights
for (int i = startPin; i < startPin + numLeds; i++) {
digitalWrite(i, LOW);
}
// Turn on the next LED light
digitalWrite(startPin + currentIndex, HIGH);
// Update the index of the current LED, ensuring it loops between 0 and numLeds
currentIndex = (currentIndex + 1) % numLeds;
// Wait for 1 second
delay(1000);
}
Stepper Motor
A stepper motor is a special type of motor that rotates in discrete steps rather than continuously. It is typically digitally controlled, and it rotates a specific angle or takes a step with each pulse it receives. The displacement is directly proportional to the number of pulses, and the speed is proportional to the pulse frequency.
In this project, a five-wire, four-phase stepper motor is used. It consists of four coils, each referred to as a phase, and the motor’s movement is controlled by sequencing these phases. To control it effectively, an ULN2003 stepper motor driver module is used. The module’s IN1 to IN4 pins are connected to the microcontroller’s I/O ports. This module converts digital signals into pulse signals and uses indicator lights to show the stepper motor’s operating state.



#include
#define MOTOR1 8
#define MOTOR2 9
#define MOTOR3 10
#define MOTOR4 11
#define STEPS_PER_REVOLUTION 64
void stepMotor(int thisStep);
void controlStepper(int motorPins[4], int whatSpeed, int steps);
void setup() {
pinMode(MOTOR1, OUTPUT);
pinMode(MOTOR2, OUTPUT);
pinMode(MOTOR3, OUTPUT);
pinMode(MOTOR4, OUTPUT);
}
void loop() {
int motorPins[4] = {MOTOR1, MOTOR2, MOTOR3, MOTOR4};
controlStepper(motorPins, 800, 20);
}
void controlStepper(int motorPins[4], int whatSpeed, int steps) {
int direction = (steps > 0) ? 1 : 0;
int stepNumber = 0;
int stepsLeft = abs(steps);
unsigned long stepDelay = 60L * 1000L / 64 / whatSpeed;
long lastStepTime = 0;
while (stepsLeft > 0) {
if (millis() - lastStepTime >= stepDelay) {
lastStepTime = millis();
if (direction == 1) {
stepNumber++;
if (stepNumber == STEPS_PER_REVOLUTION) {
stepNumber = 0;
}
} else {
if (stepNumber == 0) {
stepNumber = STEPS_PER_REVOLUTION;
}
stepNumber--;
}
stepsLeft--;
stepMotor(stepNumber % 8, motorPins);
}
}
}
void stepMotor(int thisStep, int motorPins[4]) {
switch (thisStep) {
case 0: // 1000
digitalWrite(motorPins[0], HIGH);
digitalWrite(motorPins[1], LOW);
digitalWrite(motorPins[2], LOW);
digitalWrite(motorPins[3], LOW);
break;
// Add other cases for different step sequences
}
}
Ultrasonic Ranging
Ultrasonic” refers to mechanical waves with a vibration frequency higher than 20kHz. It is characterized by its high frequency, short wavelength, minimal diffraction, good directionality, and the ability to propagate directionally. Ultrasonic technology finds widespread applications in various fields, and the HC-SR04 ultrasonic distance sensor module is one of such applications.
This module comprises a sensor for emitting ultrasonic waves and another sensor for receiving the echoes of those waves. The operational principle involves sending a high-level signal, lasting over 10 microseconds, from a control pin of a microcontroller to the module’s trigger pin. This signal is then transmitted as a series of ultrasonic pulses by the sensor. Subsequently, we wait for a high-level response from the echo pin, indicating that the echo has been received. By measuring the time difference between transmission and reception, we can precisely calculate the distance between the sensor and an object.



const int trigPin = 3;
const int echoPin = 4;
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, 60000); // Duration of the high-level pulse within 60 seconds
float cm = (duration / 2) / 29.1; // Calculate distance based on the speed of sound
Serial.println(cm);
delay(100);
}
LCD1602
LCD1602 is a common character-type liquid crystal display module. “1602” indicates that it can display 16 characters in width and has a height of 2 rows. In this project, we use the UNO development board to control the display of desired characters on the LCD screen. By including the <LiquidCrystal.h> library in Arduino, this functionality can be easily implemented. The hardware circuit connections and core code are as follows:



#include
const int Rs = 3, En = 5, D4 = 10, D5 = 11, D6 = 12, D7 = 13;
LiquidCrystal lcd(Rs, En, D4, D5, D6, D7);
void setup() {
lcd.begin(16, 2);
lcd.print("Hello Arduino UNO!");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);
}
LM35 Temperature Sensor
LM35 is an integrated temperature sensor that outputs the current temperature value in the form of voltage based on the influence of temperature on its internal voltage. It is easy to use and can be directly connected to a microcontroller with just one analog pin to read the sensor’s collected analog value. The actual temperature can then be calculated from this analog value using a specific mathematical formula. The hardware circuit connection diagram and core code are as follows:



void loop() {
// Put your main code here, to run repeatedly:
Serial.println(analogRead(A0) * 0.49); // Assuming A0 is connected to the LM35 temperature sensor
delay(1000);
}
RFID
This project can utilize an RFID card reader module to identify the content of electronic tags. To achieve this, you need to use the MFRC522 library. The core code is as follows:
#include
#include
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
SPI.begin();
mfrc522.PCD_Init();
Serial.println("Scan PICC to see UID and type...");
}
void loop() {
// put your main code here, to run repeatedly:
if (!mfrc522.PICC_IsNewCardPresent()) // If it's not a new card, return
{
return;
}
if (!mfrc522.PICC_ReadCardSerial()) // Failed to select the card
{
return;
}
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}
You Might Be Interested


This article showcases a beginner-friendly project that utilizes Arduino and touch-sensitive technology to control LED lights. The project involves building a simple circuit and programming the Arduino board to detect


Discover the wonders of Arduino, an open-source electronics platform that simplifies electronic design and empowers people to create their own projects. From mesmerizing LED displays to intelligent home automation systems,


This Arduino project demonstrates how to create the internationally recognized Morse code distress signal “S.O.S” using an LED. By controlling the LED’s duration of illumination, it represents the pattern of


In this comprehensive tutorial, we will provide a detailed exploration of various Arduino boards, delve into essential concepts, and highlight their distinctive features. Our aim is to assist you in


This comprehensive guide explores how to use Arduino with LCD displays, covering essential concepts and pin configurations. It includes three practical projects: basic text display, dynamic number updates, and real-time


Learn how to easily download and install the Arduino IDE on Windows, Linux, and macOS! This step-by-step guide will walk you through the entire process, from downloading the software to


This article introduces six beginner-friendly projects for Arduino UNO, a popular microcontroller board. These projects cover a range of applications, from marquee lights and stepper motor control to ultrasonic ranging,


This DIY project introduces an Arduino-based smart tea maker that combines mechanical and electronic control for automated tea brewing. It uses multiple Arduinos, servos, and sensors to handle tasks like