0% found this document useful (0 votes)
101 views23 pages

Lab Report No.07

Uploaded by

Muhammad Rizwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views23 pages

Lab Report No.07

Uploaded by

Muhammad Rizwan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

School Of Mechanical & Manufacturing Engineering, NUST

ME-327 Instrumentation & Measurement Lab (Spring 2023)

Experiment 7: Introduction to Arduino and IDE

Objectives:

To get the basic knowledge of Arduino board, types of Arduino and its software named Arduino IDE.

Arduino Board:

Page 1 of 23
Power USB
Arduino board can be powered by using the USB cable from your computer.
All you need to do is connect the USB cable to the USB connection (1).

Power (Barrel Jack)


Arduino boards can be powered directly from the AC mains power supply by
connecting it to the Barrel Jack (2).

Voltage Regulator
The function of the voltage regulator is to control the voltage given to the
Arduino board and stabilize the DC voltages used by the processor and other
elements.

Crystal Oscillator
The crystal oscillator helps Arduino in dealing with time issues. Arduino
calculates the time by using the crystal oscillator. The number printed on top of
the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000
Hertz or 16 MHz.

Arduino Reset
You can reset your Arduino board, i.e., start your program from the beginning.
You can reset the UNO board in two ways. First, by using the reset button (17)
on the board. Second, you can connect an external reset button to the Arduino
pin labelled RESET (5).

Pins (3.3, 5, GND, Vin)


3.3V (6) − Supplies 3.3 output volts.
5V (7) − Supplies 5 output volts.
Most of the components used with Arduino board work fine with 3.3 volts and
5 volts.
GND (8)(Ground) − There are several GND pins on the Arduino, any of which
can be used to ground your circuit.
Vin (9) − This pin also can be used to power the Arduino board from an external
power source, like AC mains power supply.

Page 2 of 23
Analog pins
The Arduino UNO board has six analog input pins A0 through A5. These pins
can read the signal from an analog sensor like the humidity sensor or
temperature sensor and convert it into a digital value that can be read by the
microprocessor.

Main microcontroller
Each Arduino board has its own microcontroller (11). You can assume it as the
brain of your board. The main IC (integrated circuit) on the Arduino is slightly
different from board to board. The microcontrollers are usually of the ATMEL
Company. This information is necessary about what IC your board has before
loading up a new program from the Arduino IDE. This information is available
on the top of the IC. The more details about the IC construction and functions,
the data sheet can be used.

ICSP pin
Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino
consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred
to as an SPI (Serial Peripheral Interface), which could be considered as an
"expansion" of the output.

Power LED indicator


This LED lights up when we plug our Arduino into a power source to indicate
that our board is powered up correctly. If this light does not turn on, then there
is something wrong with the connection.

TX and RX LEDs
On the board, there are two labels: TX (transmit) and RX (receive). They
appear in two places on the Arduino UNO board. First, at the digital pins 0 and
1, to indicate the pins responsible for serial communication. Second, the TX
and RX led (13). The TX led flashes with different speed while sending the
serial data. The speed of flashing depends on the baud rate used by the board.
RX flashes during the receiving process.

Digital I/O
The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide PWM
(Pulse Width Modulation) output. These pins can be configured to work as
input digital pins to read logic values (0 or 1) or as digital output pins to drive

Page 3 of 23
different modules like LEDs, relays, etc. The pins labeled “~” can be used to
generate PWM.

AREF
AREF stands for Analog Reference. It is sometimes, used to set an external
reference voltage (between 0 and 5 Volts) as the upper limit for the analog
input pins.

Types of Arduino Boards:

Features of Different Types of Arduino Boards:

The features of different types of Arduino boards are listed in the tabular form.
Arduino Board Processor Memory Digital I/O Analogue I/O

Arduino Uno 16Mhz ATmega328 2KB SRAM, 32KB flash 14 6 inputs, 0 output

