Mahmoud Ebarhim
MTE LEVEL 300
Embedded Systems Engineer
Embedded System
Instructor at IMT
Embedded Systems Instructor at NTI
Software
content
intro to arduino
interfacing and functions
analog & digital
sensors
actuators
bluetooth module
intro to embedded system
Overview
what is arduino electronic signals laps & tasks
why arduino software tool Conclusion
types of arduino actuators Thank You
anatomy of arduino code examples
What is Arduino?
Arduino is an open-source electronics platform based
on easy-to-use hardware and software. Arduino boards
are able to read inputs - light on a sensor, a finger on a
button, or a Twitter message - and turn it into an output
- activating a motor, turning on an LED, publishing
something online. You can tell your board what to do by
sending a set of instructions to the microcontroller on
the board. To do so you use the Arduino programming
language (based on Wiring), and the Arduino Software
(IDE), based on Processing.
Why Arduino?
its simple and accessible user experience
Arduino has been used in thousands of different
projects and applications.
The Arduino software is easy-to-use for beginners,
yet flexible enough for advanced users.
build low cost scientific instruments, to prove
chemistry and physics principles, or to get started
with programming and robotics.
Types of Arduino Boards
Arduino UNO (R3)
LilyPad Arduino
Red Board
Arduino Mega (R3)
Arduino Leonardo
Anatomy of an Arduino Board
1. Microcontroller :this is the brain of an Arduino, and is the component
that we load programs into.
2. USB port :used to connect your Arduino board to a computer.
3. USB to Serial chip - the USB to Serial is an important component, as it
helps translating data that comes from a computer to the on-board
microcontroller.
4. Digital pins - pins that use digital logic (0,1 or LOW/HIGH).
5. Analog pins - pins that can read analog values in a 10 bit resolution (0-
1023)
6. 5V / 3.3V pins- these pins are used to power external components.
7. GND - also known as ground negative or simply is used to complete a
circuit, where the electrical level is at 0 volt.
8. VIN - stands for Voltage In, where you can connect external power
supplies
Basic Operations
Circuit Basics
A simple example of a circuit, is an LED circuit. A
wire is connected from a pin on the Arduino, to an
LED via a resistor (to protect the LED from high
current), and finally to the ground pin (GND).
When the pin is set to a HIGH state, the microcontroller on the Arduino board
will allow an electric current to flow through the circuit, which turns on the LED.
When the pin is set to a LOW state, the LED will turn off, as an electric current is
not flowing through the circuit.
Electronic Signals
An analog signal is generally analog signal
bound to a range. In an
Arduino, that range is typically
0-5V
If we for example use a potentiometer (an analog
component used to change the resistance of a
circuit), we can manually adjust this range (0-5V). In
the program, this is represented in a range of 0-1023,
which is a 10-bit resolution.
If we write an analog signal using Pulse-Width
Modulation (PWM), we can use a range between 0-
255, as we are using an 8-bit resolution.
Basics of PWM (Pulse Width
Modulation)
Digital Signal
A digital signal works a bit different, representing only
two binary states (0 or 1) that are read as high or low
states in the program. This is the most common signal
type in modern technology.
Arduino Software Tools
Main Parts
The Arduino API can be divided into three main
parts: functions, variables and structure
Functions: for controlling the Arduino board and performing computations. For example, to
read or write a state to a digital pin, map a value or use serial communication.
Variables: the Arduino constants, data types and conversions(int,boolean)
Structure: the elements of the Arduino (C++) code, such
as(loop,setup)
Program Structure
The absolute minimum requirement of an Arduinoprogram is the use of two functions:
void setup() and void loop() . The "void" indicates that nothing is returned on
execution.
VOID SETUP() : this function executes only once, when
the Arduino is powered on. Here we define things such
as the mode of a pin (input or output)
VOID LOOP: this is where we write the code that we
want to execute over and over again, such as turning
on/off a lamp based on an input
The classic Arduino IDE.
our first example is LED
A light-emitting diode (LED) is a semiconductor
device that emits light when an electric current
flows through it.
To control actuators, it is common to use
digitalWrite()
and
analogWrite()
.
EXAMPLE 1
TURNINING LED ON/OFF
LAP 1
Traffic light using 3 leds
example2
Fading (pwm)
task 1
Led sequence using 3 leds
Thank you
any questions?
contact me
01026412526
https://www.linkedin.com/in/mahmoudebrahimabdalziz/