Csed Lab Report Final
Csed Lab Report Final
Submitted by:
BE Second Year
Batch:2022-25
Submitted to-
R.S. DHAKA
TIET, Patiala
July-Dec 2022
1
TABLE OF CONTENTS
ABSTRACT i
DECLARATION ii
TABLE OF CONTENTS iii
LIST OF TABLES iv
LIST OF FIGURES v
LIST OF ABBREVIATIONS vi
2
ABSTRACT
The main objective of this report is to cover all the aspects of designing an electric buggy. A new
automated buggy is developed in this design project. The design and development of the buggy
comprised of the use of Arduino Uno to perform various experiments. We used Arduino IDE
software to write different codes related to different experiments. We used breadboard, LEDs,
probe/connecting wires, and Arduino UNO to make the circuits and executed the codes to see the
results. The buggy is capable of determining its own path, sending and receiving signals and
detecting hurdles. This report taught us various aspects of designing and coding a self capable
buggy cart.
3
DECLARATION
We hereby declare that the project work entitled “ENGINEERING DESIGN” submitted to
Thapar Institute of Engineering and Technology, Patiala is a record of group effort done under
the guidance of:
R.S. DHAKA
4
LIST OF EXPERIMENTS
6 6
Write a program to glow LEDs in series (1,2,3,4,5) and reverse
(5,4,3,2,1)
5
Experiment: 1
Theory:
6
1. Power USB: Arduino board can be powered by a USB cable.
2. Power (Barrel) Jack: Arduino can be powered directly from an AC main power supply.
5. Reset: Used to reset Arduino board i.e., starts program from beginning.
10. Analog Pin: Helps in reading signals from analog sensor and converts it into a digital
signal.
11. Main Microcontroller: It is the brain of the Arduino. It has its own microcontroller.
12. ICSP Pin: Tiny programming header for the Arduino. Consists of MOSI, MISO, SCK,
RESET, VCC and GND.
14. Digital I/O: These pins can be configured to work as input or output pins to read logics
(0 &
1).
Discussion:
In this experiment, we have learnt how to use the Arduino IDE and use some default
functions to print something and display it on the serial monitor. We get to learn some inbuilt
features of the Arduino Software.
7
Experiment: 2
1. Resistor 220 Ω
2. Arduino UNO 1
3. LED 1
Theory:
1. Resistor: Resistors are used in virtually all electronic circuits and many electrical ones.
Resistors, as their name indicates resist the flow of electricity and this function is key to
the operation most circuits.
2. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
3. Arduino UNO R3: Arduino Uno is a microcontroller board based on the ATmega328P
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs),
6 analogue inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB
connection, a power jack, an ICSP header and a reset button.
4. Jumper wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
Code:
void setup() {
pinMode(13, OUTPUT);
8
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
void loop() {
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
delay(1000);
Picture of Circuit:
Discussion:
9
In this experiment we have learnt how to blink a LED using an Arduino adding a
resistor along its anode end to protect the LED from getting fused to large amount of
current. We also learnt how to make the correct connections of LED with the resistor.
Experiment: 3
Objective: Write a program to blink 2 LEDs simultaneously.
10
Software Used: Arduino Uno
Theory:
1. Resistor: Resistors are used in virtually all electronic circuits and many electrical ones.
Resistors, as their name indicates resist the flow of electricity and this function is key to
the operation most circuits.
2. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
4. Jump wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
1. Resistor(s) 220 Ω
2. Arduino UNO 1
3. LED(s) 6
Code:
11
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
void loop() {
digitalWrite(11, HIGH); // turn the LED off by making the voltage LOW
delay(1000);
digitalWrite(9, LOW);
digitalWrite(11, LOW);
delay(1000);
Picture of Circuit:
12
Discussion:
In this experiment we have learnt how to make more than one LED blink at the same time with
different patterns of our choice with the help of a few resistors to protect the LEDs from fusing.
We have learnt how to use a variable to set the delay speed in the LED’s so as to not set new
values every case.
13
Experiment: 4
Objective: Write a program to glow 2 LEDs at a time .
Software Used: Arduino Uno
Theory:
1. Resistor: Resistors are used in virtually all electronic circuits and many electrical ones.
Resistors, as their name indicates resist the flow of electricity and this function is key to
the operation most circuits.
2. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
4. Jump wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
1. Resistor(s) 220 Ω
2. Arduino UNO 1
3. LED(s) 1
Code:
void setup() {
// initialize digital pin LED_BUILTIN as an output.
14
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}
Picture of Circuit:
Discussion
In this experiment we have learnt how to make more than one LED blink at the same
time with different patterns of our choice with the help of a few resistors to protect the LEDs
15
from fusing. We have learnt how to use a variable to set the delay speed in the LED’s so as to
not set new values every case.
Experiment: 5
Objective: Write a program to glow odd even LEDs simultaneously.
Software Used: Arduino Uno
16
Theory:
1. Resistor: Resistors are used in virtually all electronic circuits and many electrical ones.
Resistors, as their name indicates resist the flow of electricity and this function is key to
the operation most circuits.
2. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
4. Jump wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
1. Resistor(s) 220 Ω
2. Arduino UNO 1
3. LED(s) 1
Code:
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
}
17
void loop() {
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(11, HIGH); // turn the LED off by making the voltage LOW
delay(1000);
digitalWrite(9, LOW);
digitalWrite(11, LOW);
delay(1000);}
Picture of Circuit:
Discussion:
In this experiment we have learnt how to make more than one LED blink at the same
time with different patterns of our choice with the help of a few resistors to protect the LEDs
18
from fusing. We have learnt how to use a variable to set the delay speed in the LED’s so as to
not set new values every case.
Experiment: 6
19
Theory:
1. Resistor: Resistors are used in virtually all electronic circuits and many electrical ones.
Resistors, as their name indicates resist the flow of electricity and this function is key to
the operation most circuits.
2. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
4. Jump wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
1. Resistor(s) 220 Ω
2. Arduino UNO 1
3. LED(s) 1
Code:
void setup() {
pinMode(i, OUTPUT);
20
}
void loop() {
digitalWrite(i, HIGH);
delay(500);
digitalWrite(i, LOW);
delay(500);
delay(500);
digitalWrite(i, LOW);
delay(500);
Pictures Of Circuit:
21
Discussion
In this experiment we have learnt how to make more than one LED blink at the same time with different
patterns of our choice with the help of a few resistors to protect the LEDs from fusing. We have learnt
how to use a variable to set the delay speed in the LED’s so as to not set new values every case.
22
Experiment: 7
Objective:
(a)WAP to display numbers from 1 to 9 on a 7 segment display.
Theory:
1. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
3. Jumper wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
1. Arduino UNO 1
2. 7 segment display 1
23
Code:
(A)
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
int a=9,b=8,c=5,d=4,e=3,f=10,g=11;
switch(n)
case 0:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, LOW);
break;
24
case 1:
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break; case 2:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
break;
case 3:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
25
break;
case 4:
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
break;
case 5:
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
break;
case 6:
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
26
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
break;
case 7:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 8:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
break;
case 9:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
27
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
break;
Pictures of Circuit:
28
29
(B)
/ the setup function runs once when you press reset or power the board
void setup() {
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
// the loop function runs over and over again forever void loop() {
int a=9,b=8,c=5,d=4,e=3,f=10,g=11;
for(int n=0;n<10;n++){
switch(n)
case 0:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
30
digitalWrite(g, LOW);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 1:
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
31
digitalWrite(g, LOW);
break;
case 2:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, LOW);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 3:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
32
digitalWrite(f, LOW);
digitalWrite(g, HIGH);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 4:
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
33
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 5:
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 6:
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
34
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
break;
case 7:
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
delay(500);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
break;
}}
35
}
Pictures of Circuit :
36
37
Discussion:
In this experiment we have learnt how to display digits in a 7 segment display
Experiment: 8
Objective:
(a)WAP to display in serial port.
38
Software Used: Tinkercad Simulator
Theory:
1. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
3. Jumper wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
Hardware Component Used:
1. Arduino UNO 1
Code:
(A)
39
Pictures of Circuit :
40
41
(B)
Pictures of Circuit :
(C)
42
Pictures of Circuit :
Discussion:
43
In this experiment we have learnt how to display random values, take analog input and use of serial port.
44
Experiment: 9
Objective:
WAP in Arduino to control the brightness of an LED. The intensity of the LED should
be changed based on the values provided by the serial input.
Software Used: Tinkercad Simulator
Theory:
1. LED: The LED is a light source which uses semiconductors and electroluminescence to
create light.
3. Jump wires: The breadboard jump wire/cable helps you to build any circuitry on
breadboard easily. These cables are flexible with both ends of a prototyping board
connector.
1. Arduino UNO 1
2. 7 segment display 1
3. photodiode 1
4. LED 1
CODE:
45
Pictures of Circuit :
46
Discussion:
In tis experiment we made use of photodiode to show the intensity of light on serial port and glow LED
accordingly.
47