0% found this document useful (0 votes)
10 views56 pages

Arduino Course Outline and Features

The document presents a course plan on Arduino. The plan contains four main parts: 1) the presentation of the Arduino board, 2) the presentation of the Arduino IDE software, 3) the presentation of the ISIS Proteus simulation software, and 4) the basic functionalities of Arduino.

Translated by

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

Arduino Course Outline and Features

The document presents a course plan on Arduino. The plan contains four main parts: 1) the presentation of the Arduino board, 2) the presentation of the Arduino IDE software, 3) the presentation of the ISIS Proteus simulation software, and 4) the basic functionalities of Arduino.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Course outline

1. Presentation of Arduino board


2. Presentation of the Arduino IDE software

3. Presentation of the ISIS Proteus simulation software


4. Basic Features
Course outline

1. Presentation of Arduino board


[Link] of the Arduino IDE software

[Link] of the ISIS Proteus simulation software


[Link] features
1. Presentation of Arduino board
. What is a microcontroller?
A microcontroller is a small computer on a single integrated circuit containing a
processor, memory, and programmable input/output devices. Like most
Microcontrollers are simply executors of commonly used instructions.
General. The main element of a computer system is a program of instructions that is
provided by a human programmer.
1. Presentation of Arduino board
. Characteristics of the Arduino board

The Arduino board is an easy-to-use tool. It is based on a microcontroller of type


Atmel ATMEGA328 (Arduino UNO) or ATMEGA2560 (Arduino MEGA). This powerful computer at
Unique card has managed to secure a good place in the market of enthusiasts as well as in the
market for professionals and academics.

One of the most common Arduino board models is the Arduino UNO. It is the first
stable version of Arduino board.
1. Presentation of the Arduino board
. Characteristics of the Arduino board
Arduino boards are available in several types:
1. Presentation of Arduino board
. Features of the Arduino UNO board
1. Presentation of Arduino card
. Characteristics of the Arduino UNO board
1. Presentation of Arduino card
. Features of the Arduino MEGA board
1. Presentation of Arduino board
. Characteristics of the Arduino MEGA board
1. Presentation of Arduino card
. Arduino in numbers
ARDUINO UNO ARDUINO MEGA
Microcontroller ATmega328 ATmega2560
Operating voltage 5V 5V
Input voltage (recommended) 7-12 V 7-12 V
Input voltage (limits) 6-20V 6-20V
Digital I/O pins 14 (6 provide PWM output) 54 (15 provide the PWM output)
Analog input connectors 6 16
DC current by I/O pin 20 mA 20 mA
3.3V output current 50 mA 50 mA
Flash Memory 32 Ko 256 KB
SRAM 2 KB 8 KB
EEPROM 1 KB 4 KB
Clock speed 16 MHz 16 MHz
Length 68.6 mm 101.52 mm
Width 53.4 mm 53.3 mm
Weight 25 g 37g
Course outline

1. Presentation of Arduino board


2. Presentation of the Arduino IDE software

3. Presentation of the simulation software ISIS Proteus


4. Basic Features
2. Presentation of the software Arduino IDE

The Arduino IDE is free software available for download for systems
Linux, Windows, and Mac OS X. The development environment allows for editing.
the programs, compile them and upload them to the Arduino board.

The steps to follow to install the Arduino IDE on Windows are as follows:
1. Open the Arduino IDE folder and right-click to start the installation of the software "arduino-
[Link] as administrator.
2. Follow the installation steps naively until Windows prompts you
the authorization to install the Arduino USB driver, once you accept, the installation
it ends.
2. Presentation of the software Arduino IDE

It is equipped with a code editor.


[1], where the functionsetupwill contain
all the operations necessary for the
configuration of the card and the function
loopis executed in a loop after
the execution of the setup function. On
also find a tool bar
quick and a menu bar
to access the advanced features
of the IDE. Finally, a console
displaying the compilation results
source code, operations on the
map, etc.
Course outline

1. Presentation of Arduino board


[Link] of the Arduino IDE software

3. Presentation of the ISIS Proteus simulation software


