assignment 3
assignment 3
JOT
3.17
AINTRODUCTION TO ARDUINO
34.
WhatisArduino?
connectionis labeled (1) and the barrel jack is labeled (2).The USB connection is
we wilIload code onto our Arduino board. Do NOT
alsohoW use a power supply
greaterthan 20 Volts as we will overpower (and thereby destroy) our Arduino. The
recommended voltage for most
Arduino models is between 6 and 12 Volts.
10 Z/8~
OxGITAL M 11
O(UNO)
RDUTNO
SPKI8.Ob0G.
2º
Digital (7): Across from the analog pins are the digital pins (0 through 13
on the UNO). These pins can be used for both digital input (like telling if a
button is pushed) and digital output (like powering an LED).
3.20 EmbeddedSystems and Ior
PWM (8): we may have noticed the tilde () next to Some of
pins (3, 5, 6, 9, 10, and 11 on the UNO). These pins act as
the igta
normal
pins, but can also be used for something called Pulse-Width digta
(PWM).
AREF (9): Stands for Analog Reference. Most of the time we
Modulation
can
this pin alone. It is sometimes used to set an external reference leave
(between0 and SVolts) as the upper limit for the analog input pins. voltage
Reset Button
Just like the original Nintendo, the Arduino has a reset button (10). Pushing it wil
temporarily connect the reset pin to ground and restart any code that is loaded on .
Arduino. This can be very useful if our code doesn't repeat, but we want to test i:
multiple times. Unlike the original Nintendo however, blowing on the Arduinn
doesn't usually fix any problems.
Power LED Indicator
Just beneath and to the right of the word UNO" on our circuit board, there's a
tiny LED next to the word 'ON' (11). This LED should light up
whenever we plug
our Arduino into a power source. If this light doesn't turn on, there's a good chance
something is wrong. Time to re-check your circuit!
TX RX LEDs
TX is short for transmit, RX is short for receive. These
markings appear quite a
bit in electronics to indicate the pins responsible for serial
communication. In our
case, there are two places on the Arduino UNOwhere TX and RX appear -- once by
digital pins 0 and 1, and a second time next to the TX and RX indicator LEDs (12).
These LEDs will give us some nice visual indications whenever our Arduino is
receiving or transmitting data (like when we're loading a new program onto the
board).
Main iC
The black thing with all the metal legs is an IC, or Integrated Circuit (13). Think
of it as the brains of our Arduino. The main IC on the Arduino is slightly different
from board type to board type, but is usually from the AT mega line ofIC's from the
ATMEL company. This can be important, as we may need to know the IC typ
(along with our board type) before loading up a new program from the Arduo
JOTand Arduino Programming
3.21|
software. This information can usually be found in
f we
want to know more about the writing on the top side ofthe IC.
datasheets is often agood idea. difference between various IC's, reading the
Voltage Regulator
The voltage regulator (14) 1s not
actually something we can (or should) interaeL
with onthe Arduino. But it is
potentially useful to know that it is there and what it's
for. The voltage regulator does exactly what it says -- it controls the amount of
voltage that is let into the Arduino board.
Think of it as a kind of it will
turn away an extra gatekeeper;
voltage that might harm the circuit. Of course, it has its limits, so
don'tt hook up our Arduino to anything greaterthan 20
volts.
3.4.3. FEATURES OF ARDUINO BOARD
The operating voltage is SV
The recommended input voltage will range from 7v
to 12V
The input voltage ranges from 6v to 20V
Digital input/output pins are 14
Analog iip pins are 6
DCCurrent for each input/output pin is 40 mA
DCCurrent for 3.3V Pin is 50 mA
Flash Memory is 32 KB
SRAM is 2 KB
EEPROM is 1 KB
CLK Speed is 16 MHZ
Arduino board was designed in the Ivrea Interaction Design Institute intended for
students without a background in electronics and programming concepts. This board
started altering to adapt to new requirementsand challenges, separating its presence
from simple 8-bit boards to products for loT (Internet of Things) applications, 3D
printing, wearable, and embedded surroundings.
Embedded.
3.22 Systems and Ior
All boards are entirely open-source, allowing users to build them
finally adapt them to their exact needs. Over the years the
separat ely
different typeands
of Arduino boards have been used to build thousands of projects, from
to compound scientific instruments. An international community of
daily objecs
designers,
students, programmers, hobbyists, and experts has gotten together around this arotists,
source stage, their donations have added up to an unbelievable amount of
knowledge that can be of immense help to beginners and specialists alike. available
3.5.1. WHAT ARE THE TYPES OF ARDUINO BOARDS?
Arduino board is an open-source platform used to make electronics projects.
consists of both a microcontroller and a part of the software or
Development Environment (IDE) that runs on our PC, used to write and uno Integrated
computer code to the physical board.
Unlike most earlier programmable circuit boards, the Arduino does not require a
separate part of hardware in order to program a new code onto the board we can iue
use a USB cable. As well, the Arduino IDE uses a basic version of C+t, making i
simpler to learn the program. At last, the Arduino board offers a typical form factor
that breaks out the functions of the microcontroller into a more available package.
Why Arduino Boards?
Arduino board has been used for making different engineering projects and
different applications. The Arduino software is very simple to use for beginners, yet
flexible adequate for advanced users. It runs Windows, Linux, and Mac. There are
numerous other microcontroller platforms obtainable for physical computing. The
Netmedia's BX-24, Parallax Basic Stamp, MIT's Handyboard, Phidget, and many
others present related functionality. Arduino also makes simpler the working process
of microcontroller, but it gives some advantages over other systems
such as
Inexpensive
Cross-platform
The simple, clear programming environment
Open source and extensible software
Open source and extensible hardware
IOTand Arduino
Programming
3.5.2. THE FUNCTION OF THE 3.23
s
fexibility of the
Arduino
ARDUINO BOARD
imagine. This board can be board is enormous so that one
connected can do
obstacle sensors,
presence detectors, fire
very anythingsuchtheyas
easily to different modules
The main function of the sensors, GSM Modules GPS
inputs &changing it into Arduino board is to control modules, etc.
also used to make outputs because this board electronics through reading
robotics, et.
different electronics works like a tool. This toard is
projects in the field of electronics, electrical,
E3. FEATURES OF
The features of DIFFERENT TYPES OF ARDUINO BOARDS
different types of Arduino bo¡rds are
Arduino listed in the tabular form.
Board
Processor Memory Digital Analogue UO
Arduino Uno I/O
16Mhz. 2KB SRAM, 14 6 input, 0 output
ATmega328 32KB flash
Arduino Due 84MHz 96KB SRAM, 54 12 input, 2 output
Arduino Mega
AT91SAM3X8E
16MHz
S12KB flash
8KB SRAM, 54 16 input, 0 output
ATmega2560 256KB flash
Arduino 16MHz
Leonardo 2.5KB SRAM, 20 12 input, 0output
ATmega32u4 32KB flash
Arduino Due
LilyPad Arduino Board
$ Arduino Bluetooth
3.24 Embedded Systems and Iom
Arduino Diecimila
RedBoard ArduinoBoard
Arduino Mega(R3)Board
Arduino Leonardo Board
Arduino Robot
Arduino Esplora
Arduino Pro Mic
Arduino Ethernet
Arduino Zero
Fastest Arduino Board
3.5.4.1. Arduino Uno (R3)
The Uno is a huge option for our 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/Opins, 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 (CSP), etc.
X rduing
RX Diecimila
S MEGA)
OO LEONARD0
ARDUINO
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 and performs like a great educational tool.
FTDI
Arduino
8MHz 14 14 6 1 Compatible
Pro Mini 3.3V
Header
3.3V/8MHz
FTDI
Arduino
16MHz 14 6 1 Compatible
Pro Mini 5V Header
SV/16MHz
FTDI
Arduino 16MHz 14 6 6 1 Compatible
Ethernet Header
FTDI
Compatible
Arduino 8 6 1 Header or
3.3V 8MHz 14
Fio Wirelessly via
XBeet
LilyPad FTDI
Arduino 6 6 1 Compatible
3.3V 8MHz 14
328 Main Header
Board
FTDI
LilyPad
Arduino 8MHZ 9 4 5 Compatible
3.3V Header
Simple
Board
RIGHT ARDUINO BOARD?
3.5.6. HOW TO SELECT THE
different types of Arduino boards existing in the market today
There are Arduino
best way to select the
such as the FreeDuino and NetDuino. The
names on the original
board is by checking and differentiating the trade
through online sites as
boards. So getting low-cost Arduino boards is easy
available with different versions
well as electronic stores. These boards are
as wellas specifications.
done with the Arduino DE
The programming of all the boards can be
but eat
software that pernmits anyone to write as well as upload the code,
board varies based on the inputs, outputs, speed, form factor, voltage, e
The voltage required to operate these boards range from 3.7V to 5V.
and Arduino Programming |3.35
At0ol chain is a set of programming tools that is used to perform a complex set of
operations. In the Arduino Software (|DE) the tool chain is hidden from the user, but
is used to compile and upload the user Sketch. It includes compiler, assembler,
linker and Standard C& math libraries.
Asoftware tool chain is a sct of software development tools used
simultaneously to complete complex software development tasks or to deliver a
cofware product. Each tool in the chain is itself a piece of software that serves a
isferent function and isoptimized to work together with other tools in the chain.
A
tool chain is simply a set of software tools that work together to complete a
task. for example, if we were going to hang a picture, the tool chain might include a
hammer, maybe a tape measure and some nails.
10 1 010 1 0
Linker
1
i
The figurebelow iS another way to view
3.22. Arduino code compilation process.
0
Fig.
.hex
C Program
Compiler
Assembly
Assembler
Memory Althoug
Fig. 3.23. another way to visualize the Arduino code compilation proces developme
data,a When you
It then creates object files, which combine machine languag to install S.
Often,th
information it needs to place instructions properly in memory. finished, s
together.
assembler creates multiple files which will eventually be put
JOT md Arduino Programming |3.37|
The linker will take all the independently assembled machine language
programs andobject files and put them together. This produces a .hex file
that the microprocessor can understand and run.
Another piece of software, called AVR Dude (for Downloader UploaDEr) starts
.hex file to the
when we press the upload button. This software sends the
ATMega328 on the Arduino board. On the chip resides the boot loader. This boot
AVR Dude
loader was put there on purpose by the folks at Arduino and works with
to get the .hex into the flash memory on the chip. All of this happens very quickly
and seamlessly behind the scenes of the Arduino IDE.
AVR Dude
100
(Dude =
001
Downloader/UploaDEr)
.hex File
OOUNO
Hi, I'm the bootloader and |
live on the ATMega328 chip.
Fig. 3.24. how the compiled code transfers tothe Arduino board.
Serotot
WiFi Firmware
You should make sure the WiFi firmware is up-to-date and is supported by the
WiFil01 library you will use. To check the WiFi firmware, navigate to Fle >
Examples > Wifil01 > Check WiFi101FimwareVersion. This will open the example
sketch that you now have to load on the device:
X
Checkwifi101FirmwareVersion Arduino 1.8.2
File Edit Sketch Toots Heip
CheckVifi 101Firrwareversion
4ir.:iude <sPI.h:
*inicde WiFil1.n
|3.39
10T and Arduino Programming
Use the button with the arrow pointing right (next to the button with the
abeckmark) to upload the firmware to the device. While uploading, press CTRI
SHIFT-M to open the Serial Monitor. You will see a message similar to the one
below:
6 COM3 (Arduino/Genuino MKR1000)
Test connection
2. Update firmware
Select the firmware from the dropdown box below
WINC15ß1 Model 8(19.5.2)
Update Firmware
The Arduino language is Ctt. The most important "high level" characteristic of
C++ is that it is object-oriented. In such a language, an object is a construct that
combines functional code (the code that does things like calculations and memory
operations), with "state" (the results of such calculations, or simply values, stored in
variables).
Object orientation made programming much more productive in most types of
applications when conmpared with earlier paradigms because it allowed programmers
touse abstractions to create complicated programs. For example, you could model an
Ethernet adaptor as an object that contains attributes (like its IP and MAC addresses)
and functionality (like asking a DHCP server for network configuration details).
Programming with objects became the most common paradigm in programning, and
most modern languages, like Java, Ruby, and Python, have been influenced heavily
by C++,
Much of the sketch code you will be writing and reading will be referencing
libraries containing definitions for objects (these definitions are called "classes")
Your original code, to a large extent, willconsist of "glue" code and customizations.
This way, you can be productive almost right away by learning a small subset of
C+t.
The code that makes up your sketch must be compiled into the machine code th§t
the microcontroller on the Arduino can understand. This compilation is done by &
special program, the compiler. The Arduino IDE ships with an open-source C+t, S0