0% found this document useful (0 votes)
295 views

College Arduino Project

This is a project based on application of Arduino in daily life. There is six beautiful projects with the C++ programming script and the corresponding output in some online softwares like Wokwi, Tinkercad e.t.c to verify is it working properly.

Uploaded by

Anurag Das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
295 views

College Arduino Project

This is a project based on application of Arduino in daily life. There is six beautiful projects with the C++ programming script and the corresponding output in some online softwares like Wokwi, Tinkercad e.t.c to verify is it working properly.

Uploaded by

Anurag Das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

To WHoM IT MAY CoNCERN

This is to certify that Mr. Anurag Das is a 2nd year


bonafide student of the Department of Physics,
Narasinha Dutt College. He has done his SEC-B1
project on ARduINo under the supervision of the
faculty of the Department of Physics, Narasinha
Dutt College, for the partial fulfilment of B.Sc
Honours (Physics).

-------------------------------- -------------------------------
Head of Department Signature of Professor

Department of Physics

Narasinha Dutt College


ACKNoWLEdGEMENT

I would like to express my special thanks of gratitude to respected


Prof. DR. SUPRIYO DAS, whose valuable guidance and support has
been the ones that helped me and gave me the golden opportunity to
complete this project work on Arduino, which was an amazing
experience and I came to know about so many new things.
I would also like to extend my gratitude to our respected HOD
Sir DR. NARAYAN CHANDRA BERA for providing us with all facility
that was required.
I would like to thank my classmates who have helped me with
their suggestions and helped in various phases of the completion of
the project.

Anurag Das

B.Sc Physics IV Semester


CU Roll No: 213432-21-0013
CU Registration No: 432-1111-0314-21
ARduINo PRojECTS
: Table of CoNTeNT :
--------------------------------------------------------------------------------------

INdex page No:


 Introduction 1–4

I. RGB LED Project: 5-6

II. Traffic Light with Predestrian 7-9


Crossing Signal project:

III. Ultrasonic Sensor Project: 10 - 11

IV. LCD Display Project: 12 - 13

V. Temperature & Humidity 14 - 15


Measurement Project:

VI. Interfacing 7-Segment Display 16 - 17


Project
--------------------------------------------------------------------------------------
CU Roll no: 213432-21-0013 Date: 12/07/2023

INTRODUCTION
 Arduino is an open-source electronics platform based on easy-to-use hardware and
software. It consists of a physical programmable circuit board, often referred to as a
microcontroller, and an Integrated Development Environment (IDE) that runs on a
computer.
 The Arduino board is designed to be used by artists, designers, hobbyists, and anyone
interested in creating interactive objects or environments.
 The Arduino board is equipped with input/output pins that can be used to connect to
various sensors, actuators, and other electronic components. These pins can be
programmed using the Arduino programming language, which is based on C/C++.
 The programming language is easy to learn and use, making it accessible to a wide range
of users. Arduino boards come in different sizes and shapes, each with different features
and capabilities. Some of the popular Arduino boards include the Arduino Uno, Arduino
Mega, and Arduino Nano.
Arduino UNO:

UNO is based on ATmega328P microcontroller. There are two variants of the Arduino UNO:
one which consists of through – hole microcontroller connection and other with surface
mount type. The Arduino Uno board is one of the most popular and widely used
microcontroller boards in the Arduino family. It is based on the ATmega328P microcontroller
and has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB
connection, a power jack, an ICSP header (used to program the boot loader), and a reset
button. The Uno board also has a built-in LED, which is connected to digital pin 13.

Here are some key features of the Arduino Uno board:

1. Microcontroller: ATmega328P
2. USB/TTL controller: ATmega16U2
3. Operating Voltage: 5V
4. Input Voltage (recommended): 7-12V
5. Digital I/O Pins: 14 (of which 6 provide PWM [pulse width modulation] output)
6. Analog Input Pins: 6
7. DC Current per I/O Pin: 20 mA
8. DC Current for 3.3V Pin: 50 mA
9. Flash Memory: 32 KB (ATmega328P) of which 0.5 KB used by bootloader
10.SRAM: 2 KB (ATmega328P)