Arduino Due 84MHz AT91SAM3X8E 96KB SRAM, 512KB flash 54 12 inputs, 2 output

Arduino Mega 16MHz ATmega2560 8KB SRAM, 256KB flash 54 16 inputs, 0 output

12 inputs, 0
Arduino Leonardo 16MHz ATmega32u4 2.5KB SRAM, 32KB flash 20 output

Different Types of Arduino Boards:


The list of Arduino boards includes the following such as
 Arduino Uno (R3)
 Arduino Nano
 Arduino Micro
 Arduino Due
 LilyPad Arduino Board
 Arduino Bluetooth
 Arduino Diecimila
 RedBoard Arduino Board
 Arduino Mega (R3) Board
 Arduino Leonardo Board
 Arduino Robot
 Arduino Esplora
 Arduino Pro Mic
 Arduino Ethernet
 Arduino Zero
 Fastest Arduino Board

Page 4 of 23
Arduino Uno (R3):

The Uno is a huge option for your initial Arduino. This Arduino board depends on an ATmega328P
based microcontroller. As compared with other types of Arduino boards, it is very simple to use like
the Arduino Mega type board. .It consists of 14-digital I/O pins, where 6-pins can be used as
PWM(pulse width modulation outputs), 6-analog inputs, a reset button, a power jack, a USB
connection, an In-Circuit Serial Programming header (ICSP), etc. It includes everything required to
hold up the microcontroller; simply attach it to a PC with the help of a USB cable and give the supply
to get started with an AC-to-DC adapter or battery.

Figure: Arduino Uno (R3)


Arduino Uno is the most frequently used board, and it is the standard form apart from all the existing
Arduino Boards. This board is very useful for beginners.
Arduino Nano:
This is a small board based on microcontrollers like ATmega328P otherwise ATmega628 but the
connection of this board is the same as to the Arduino UNO board. This kind of microcontroller board
is very small in size, sustainable, flexible, and reliable.

Figure: Arduino Nano


As compared with the Arduino Uno board, it is small in size. Devices like mini-USB and Arduino IDE
are necessary to build the projects. This board mainly includes analog pins-8, digital pins-14 with the
set of an I/O pin, power pins-6 & RST (reset) pins-2.

Page 5 of 23
Arduino Micro:
The Arduino Micro board mainly depends on the ATmega32U4 based Microcontroller that includes
20-sets of pins where the 7-pins are PWM pins, 12-analog input pins. This board includes different
components like an ICSP header, RST button, small USB connection, crystal oscillator-16MHz. The
USB connection is inbuilt, and this board is the shrunk version of the Leonardo board.

Figure: Arduino Micro


Arduino Due:
This Arduino board depends on the ARM Cortex-M3 and it is the first Arduino microcontroller board.
This board includes digital I/O pins-54 where 12-pins are PWM o/p pins, analog pins -12, UARTs-4, a
CLK with 84 MHz, an USB OTG, DAC-2, a power jack, TWI-2, a JTAG header, an SPI header, two
buttons for reset & erase.

Figure: Arduino Due


This board works with 3.3V where the highest voltage that the pins of input/output can stand is 3.3V
because providing a high voltage to any I/O pin can lead to damage the board This board is simply
connected to a computer through a small USB cable otherwise it can be powered through an AC to DC
adapter. This Arduino Due board is suitable with all shields of Arduino at 3.3V.
LilyPad Arduino Board:
The Lily Pad Arduino board is a wearable e-textile technology expanded by Leah “ Buechley” and
considerately designed by “Leah and SparkFun”. Each board was imaginatively designed with huge
connecting pads & a smooth back to let them to be sewn into clothing using conductive thread. This
Arduino also comprises of I/O, power, and also sensor boards which are built especially for e-textiles.
These are even washable!