4. Basic Features
2. Presentation of the ISIS simulation software
Proteus
Proteus is a software tool for computer-aided electronic design.
Proteus consists of two main software: ISIS, which allows the creation of schematics and the
electric simulation, andARES, dedicated to the creation of printed circuits. Thanks to libraries
additionally, ISIS is also capable of simulating the behavior of a microcontroller (PIC,
Atmel, 8051, ARM, HC11...) and its interaction with the surrounding components.
2. Presentation of the ISIS simulation software
Proteus
The installation of version 7.6 of Proteus is done as follows:
[Link] the Proteus 7.6 folder and run the installation of 'setup76 [Link]' as
as an administrator.
2. Accept to install WinHelp.
3. Choose to install your locally installed license key.
4. Click on 'Next' to indicate to the license manager the path of your key.
Then click on 'Browse For Key File', specify the path of the key, and then click on
Install
5. Continue the installation, but don't forget to check 'Converter Files' as
component to install.
[Link] sur "Next"jusqu’àfin del’installation.
2. Presentation of the ISIS simulation software
Proteus

In order to simulate Arduino boards more effectively, it is necessary to add the library.
Arduino to ISIS. The following steps allow you to do it:
1. Copy the files "[Link]", "[Link]", "[Link]", and "[Link]" from the folder
Arduino library for Proteus and paste them in the folder: "C:\Program Files
(x86)\Labcenter Electronics\Proteus 7 Professional\LIBRARY.
2. Copy the file "[Link]" from the Arduino Library folder for Proteus and paste it in the
dossier : "C:\Program Files (x86)\Labcenter Electronics\Proteus 7 Professional\MODELS".

Now your ISIS software is capable of simulating Arduino!


2. Presentation of the ISIS simulation software
Proteus
Copy "[Link]" to C:\Program Files\Labcenter Electronics\Proteus 7
Professional.
2. Disable the antivirus and then open the patch as an administrator.

3. Click on Patch, then go to C:\Program Files\Labcenter Electronics\Proteus 7 Professional\BIN


(select the file and then click OK) then to C:\Program Files\Labcenter
Electronics\Proteus 7 Professional\MODELS (select the file and then click OK)
Course outline

1. Presentation of Arduino board


2. Presentation of the Arduino IDE software

3. Presentation of the simulation software ISIS Proteus


4. Basic Features
4. Basic Features
. Configuration of Digital Inputs/Outputs
The Arduino language comes with a significant number of basic functions that allow
to interact with its environment. The most used functions are the functions
inputs/outputs. It is they that allow to send or measure a voltage on a
pins from the card.
First of all, before taking a measurement or sending an order. It is
It is necessary to define the direction of the pins used. For this, we call on the function
pinMode(pin, state) by giving it the concerned pin and the state:
void setup(){
pinMode(1, OUTPUT);Pin 1 as output
pinMode(2, INPUT);Pin 2 as input
}
4. Basic features
. Configuration of Digital Input/Output
Once the configuration is done, we can proceed to the use of the pins. All the
brooches are capable of writing and reading digital data (that is, 0 (0V) or
1 (5V)).

The function digitalRead(pin): measures a digital value on one of the pins, the
The brooch in question must be adjusted at the entrance.

The function digitalWrite(pin,value): writes a numeric value to one of the pins, the
The concerned pin must be set to output. The parameter value must be equal to HIGH.
(state 1 is 5V) or LOW (state 0 is 0V).
4. Basic Features
. Timers
Timers are used for a variety of tasks, for example, to manage time
to press a button or to generate pulse width modulated (PWM) signals for
motor control as an example. The Arduino language provides some functions that allow
to manage time:
The function delay(): suspends the program for a period of time (in milliseconds)
specified as parameter.
The delayMicroseconds() function: suspends the program for a period of time (in
microseconds) specified as a parameter.
The millis() function: returns the number of milliseconds since the Arduino board has
started executing the program until the moment of the execution of the millis() function.
The micros() function: returns the number of microseconds since the Arduino board has been
started the execution of the current program.
4. Basic Features
First Program: BLINK
First, open the Arduino IDE and go to Tools Choose the type of card and then select it.
type of your board (Arduino/Genuino UNO or Arduino/Genuino MEGA)
2. Go to File Examples Basics Blink. The source code of the program is the
next
4. Basic Features
First Program: BLINK
To be able to simulate Arduino on ISIS, you need to specify the path of the '.hex' file; for that,
we need to activate a feature of Arduino IDE that allows displaying the file path
.hex
Go to File Preferences
2. Check the following two boxes:
From now on, every time you compile a program, the console at the bottom of Arduino
IDE will allow you to retrieve the absolute path of your '.hex' file.
4. Basic Features
First Program: BLINK
Carry out the following assembly under ISIS, indicate the program path on the Arduino board.
then start the assembly simulation.
4. Basic Features
First Program: BLINK