Page 1
CU Roll no: 213432-21-0013 Date: 12/07/2023

11.EEPROM: 1 KB (ATmega328P)

The Arduino Uno board is versatile and can be used for a wide range of applications. It is
commonly used for prototyping, experimentation, and creating interactive electronic projects.
It can be programmed using the Arduino IDE, which provides a simple and easy-to-use
easy
interface for writing, compiling, and uploading code to the board. Overall, the Arduino Uno
board is an excellent choice for beginners and experienced users alike who want a reliable and
flexible microcontroller board for their projects.

Arduino UNO Board Details:

Arduino IDE :
source software, which is used to write and upload code to the Arduino
The Arduino IDE is an open-source
boards. The IDE application is suitable for different operating systems such as Windows, Mac OS X,
and Linux.. It supports the programming languages C and C++.. Here, IDE stands for Integrated
Development Environment.

Page 2
CU Roll no: 213432-21-0013 Date: 12/07/2023

The program or code written in the Arduino IDE is often called as sketching. We need
to connect the Genuino and Arduino board with the IDE to upload the sketch written in
the Arduino IDE software. The sketch is saved with the extension '.ino.'

The Arduino IDE will appear as:

Toolbar Button
The icons displayed on the toolbar are New, Open, Save, Upload, and Verify.

It is shown below:

Page 3
CU Roll no: 213432-21-0013 Date: 12/07/2023

Upload
The Upload button compiles and runs our code written on the screen. It further uploads
the code to the connected board. Before uploading the sketch, we need to make sure
that the correct board and ports are selected.

We also need a USB connection to connect the board and the computer. Once all the
above measures are done, click on the Upload button present on the toolbar.

The latest Arduino boards can be reset automatically before beginning with Upload. In
the older boards, we need to press the Reset button present on it. As soon as the
uploading is done successfully, we can notice the blink of the Tx and Rx LED.

If the uploading is failed, it will display the message in the error window.

We do not require any additional hardware to upload our sketch using the Arduino
Bootloader. A Bootloader is defined as a small program, which is loaded in the
microcontroller present on the board. The LED will blink on PIN 13.

Sketch

When we click on the Sketch button on the Menu bar, a drop-down list appears. It is
shown below:

Verify/Compile

It will check for the errors in the code while compiling. The memory in the console area
is also reported by the IDE.

 We even may use some online platforms like Wokwi Simulator, Tinkercad e.t.c.
We can now start programming with our Arduino board using the Arduino
software and build creative new Arduino projects.

Page 4
CU Roll no: 213432-21-0013 Date: 12/07/2023

RGB LED Random Colour (Common Cathode Mode)


A white light produce by mixing 3 different colors like RGB- Red, Green, and Blue is an RGB LED.
The main purpose of this RGB model is for sensing, representation, and displaying images in the
electronic system.

Parts Required:

1 x Mini Breadboard | Arduino UNO | 4 x 1 Kilo-Ohm Resistor | Jumper Wires | RGB LED.

#Source Code:

// RGB LED Random Colour (Common Cathode Mode)


//Project:1 ; CU Roll No: 213432-21-0013; Date: 26/06/2023

const int PIN_RED = 5;


const int PIN_GREEN = 6;
const int PIN_BLUE = 9;

void setup() {
pinMode(PIN_RED, OUTPUT);
pinMode(PIN_GREEN, OUTPUT);
pinMode(PIN_BLUE, OUTPUT);
}

void loop() {
// color code #00C9CC (R = 0, G = 201, B = 204)
setColor(0, 201, 204);
delay(1000);
// color code #F7788A (R = 247, G = 120, B = 138)
setColor(247, 120, 138);
// color code #00C9CC (R = 0, G = 201, B = 204)
delay(1000);
setColor(255, 255, 0); // Red Colour

delay(1000);
setColor(0, 255, 0); // White Colour
delay(1000);
// color code #34A853 (R = 52, G = 168, B = 83)
setColor(52, 168, 83);
delay(1000); // keep the color 1 second
}

Page 5
CU Roll no: 213432-21-0013 Date: 12/07/2023