Page 6 of 23
Figure: LilyPad Arduino Boards
Arduino Bluetooth:
This Bluetooth mainly depends on the microcontroller like ATmega168 and this board is also called
Arduino BT. This kind of board includes different components like digital pins-16, analog pins-6,
crystal oscillator-16MHz, reset button, screw terminals, ICSP header. In this board, the screw terminals
are mainly used for power. The programming of this Bluetooth microcontroller can be done with
Bluetooth like a wireless connection.
Arduino Diecimila:
The microcontroller board like Arduino Diecimila mainly depends on the ATmega168. This board
includes digital I/O pins -14 where 6-pins can be used like PWM outputs & analog inputs-6, a USB
connection, a crystal oscillator-16 MHz, an ICSP header, a reset button & a power jack. This board can
be connected to a computer through a USB cable, and it can be activated using a battery and an AC-
DC adapter.

Figure: Arduino Diecimila


As the name suggests, the meaning of Diecimila in Italian is 10,000 which means that marks the truth
that above 10k Arduino boards have been designed. In a set of USB Arduino boards, it is the latest one
as compared with other versions.
RedBoard Arduino Board:
The RedBoard Arduino board can be programmed using a Mini-B USB cable using the Arduino IDE.
It will work on Windows 8 without having to modify your security settings. It is more constant due to

Page 7 of 23
the USB or FTDI chip we used and also it is entirely flat on the back. Creating it is very simple to
utilize in the project design. Just plug into the board, select the menu option to choose an Arduino
UNO and the program can be uploaded.We can control the RedBoard over a USB cable using the
barrel jack.

Figure: RedBoard Arduino Boards


Arduino Mega (R3) Board:
The Arduino Mega is similar to the UNO’s big brother. It includes lots of digital I/O pins (from that,
14-pins can be used as PWM o/ps), 6-analog inputs, a reset button, a power jack, a USB connection,
and a reset button. It includes everything required to hold up the microcontroller; simply attach it to a
PC with the help of a USB cable and give the supply to get started with an AC-to-DC adapter or
battery. The huge number of pins make this Arduino board very helpful for designing projects that
need a bunch of digital i/ps or o/ps like lots of buttons.

Figure: Arduino Mega (R3) Board


Arduino Leonardo Board:
The first development board of an Arduino is the Leonardo board. This board uses one microcontroller
along with the USB. That means, it can be very simple and cheap also. Because this board handles
USB directly, program libraries are obtainable which lets the Arduino board to follow a keyboard of
the computer, mouse, etc.

Page 8 of 23
Figure: Arduino Leonardo Board
Arduino Robot:
This kind of board is the first Arduino over wheels. This Arduino robot includes two processors on
each of its boards. The two boards are the motor board and control board where the motor board
controls the motors & the control board is used to read the sensors for operating. Every board is a
complete Arduino board, and its programming can be done through the Arduino IDE. These are
microcontroller boards that depend on the ATmega32u4.
The pins of this Robot are mapped to actuators and sensors onboard. The process of programming the
robot is the same as the Arduino Leonardo board. It is also named a small computer and it is
extensively used in robotics. This board includes the speaker, color screen, buttons-5, motors-2, a
digital compass, an SD card reader, potentiometers-2 & floor sensors-5. The library of this robot can
be used for controlling the sensors as well as the actuators.
Arduino Esplora:
The Arduino Esplora includes a small computer known as a microcontroller including a number of
inputs & outputs. The inputs of this board are a light sensor, four buttons, a microphone, an
accelerometer, joystick, a slider, a temperature sensor, etc. whereas the outputs are a 3 colors LED, a
buzzer. This kind of Arduino board looks like a videogame controller.

Figure: Arduino Esplora


The programming of this board can be done using Arduino Software like IDE which takes the data
from the inputs and controls the output like a keyboard or a mouse. Compared with all other types of
Arduino boards, this esplora is totally different because the inputs, as well as outputs, are connected to
the board already. So connecting components like actuators or sensors is very simple. Thus,
programming is somewhat different as compared with other types of Arduino boards. This esplora