The 'Upload' button allows you to upload the program to the Arduino's Flash memory.

The test LED connected to PIN 13 will start to blink!


4. Basic Features
Exercise 1
Create a setup and write a program that allows to turn on a LED connected to the PIN
If a push button connected to PIN A0 is pressed for 5 seconds.
4. Basic features
Exercise 1 (Solution)
4. Basic Features
Exercise 2
Create a circuit and write a program that allows you to turn on an LED connected to the PIN.
13 once a push button is pressed (A0). The LED turns off once another push button (A5) is pressed.
is pushed.
4. Basic features
Exercise 2 (Solution)
4. Basic Features
Exercise 3
Now we want to redo exercise 2 as follows: once the ON button
when activated, the LED must remain lit for 5 seconds, but at any time if the OFF button is
push the LED should turn off instantly. Set up the assembly and write a program.
4. Basic Features
Exercise 3 (Solution)
4. Basic features
. Interruptions
Sometimes it is necessary to wait for an external event (support
on a button, sensor data, etc.) to perform a
action. For this type of problem, we use interrupts. There are 2
external interrupt pins on the Arduino UNO, INT0 and INT1, and they
are mapped to pins 2 and 3 of the board, and a6 pins
external interrupts on the Arduino MEGA.
4. Basic Features
. Interruptions
The attachInterrupt() function: defines an interrupt routine to be executed when a
an interruption occurs.
Function syntax: attachInterrupt(interrupt, routine, mode)
interruption: Interrupt number (0 (pin2) or 1 (pin3))
routine: function to be called once the interruption occurs. This function does not
must not take parameters and returns nothing.
mode:LOW, CHANGE, RISING, or FALLING.
• LOW: When the pin is in state 0 (0V).
• RISING: When the pin goes from state 0 (0V) to state 1 (5V) (rising edge).
• FALLING: When the pin goes from state 1 (5V) to state 0 (0V) (falling edge).
• CHANGE: When the spindle changed state (front ascending and front descending).
The detachInterrupt() function: Disables an interrupt.
Syntax of the function: detachInterrupt(interrupt).
4. Basic Features
. Interruptions

The noInterrupts() function: allows you to disable interrupts. Interrupts are


activated by default.

The function interrupts(): allows re-enabling of interrupts.


4. Basic features
Exercise 4
Let's redo exercise 3, but this time using the attachInterrupt() function (not the
millis function). Set up the circuit and write the program.
4. Basic Features
Exercise 4 (Solution)
4. Basic Features
. Series communication
Used for communication between the Arduino board and a computer or other devices.
All Arduino boards have at least one serial port. It communicates on digital pins 0.
(Rx) and 1 (TX) and with the computer via USB.
[Link](): configuration of the data transmission speed. A speed is expressed
in bits per second. The most common speeds are 9600, 19200 and 115200 bits per
second.
[Link](): transmits the data to the serial port in readable ASCII text followed by
line break at the end of the sent message.
[Link](): allows you to obtain the number of bytes available for reading on the serial port.
Ce sont des données qui ont déjà arrivé et ont été stockés dans la mémoire tampon de
series reception (which holds 64 bytes).
[Link](): reads the received serial data.
4. Basic Features
Exercise 5
Create a setup and write a program that displays the state of the push button.
connected to pin A0 (state 'ON' or 'OFF' using the [Link]() function)
4. Basic Features
Exercise 5 (Solution)
Basic Features
. Analog/Digital Conversion
o What is an Analog to Digital Converter (ADC)?
It is a device that converts analog magnitudes into digital magnitudes. The value
The obtained digital value will be proportional to the provided analog value at input.

The Arduino analog-to-digital converter has a resolution of 10 bits, which means that
each real analog value between 0 and 5V will be represented by an integer between 0 and
1023.
4. Basic Features
. Analog to Digital Conversion
The microcontroller of the Arduino UNO contains 6 The microcontroller of the Arduino MEGA contains 16 channels
analog-to-digital conversion channels (A/D) of analog-to-digital (A/D) converters configured on the
configured on the analog pins A0 to A5. analog pins A0 to A15.