void setColor(int R, int G, int B) {


analogWrite(PIN_RED, R);
analogWrite(PIN_GREEN,
(PIN_GREEN, G);
analogWrite(PIN_BLUE, B);
}

terminals, the minimum


# Safety Resistance: Series resistors to the common terminal and each terminal
resistance value should apply is to be calculated as;
as

 5  2.5  Volt
Rs     100
 0.025  Ampere
#Arduino Circuit & Output:
Output

#Common Cathode Mode:

Page 6
CU Roll no: 213432-21-0013 Date: 12/07/2023

Traffic Light with Pedestrian Crossing Signal


Parts Required:

1 x Breadboard | Arduino UNO | 3 x 5mm LED (1x red, 1x yellow, 1x green) | 2 x 3mm LED (1x
red, 1x green) | 6 x 1 Kilo-Ohm Resistor | 1x pushbutton | Jumper Wires.

#Source Code: //Traffic Light with Pedestrian Crossing Signal Button


//Project:2 ; CU Roll No: 213432-21-0013; Date: 26/06/2023
int redCar = 13;
int yellowCar = 12;
int greenCar = 11;
int greenPed = 2;
int redPed = 3;
int button = 7;
int crossTime = 2000;
unsigned long changeTime;

void setup() {
changeTime = millis();
pinMode(redCar, OUTPUT);
pinMode(yellowCar, OUTPUT);
pinMode(greenCar, OUTPUT);
pinMode(redPed, OUTPUT);
pinMode(greenPed, OUTPUT);
pinMode(button, INPUT);
//turn on the green light
digitalWrite(greenCar, HIGH);
digitalWrite(redPed, HIGH);
digitalWrite(redCar, LOW);
digitalWrite(yellowCar, LOW);
digitalWrite(greenPed, LOW);
Serial.begin(9600);
}

void loop() {
int state = digitalRead(button);
Serial.println(state);

if (state == HIGH && (millis() - changeTime) > 5000) {


changeLights();
Page 7
CU Roll no: 213432-21-0013 Date: 12/07/2023

}
}

void changeLights() {
digitalWrite(greenCar, LOW);
digitalWrite(yellowCar, HIGH);
delay(2000);
digitalWrite(yellowCar, LOW);
digitalWrite(redCar, HIGH);
digitalWrite(redPed, LOW);
digitalWrite(greenPed, HIGH);
delay(crossTime);

for (int x=0; x<10; x++) {


digitalWrite(greenPed, LOW);
delay(100);
digitalWrite(greenPed, HIGH);
delay(100);
}
digitalWrite(greenPed, LOW);
digitalWrite(redCar, LOW);
digitalWrite(redPed, HIGH);
digitalWrite(greenCar, HIGH);

changeTime = millis();
}

Features:

 The car light is always green, and so the pedestrian light is always red unless someone
presses the button. When someone presses the button here’s what happens:

 The car light changes to yellow and then to red

 The pedestrian light changes to green

 The lights are in this state for a while (in the code this time is the variable “crossTime”).

 The pedestrian green light flashes and goes to red

 The car light changes from red to green again.

Page 8
CU Roll no: 213432-21-0013 Date: 12/07/2023

#Circuit & Output:

After Pushing Button:

Page 9
CU Roll no: 213432-21-0013 Date: 12/07/2023

Arduino with Ultrasonic (HC – SR04) Sensor


Parts Required: Arduino UNO | Ultrasonic Sensor (HC-SR04) | Breadboard | Jumper wires.

The Ultrasonic sensor uses sound waves to detect the presence and proximity of objects. It sends out
high-frequency sound waves that bounce off objects and then measures the time it takes for the sound
waves to return. It usually sends an ultrasonic pulse out at 40kHz which travels through the air.

#Source Code:
//Arduino with Ultrasonic (HC – SR04) Sensor
//Project:3 ; CU Roll No: 213432-21-0013; Date: 26/06/2023

int trigPin = 11; //Trigger - blue Jumper


int echoPin = 12; //Echo - green Jumper
long duration, cm, inches;

void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
// convert the time into a distance
cm = (duration/2) / 29.1; Ultrasonic Sensor (HC-SR04)
inches = (duration/2) / 74;
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(250);
}
# Arduino Circuit & Output:

Page 10
CU Roll no: 213432-21-0013 Date: 12/07/2023

Page 11
CU Roll no: 213432-21-0013 Date: 12/07/2023

Arduino with 16 x 2 LCD Display


#Source Code: // Arduino with 16 x 2 LCD Display
//Project:4 ; CU Roll No: 213432-21-0013; Date: 26/06/2023

#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(0,0);
String msg = "SEC-B1 P: Arduino";

lcd.print(msg);
delay(500);
for (int pos=0; pos<msg.length();pos++);
{
lcd.scrollDisplayLeft();
delay(500);
}
lcd.clear();
lcd.noBlink();
delay(200);
lcd.blink();
delay(200);
}

#Circuit Components:

Arduino UNO Board.

LCD Screen (16x2 LCD).

Pin headers to solder to the display pins.

10k ohm potentiometer.

220  Resistor (1K  used).

hook-up wires, breadboard.

Page 12
CU Roll no: 213432-21-0013 Date: 12/07/2023

# The LCD (Liquid Crystal Display) is a type of display that uses the liquid crystals for its operation.

#Arduino Circuit & Output:

LCD Blink:

Page 13
CU Roll no: 213432-21-0013 Date: 12/07/2023

Temperature & Humidity Measurement with DHT22 Sensor


Parts Required: Arduino UNO | DHT22 Sensor | Jumper wires.

The DHT22 is a basic, low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor
and a thermistor to measure the surrounding air and spits out a digital signal on the data pin.

#Source Code:

// Temperature & Humidity Measurement with DHT22 Sensor

//Project:5 ; CU Roll No: 213432-21-0013; Date: 26/06/2023

#include "DHT.h"
#define DHTPIN 6
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);


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

void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C "));
Serial.print(f);
Serial.println(F("°F"));
}

Page 14
CU Roll no: 213432-21-0013 Date: 12/07/2023

#Arduino Circuit

# Output Data:

Humidity: 79.00% Temperature: 23.00°C 73.40°F


Humidity: 79.00% Temperature: 23.00°C 73.40°F
Humidity: 88.50% Temperature: 23.00°C 73.40°F
Humidity: 88.50% Temperature: 30.40°C 86.72°F
Humidity: 88.50% Temperature: 37.90°C 100.22°F
Humidity: 88.50% Temperature: 15.60°C 60.08°F
Humidity: 50.50% Temperature: 15.60°C 60.08°F

Page 15
CU Roll no: 213432-21-0013 Date: 12/07/2023

Arduino with 7 Segment Display


A seven-segment LED is a digital display module specialized to display numerical information. Light-
emitting diodes (LEDs) arranged in the shape of numbers offer an easily visible display. They are
sometimes called "seven-segment displays" or "seven-segment indicators."

#Source Code for Segment Display in Common Anode Mode:

//Project:6 |Segment Display ; CU Roll No: 213432-21-0013; Date: 26/06/2023

#include "SevSeg.h"
SevSeg sevseg;

void setup()
{
//Set to 1 for single digit display
byte numDigits = 1;

//defines common pins while using multi-digit display.


byte digitPins[] = {};

//Defines arduino pin connections in order: A, B, C, D, E, F, G, DP


byte segmentPins[] = {3, 2, 8, 7, 6, 4, 5, 9};
bool resistorsOnSegments = true;

sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins,


resistorsOnSegments);
//sevseg.begin(COMMON_CATHODE, numDigits, digitPins, segmentPins,
resistorsOnSegments);
sevseg.setBrightness(90);
}
void loop()
{
//Display numbers one by one with 2 seconds delay
for(int i = 0; i < 10; i++)
{
sevseg.setNumber(i);
sevseg.refreshDisplay();
delay(2000);
}
}

Page 16
CU Roll no: 213432-21-0013 Date: 12/07/2023

Parts Required:

Arduino UNO Board | Current limiting Resistances: 4 x 1 Kilo-Ohm Resistor | Jumper wires &
| Common Anode (CA) 7 Segment Display.

#Arduino Circuit & Output:

7-Segment Display Internal Circuit:

Page 17

You might also like