Page 9 of 23
board includes its own library so that the data from the sensors & actuators are very easy to read and
write.
Arduino Pro Mic:
The Arduino Pro Micro board is the same as the Arduino Mini board apart from the ATmega32U4
Microcontroller. This pro mic board includes digital I/O pins-12, pulse width modulation (PWM) pins-
5, serial connections of Tx & Rx &10-bit ADC.
Arduino Ethernet:
The Arduino Ethernet board depends on the microcontroller like ATmega328. This kind of
microcontroller board includes analog pins-5, digital I/O pins-14, RST button, an RJ45 connection,
crystal oscillator, a power jack, ICSP header, etc. The connection of the Arduino board can be done
through the Ethernet shield to the internet.
Arduino Zero:
This is a powerful as well as simple 32-bit board and it provides the best platform for innovative
projects like wearable technology, smart IoT devices, crazy robotics, high-tech automation, etc. This
board expands by providing improved performance, permitting a range of project opportunities &
performs like a great educational tool.

Figure: Arduino Zero


This board includes analog input pins-6, digital I/O pins-14, a power jack, AREF button, UART port
pins, a USB connector & an In-Circuit Serial Programming (ICSP) header, a power header, etc.
This board is power-driven through the SAMD21 microcontroller based on Atmel. The main feature of
this is EDBG (Embedded Debugger) based on Atmel, and it provides a complete debug interface
without using extra hardware.
Fastest Arduino Board:
Designing one of the best Arduino development boards that are familiar with Arduino MEGA & UNO
is the hifive1 board that includes a 320 MHz RISC-V microcontroller unit. This kind of fastest board
has Cortex M-7 with a 400 MHz microcontroller unit.
Flash memory – up to 2Mbytes

Page 10 of 23
RAM – 1 Mbyte
DMA controllers -4
Communication peripherals- Up to 35
16-bit Max Resolution with 3× ADCs
D/A converters with 2× 12-bit
Hardware with JPEG Codec
Timers -22 & Watchdogs – 200Mhz
HW Calendar & RTC with Sub-second Accuracy
Cryptographic Acceleration
Hifive1 Board Features:
The features of the Hifive1 board include the following.
Mega Form Factor or Arduino Uno
Charger for Battery
SD Card including Detection of Card Feature
Ethernet*
Optional QSPI Flash – 133Mhz
Interfaces – CAN, SWD, Camera
USB- OTG
The Arduino Shields:
Additionally, Arduino shields are pre-built circuit boards used to connect to a number of Arduino
boards. These shields fit on the top of the Arduino compatible boards to provide additional capabilities
like connecting to the internet, motor controlling, providing wireless communication, LCD screen
controlling, etc. The different types of Arduino shields are

Figure: Shields for Arduino Boards


 Wireless Shields
 The GSM Shield
 The Ethernet Shield
 The Proto Shields
 Arduino Boards Comparison

Page 11 of 23
The comparison between different Arduino boards includes the following:
Arduino Board Voltage of System CLK Speed Digital I/O Analog Inputs PWM UART Interface of Programming

Arduino Uno – R3 5V 16MHz 14 14 6 1 USB through ATMega16U2

Arduino Uno R3 SMD 5V 16MHz 14 14 6 1 USB through ATMega16U2

RedBoard 5V 16MHz 14 14 6 1 USB through FTDI

Arduino Pro
3.3V/8MHz 3.3V 8MHz 14 14 6 1 FTDI-Compatible Header

Arduino Pro
5V/16MHz 5V 16MHz 14 14 6 1 FTDI-Compatible Header

Arduino Mini 05 5V 16MHz 14 14 8 1 FTDI-Compatible Header

Arduino Pro Mini


3.3V/8MHz 3.3V 8MHz 14 14 6 1 FTDI-Compatible Header

Arduino Pro Mini


5V/16MHz 5V 16MHz 14 8 6 1 FTDI-Compatible Header