Analog inputs Analog inputs


4. Basic Features
. Analog/Digital Conversion

The function analogRead(pin):

pin: the number of the analog input.


The value returned will be the result of the analog-to-digital conversion (understood
between 0 and 1023
4. Basic Features
Exercise 6
To create a variation of the voltage, we will use a potentiometer connected to pin A0.
Write a program that allows you to retrieve the analog value from A0 (use analogRead(A0)) and
display it on the serial monitor.
4. Basic features
Exercise 6 (Solution)
To create a variation of the voltage, we will use a potentiometer connected to pin A0. Write a
program that allows you to retrieve the analog value from A0 (use analogRead) and display it on the
serial monitor.
4. Basic Features
.Power control by pulse width modulation (PWM)
PWM: Pulse Width Modulation is a technique
to control the electrical power supplied to the devices. The PWM signal consists of a
series of impulses in the form of a rectangular signal.

The principle of PWM is based on the duty cycle, which refers to the...
This means that logical level 1 may not last the same amount of time as logical level 0. The ratio
cyclic is measured as a percentage (%). The higher the percentage, the higher the logical level 1
is present in the period.
4. Basic Features
.Power control by pulse width modulation (PWM)

The function analogWrite(pin,value): writes a value in the form of PWM on one of


brooches regulated at output.

pin: output pin identifier.


value: valeur durapport cycliqueentre0(0%) et255(100%).
4. Basic Features
.Power control by pulse width modulation (PWM)
4. Basic Features
Exercise 7
Create a setup and write a program that allows the visualization of the PWM signal on the attached oscilloscope.
on pin 9, by acting on a potentiometer connected to pin A0. (using the analogWrite function)
4. Basic Features
Exercise 7 (Solution)
Create a setup and write a program that allows the visualization of the PWM signal on
the oscilloscope attached to pin 9, by acting on a potentiometer attached to pin A0. (using the
functionanalogWrite)
4. Basic features
. Motor control
The Arduino, like any embedded system brain, is used in applications for
command and interact with mechanical actuators, including motors. These are
devices enabling physical movements powered by energy (in our case
electric.

The DC motor: or direct current motor converts electrical energy


under a continuous current in mechanical power. Generally
these motors have two terminals, applying a direct voltage to these
terminals lead to the rotation of the motor in one direction, the inversion of the
the polarity of the voltage causes it to rotate in the opposite direction.
4. Basic features
Exercise 8
Create a setup and write a program that allows for the control of a 12V DC motor.
unidirectional with the help of an NPN (Darlington) transistor TIP122. Two push buttons connected to the Arduino,
will be responsible for starting/stopping the engine.
4. Basic Features
Exercise 8 (Solution)
4. Basic features
. Motor control

The servo motor: a (rotary) motor that can perform a


very precise rotations (in a portion of a turn only) and
in a certain number of steps (micro-movements). There is
all kinds of servo motors. One of the advantages of servo-
motors are its ability to firmly maintain a position
data. You can control rotations with Arduino, some
directly with the card if the motor is not too powerful,
otherwise through an associated assembly.
4. Basic Features
. Motor control
The servo motor:

Composition: a direct current motor, an electronic circuit to control the


motor with a signal, a gear system to amplify the rotational torque and a
potentiometer that provides information on the position (angle of rotation).
Connection: the servo motor needs three connection wires to operate. Two wires
serves its power supply, the latter being the one that receives the control signal:
• for the power supply (generally 4.5V to 6V).
• you for the mass (0V).
• , input of the control signal, encoded in PWM. This means
It is the duration of the pulses that determines the absolute angle of the output axis and thus
the position of the servo motor control arm. The signal is repeated periodically,
generally every 20 milliseconds.
4. Basic Features
. Motor control
The servo motor:

Servomotor control by Arduino: The Servo.h library allows for a


Arduino board to control servomotors. Standard models allow
the tree can be positioned at various angles, generally between 0 and 180 degrees.

• The attach() function: associates a 'servo motor' object with a pin of the Arduino.
• The write() function commands the servo motor to turn to the given angle.
in parameter (0°- 180°).
• The function read(): returns the value of the engine's angle (0°-180°).
• The detach() function: disassociates a servo from a pin.

You might also like