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

Lab 02

Uploaded by

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

Lab 02

Uploaded by

Mujtaba Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Lab 2: Instrumentation and Measurement

Introduction To Arduino
What Is Arduino?
Arduino is an open source programmable circuit board that can be integrated into a
wide variety of makerspace projects both simple and complex. This board contains
a microcontroller which is able to be programmed to sense and control objects in the
physical world. By responding to sensors and inputs, the Arduino is able to interact
with a large array of outputs such as LEDs, motors and displays. Because of it’s
flexibility and low cost, Arduino has become a very popular choice for makers and
makerspaces looking to create interactive hardware projects.
Board Breakdown
Here are the components that make up an Arduino board and what each of their
functions are.

1. Reset Button – This will restart any code that is loaded to the Arduino board
2. AREF – Stands for “Analog Reference” and is used to set an external reference
voltage
3. Ground Pin – There are a few ground pins on the Arduino and they all work the
same
4. Digital Input/Output – Pins 0-13 can be used for digital input or output
5. PWM – The pins marked with the (~) symbol can simulate analog output
6. USB Connection – Used for powering up your Arduino and uploading sketches
7. TX/RX – Transmit and receive data indication LEDs
8. ATmega Microcontroller – This is the brains and is where the programs are
stored
9. Power LED Indicator – This LED lights up anytime the board is plugged in a
power source
10. Voltage Regulator – This controls the amount of voltage going into the Arduino
board
11. DC Power Barrel Jack – This is used for powering your Arduino with a power
supply
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino and they all work the
same
15. Analog Pins – These pins can read the signal from an analog sensor and convert
it to digital
How To Program Arduino
Once the circuit has been created on the breadboard, you’ll need to upload the
program (known as a sketch) to the Arduino. The sketch is a set of instructions that
tells the board what functions it needs to perform. An Arduino board can only hold
and perform one sketch at a time. The software used to create Arduino sketches is
called the IDE which stands for Integrated Development Environment.

Download Software

Download the free software known as the IDE. The Arduino IDE is the interface
where you will write the sketches that tell the board what to do.You can find the latest
version of this software on the Arduino IDE download page.
To install the software, you will need to click on the link that corresponds with your
computer’s operating system

Connect Your Arduino Uno


At this point you are ready to connect your Arduino to your computer. Plug one end
of the USB cable to the Arduino Uno and then the other end of the USB to your
computer’s USB port.Once the board is connected, you will need to go to Tools then
Board then finally select Arduino Uno.
Next, you have to tell the Arduino which port you are using on your computer. To select port, go
to Tools then Port then select the port that says Arduino.
Arduino Task 1: Blink an LED
It’s finally time to do your first Arduino project. In this example, we are going to
make your Arduino board blink an LED.

Connect The Parts


First, connect pin 7 on your Arduino to a spot on your breadboard, then your resistor.
On the other side of the resistor, insert your LED.

NOTE: LEDs are polarised, meaning that they have a certain way they need to be
connected if you are to not blow them. Connect the positive lead of the LED to the
resistor and run a wire from the ground lead to the GND pin on the Arduino. The
result should look like the schematic on this tutorial.
Complete Sketch

Task 2: Alternately blinking LED


We want to let two LEDs blink alternately.

Required equipment: Microcontroller / two LEDs (blue) / two resistors with 100
Ohm / Breadboard / cables
Setup:
Task 3:Adding two Led’s

Task: Now you will add the code for the Blue LED by yourself

int redPin = 12; // Red LED connected to digital pin 12


int greenPin = 11; // Green LED connected to digital pin 11

void setup() // run once, when the sketch starts


{
pinMode(redPin, OUTPUT); // sets the digital pin as output
pinMode(greenPin, OUTPUT); // sets the digital pin as output
}

void loop() // run over and over again


{
digitalWrite(redPin, HIGH); // sets the Red LED on
digitalWrite(greenPin, HIGH); // sets the Green LED on
delay(500); // waits for half a second
digitalWrite(redPin, LOW); // sets the Red LED off
digitalWrite(greenPin, LOW); // sets the Green LED off
delay(500); // waits for half a second
Task:4 Push button and LED with Arduino-Digital Input & Output

Task: After pushing the button an LED is supposed to light up for 5 seconds.

Required equipment:

Arduino / one LED (blue) / one resistor with 100 Ohm / one resistor with 1K Ohm
(1000 Ohm) / Breadboard / Cables / Push button

Schematic:

You might also like