Arduino Ethernet 5V 16MHz 14 6 6 1 FTDI-Compatible Header

FTDI-Compatible Header or
Arduino Fio 3.3V 8MHz 14 8 6 1 Wirelessly via XBee†

LilyPad Arduino 328


Main Board 3.3V 8MHz 14 6 6 1 FTDI-Compatible Header

LilyPad Arduino
Simple Board 3.3V 8MHz 9 4 5 0 FTDI-Compatible Header

Arduino IDE:
The Arduino IDE is an open-source software, which is used to write and upload code to the Arduino
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.
The program or code written in the Arduino IDE is often called 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:

Page 12 of 23
Toolbar Button:
The icons displayed on the toolbar are New, Open, Save, Upload, and Verify.
It is shown below:

Page 13 of 23
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 fails, 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.
Open:
The Open button is used to open the already created file. The selected file will be opened in the current
window.
Save:
The save button is used to save the current sketch or code.
New:
It is used to create a new sketch or open a new window.
Verify:
The Verify button is used to check the compilation error of the sketch or the written code.
Serial Monitor:
The serial monitor button is present on the right corner of the toolbar. It opens the serial monitor.
It is shown below:

When we connect the serial monitor, the board will reset on the operating system Windows, Linux, and
Mac OS X. If we want to process the control characters in our sketch, we need to use an external terminal
program. The terminal program should be connected to the COM port, which will be assigned when we
connect the board to the computer.

Menu Bar:
 File
When we click on the File button on the Menu bar, a drop-down list will appear. It is shown below:

Page 14 of 23
Let's discuss each option in detail.
New
The New button opens the new window. It does not remove the sketch which is already present.
Open
It allows opening the sketch, which can be browsed from the folders and computer drivers.
Open Recent
The Open Recent button contains the list of the recent sketches.
Sketchbook
It stores the current sketches created in the Arduino IDE software. It opens the selected sketch or code in a
new editor at an instance.
Examples
It shows the different examples of small projects for a better understanding of the IDE and the board. The
IDE provides examples of self-practice.
Close
The Close button closes the window from which the button is clicked.
Save
The save button is used to save the current sketch. It also saves the changes made to the current sketch. If
we have not specified the name of the file, it will open ‘Save As...' window.

Page 15 of 23
Save As...
We can save the sketch with a different name using the 'Save As...' button. We can also change the name
accordingly.
Page Setup
It allows setting the page margins, orientation, and size for printing. The 'Page Setup' window will appear
as:

Print
According to the settings specified in the 'Page Setup', it prepares the current sketch for printing.
Preferences
It allows the customization settings of the Arduino IDE.
Quit
The Quit button is used to close all the IDE windows. The same closed sketch will be reopened when we
open the Arduino IDE.
Edit
When we click on the Edit button on the Menu bar, a drop-down list appears. It is shown below:

Page 16 of 23
Let's discuss each option in detail.
Undo
The Undo button is used to reverse the last modification done to the sketch while editing.
Redo
The Redo button is used to repeat the last modification done to the sketch while editing.
Cut
It allows us to remove the selected text from the written code. The text is further placed to the clipboard.
We can also paste that text anywhere in our sketch.
Copy
It creates a duplicate copy of the selected text. The text is further placed on the clipboard.
Copy for Forum
The 'Copy for Forum' button is used to copy the selected text to the clipboard, which is also suitable for
posting to the forum.

Page 17 of 23
Copy as HTML
The 'Copy for Forum' button is used to copy the selected text as HTML to the clipboard. It is desirable for
embedding in web pages.
Paste
The Paste button is used to paste the selected text of the clipboard to the specified position of the cursor.
Select All
It selects all the text of the sketch.
Go to line...
It moves the cursor to the specified line number.
The window will appear as:

Comment/Decomment
The Comment/ Decomment button is used to put or remove the comment mark (//) at the beginning of the
specified line.
Increase Indent
It is used to add the space at the starting of the specified line. The spacing moves the text towards the right.
Decrease Indent
It is used to subtract or remove the space at the starting of the specified line. The spacing moves the text
towards the left.
Increase Font Size
It increases the font size of the written text.
Decrease Font Size
It decreases the font size of the written text.
Find...
It is used to find the specified text. We can also replace the text. It highlights the text in the sketch.
The window will appear as:

Page 18 of 23
Find Next
It highlights the next word, which has specified in the 'Find...' window. If there is no such word, it will not
show any highlighted text.
Find Previous
It highlights the previous work, which has specified in the 'Find...' window. If there is no such word, it will
not show any highlighted text.
Sketch
When we click on the Sketch button on the Menu bar, a drop-down list appears. It is shown below:

Let's discuss each option in detail.


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.
Upload
The Upload button is used to configure the code to the specified board through the port.

Upload Using Programmer

Page 19 of 23
It is used to override the Bootloader that is present on the board. We can utilize the full capacity of the
Flash memory using the 'Upload Using Programmer' option. To implement this, we need to restore the
Bootloader using the Tools-> Burn Bootloader option to upload it to the USB serial port.
Export compiled Binary
It allows saving a .hex file and can be kept archived. Using other tools, the .hex file can also be sent to the
board.
Show Sketch Folder
It opens the folder of the current code written or sketch.
Include Library
Include Library includes various Arduino libraries. The libraries are inserted into our code at the beginning
of the code starting with the #. We can also import the libraries from the .zip file.
Add File...
The Add File... button is used to add the created file in a new tab on the existing file.
For example, let's add the ‘Blink' file to the 'Javatpoint' file. The tab will now appear as:

We can also delete the corresponding file from the tab by clicking on the small triangle -> Delete option.
Tools
When we click on the Tools button on the Menu bar, a drop-down list appears. It is shown below:

Page 20 of 23
Let's discuss each option in detail.
Auto Format
The Auto Format button is used to format the written code. For example, lining the open and closed curly
brackets in the code.
Archive Sketch
The copy of the current sketch or code is archived in the .zip format. The directory of the archived is same
as the sketch.
Fix Encoding and Reload
This button is used to fix the inconsistency between the operating system char maps and editor char map
encoding.
Manage Libraries...
It shows the updated list of all the installed libraries. We can also use this option to install a new library into
the Arduino IDE.
Serial Monitor
It allows the exchange of data with the connected board on the port.
Serial Plotter
The Serial Plotter button is used to display the serial data in a plot. It comes preinstalled in the Arduino
IDE.

Page 21 of 23
WiFi101/WiFiNINA Firmware Updater
It is used to check and update the Wi-Fi Firmware of the connected board.
Board
We are required to select the board from the list of boards. The selected board must be similar to the board
connected to the computer.
Processor
It displays the processor according to the selected board. It refreshes every time during the selection of the
board.
Port
It consists of the virtual and real serial devices present on our machine.
Get Board Info
It gives information about the selected board. We need to select the appropriate port before getting
information about the board.
Programmer
We need to select the hardware programmer while programming the board. It is required when we are not
using the onboard USB serial connection. It is also required during the burning of the Bootloader.
Burn Bootloader
The Bootloader is present on the board onto the microcontroller. This option is useful when we have
purchased the microcontroller without the bootloader. Before burning the bootloader, we need to make sure
about the correct selected board and port.
Help
When we click on the Help button on the Menu bar, a drop-down list will appear. It is shown below:

The Help section includes several documents that are easy to access, which comes along with the Arduino
IDE. It consists of a number of options such as Getting Started, Environment, Troubleshooting, Reference,

Page 22 of 23
etc. We can also consider the image shown above, which includes all the options under the Help section.
Some documents like Getting started, Reference, etc., can be accessed without an internet connection as
well. It will directly link us to the official website of Arduino.

Page 23 of 23

You might also like