You are on page 1of 45

GNG/ELG 5301

Arduino Training Presented by Olutayo Oladosu


10th October 2023
Training Objective
At the end of this training, students should be
able to.

Utilize the Arduino IDE Software platform to


write simple measurement and control logic
commands.
Outline

• Materials
• Background
• Embedded Systems
• Microcontrollers
• Arduino
• Arduino Based Applications in
various fields
• Arduino Platforms
• Hands-On Labs
• References
Materials
• School of Engineering Design &
Teaching Innovation – Director:
Professor Hanan Anis
• https://engineering.uottawa.ca/en
gineering-design-teaching-
innovation-school
• Centre for Entrepreneurship and
Engineering Design (CEED)
• CEED_101_2020_grad
Background
• Smart systems every where
• Integrated Circuits (IC).
• Sizes
• Performance.
• This is made possible with
Microcontrollers.
Introduction
• What is an Embedded System? • Networks
• Application-specific computer system • Often embedded system will use multiple
• Built into a larger system processors communicating across a network to
• Why add a computer to the larger system? lower parts and assembly costs and improve
reliability
• Better performance
• More functions and features
• Lower cost
• More dependability

• Economics
• Microcontrollers (used for embedded
computers) are high-volume, so recurring cost
is low
• Nonrecurring cost dominated by software
development
6 © 2021 Arm
Introduction to embedded systems
• What is an embedded system?
• Application-specific computer system
• Built into a larger system embedded
• Often with real-time computing constraints system
• Why add an embedded computer to a larger system?
• Better performance
• More functions and features
• Lower cost, e.g., through automation
• More dependability
Embedded Computer
Input from Software Output to environment
environment Hardware

7 © 2021 Arm User interface Link to other systems


Example Embedded System: Bike Computer
• Functions
• Speed and distance measurement
• Constraints
• Size
• Cost
• Power and Energy
• Weight
• Inputs
• Wheel rotation indicator
• Mode key
• Output
• Liquid Crystal Display
• Low performance MCU
• 8-bit, 10 MIPS

8 © 2021 Arm
Example embedded system: bike computer
• Functions
• Speed and distance measurement
Input:
• Constraints Wheel rotation
• Size Mode key
• Cost
• Power and energy
• Weight
• Inputs
• Wheel rotation indicator
• Mode key
• Output Output:
• Liquid Crystal Display Display speed and
distance
• Use Low Performance Microcontroller
• 8-bit, 10 MIPS

9 © 2021 Arm
Motor Control Unit
• Functions • 32-bit, 256KB flash memory, 80MHz
• Motor control
• System communications
• Current monitoring
• Rotation speed detection
• Constraints
• Reliability in
harsh environment
• Cost
• Weight
• Many Inputs and Outputs
• Discrete sensors & actuators
• Network interface to rest of car
• High-Performance MCU

10 © 2021 Arm
Gasoline automobile engine control unit
• Functions ▪ Many inputs and outputs
• Fuel injection ▪ Discrete sensors & actuators
• Air intake setting ▪ Network interface to rest of car
• Spark timing
• Exhaust gas circulation ▪ Use high-performance microcontroller
• Electronic throttle control ▪ E.g. 32-bit, 3MB flash memory, 150-300 MHz
• Knock control

• Constraints
• Reliability in harsh environment
• Cost
• Weight

11 © 2021 Arm
Benefits of embedded systems
• Greater performance and efficiency
• Software makes it possible to provide sophisticated controls
• Lower costs
• Less expensive components can be used
• Manufacturing costs reduced
• Operating costs reduced
• Maintenance costs reduced
• More features
• Many not possible or practical with other approaches
• Better dependability
• Adaptive system which can compensate for failures
• Better diagnostics to improve repair time

12 © 2021 Arm
Microcontroller vs. Microprocessor
• Both have a CPU core to execute instructions
• Microcontroller has peripherals for concurrent embedded interfacing and control
• Analog
• Non-logic level
signals
• Timing
• Clock generators
• Communications
• Reliability and safety

13 © 2021 Arm
Processor v Microcontroller

CPU MCU

Is a single processor core Typically has a single processor core

Has memory blocks, basic IOs, and


Used for general purposes
other basic peripherals

Mainly used for basic control


It needs to be supported with
purposes, such as embedded
memories and IOs
applications

14 © 2021 Arm
CPUs → MCUs → embedded systems
• Microprocessor (CPU)
• Defined typically as a single processor core that supports at least instruction fetching, decoding, and
executing
• Normally can be used for general-purpose computing, but needs to be supported with memories
and Input/Outputs(IOs)

Instruction fetcher Memory Interface To memory


blocks
Instruction decoder

Register banks

ALU
Microprocessor

15 © 2021 Arm
CPUs → MCUs → embedded systems
• Microcontroller (MCU)
• Typically has a single processor core
• Has memory blocks, Digital IOs, Analog IOs, and other basic peripherals
• Typically used for basic control purpose, such as embedded applications

Program Data
Microprocessor
Memory Memory
System Bus

Digital I/O Analog I/O Timer Other


peripheral
Microcontroller

16 © 2021 Arm
CPUs → MCUs → embedded systems
• Embedded System
• Typically implemented using MCUs
• Often integrated into a larger mechanical or electrical system
• Usually has real-time constraints

Embedded
System

17 © 2021 Arm
MCU Hardware & Software for Concurrency
Peripheral Bus
• CPU executes instructions from one or more thread
of execution Timers
• Specialized hardware peripherals add dedicated
concurrent processing ADC
• Watchdog timer Cortex-M
• Analog interfacing Core
• Timers
Interrupt GPIO
• Communications with other devices
Controller
• Detecting external signal events
• LCD driver
UART
• Peripherals use interrupts to notify CPU of events

I2C

18 © 2021 Arm
Building embedded systems using MCUs
• In most embedded systems, MCUs are chosen to be the best solution, since they offer:
• Low development and manufacturing cost
• Easy porting and updating
• Light footprint
• Relatively low power consumption
• Satisfactory performance for low-end products

19 © 2021 Arm
What then is Microcontroller?
• A microcontroller is a small integrated circuit (IC) used for achieving specific
tasks in embedded systems (a mixture of hardware and software systems
for specific task and may exist within a larger system).
• A microcontroller will normally have a processor, memory and input or
output (I/O) peripherals on a chip.
• We can find microcontrollers in vehicles, robots, office machines, medical
devices, mobile radio transceivers, vending machines, home appliances etc.
• It is a key component of a measurement and control systems.
How does Microcontroller work?
• Microcontrollers send and receive data using their I/O
peripherals and process the data to perform the
designated task
How does Microcontroller work?
How does Microcontroller work?
GNG / ELG 5301 –Arduino Training
• For this course, we will be using Arduino Uno
Microcontroller.
• The whole essence is for our Arduino Microcontroller to
measure data from sensors in real life for control of specific
actions.
• All GNG/ELG 5301 students are required to have a basic
understanding of what Microcontrollers are, how they work,
and how to use them for measurement and control.
Why Arduino?
• Inexpensive
• Cross-platform (runs on Windows, Mac, Linux)
• Simple, clear programming environment
• Open source and extensible software
What is Arduino Microcontroller?
• Arduino is an open-source platform with easy-to-use hardware and
software capabilities.
Types of Arduino
Arduino Uno Microcontroller Board
Arduino Uno Microcontroller Specifications
Arduino Programming
• Has a programming environment called Arduino Integrated Development Environment
(IDE) written in Java
• Programs written in this environment are called ‘sketches’, and
• the language used is based on the Processing language with support for C and C++
programming languages.
• The basic sketch consists of at least two functions: a ‘setup’ and a ‘loop’
• The setup function performs any actions that are initially required to run the rest of the
• program, such as initializing any peripheral components and setting the communication
frequency between the Arduino board and PC.
• The loop function acts as the program’s driver; it runs in a continuous loop, and specifies
the order of operations that the microcontroller will perform.
• Based on the program, Arduino can control the microcontroller board as well as any
compatible hardware peripherals.
Examples of Arduino based applications.
S/N Applications Purpose Input Output Microcontroller
1 IoT-Based Data Logger for proposed an automatic The system includes The captured values Arduino
Weather Monitoring Using weather monitoring electronic devices, can then be sent to
Arduino-Based system that allows sensors, and wireless remote applications
Wireless Sensor Networks having dynamic and technology. or databases.
with Remote Graphical real-time climate data The main objective of Afterwards, the
Application and Alerts of a given area. this system is sensing the stored data can be
climate parameters, such visualized in
as temperature, graphics and tables
humidity, and existence form.
of some gases, based on
the sensors.
2 Measuring Mechanical Used hardware and Accelerometer EPICS IOC for Arduino
vibrations using an Arduino software systems for analysis
as a slave I/O to an EPICS measuring of
control system mechanical vibrations.
in the FREIA-laboratory
at Uppsala University.
Examples of Arduino based applications.
S/N Applications Purpose Input Output Microcontroller
3 Utilizing an Arduino-based To record and visualize By integrating visualize Arduino
accelerometer in civil engineering structural vibration these cards and structural
applications in undergraduate data in the process of sensors that are vibration data
education learning the best widely used for
practices of seismic vibration
safety measurement
4 Accelerometer-Based Hand For controlling a Robot Accelerometer Robotic Arduino
Gesture Control Robot Using sensors movement
Arduino and 3-Axis Accelerometer
5 ChemDuino: Adapting Arduino for For demonstration of Sensors Displays Arduino
Low-Cost Chemical measuring devices
Measurements in Lecture and (thermometers, pH
Laboratory meters, etc.), with
large enough displays
to be easily readable
from every point in the
classroom.
Illustration of an Arduino based application #5.
Questions?
Lab Hands On
• Online platform Lab Apparatus & Equipment
• www.tinkercad.com (circuits section)
• Physical platform Lab Apparatus & Equipment
• Arduino Uno
• Downloads
• Software -
https://www.arduino.cc/en/Main/Software
• Libraries -
• AFMotor.h - https://learn.adafruit.com/adafruit-
motor-shield/library-install
• NewPing.h -
https://bitbucket.org/teckel12/arduino-new-
ping/downloads/
Installing Arduino
libraries
• go to Sketch>Add .ZIP Library... and browse to downloaded
folder
• containing library to be added.
• For a more integrated (and permanent) option, move the folder
containing the library to the Arduino libraries folder in the
system files.
• For most windows users, the default pathway will be Program
Files
• (x86)>Arduino>libraries, but this can change with different
operating systems, different versions of windows, or if the
Arduino IDE was installed to a different location on the
computer.
• For both methods the Arduino IDE should be restarted for the
libraries to become useable.
• Adafruit.com has a useful tutorial on installing libraries that can
be found here: https://learn.adafruit.com/adafruit-all-about-
arduino-libraries-install-use
Hands-on Lab Part A:

LED Blink Program


Hands-on Lab Part
B:Sensor Reading

• This program uses ultrasonic


sensor.
• The data from the ultrasonic
sensor is used to calculate
distance.
• By using the formular Speed =
Distance / Time
• Speed =Speed of sound
considered at 347m/s
=0.347m/ms
• Time = PulseIn from the Echo Pin
when it is high (time between
sending the pulse and receiving
an echo)
• Distance = Speed*Time
Hands-on Lab Part
C:

• DC Motor Control
What Next ?–
Arduino
Based Project
Lists
References

1. Ahu Komec Mutlu, Ulgen Mert Tugsal, Ahmet Anil Dindar; Utilizing an
Arduino‐Based Accelerometer in Civil Engineering Applications in Undergraduate
Education. Seismological Research Letters 2021;; 93 (2A): 1037–1045. doi: https://doi-
org.proxy.bib.uottawa.ca/10.1785/0220210137
2. What is Microcontroller? | Learn About Microcontroller & How it Operates?
(educba.com)
3. J. Mabrouki, M. Azrour, D. Dhiba, Y. Farhaoui and S. E. Hajjaji, "IoT-based data
logger for weather monitoring using arduino-based wireless sensor networks with remote
graphical application and alerts," in Big Data Mining and Analytics, vol. 4, no. 1, pp. 25-32,
March 2021, doi: 10.26599/BDMA.2020.9020018.
4. (PDF) Role Of Arduino In Real World Applications | Dr. Kuldeep Singh Kaswan
Kaswan - Academia.edu
5. Varanis, M., Silva, A., Mereles, A. et al. MEMS accelerometers for mechanical
vibrations analysis: a comprehensive review with applications. J Braz. Soc. Mech. Sci. Eng.
40, 527 (2018). https://doi-org.proxy.bib.uottawa.ca/10.1007/s40430-018-1445-5
References
6. Hjort, A., & Holmberg, M. (2015). Measuring mechanical vibrations using Arduino
as a slave I/O to an EPICS control system.
7. J. Chem. Educ. 2015, 92, 10, 1751–1753, Publication Date:August 7, 2015,
https://doi.org/10.1021/ed5008102, Copyright © 2015 The American Chemical Society
and Division of Chemical Education, Inc.
8.https://www.researchgate.net/publication/323309093_Practical_implementation_of_IO
T_using_Arduino
9. https://docs.arduino.cc/learn/starting-guide/whats-arduino
10. 2.1: Basic Microcontroller Use for Measurement and Control - Engineering
LibreTexts
References
11. What is a Microcontroller and How Does it Work? (techtarget.com)
12. https://www.educba.com/what-is-microcontroller/
13. https://pubs-geoscienceworld-org.proxy.bib.uottawa.ca/georef/record/6/4848204/Utilizing-an-
Arduino-based-accelerometer-in-civil
14. https://www.educba.com/microprocessor-vs-microcontroller/
15. https://link-springer-com.proxy.bib.uottawa.ca/chapter/10.1007/978-981-16-6879-1_66
16. Arduino Lab Manual from CEED, uOttawa.
17. Arduino Uno Datasheet - [PDF Document] (vdocuments.net)
18. Introduction to embedded systems design slides developed by ARM and modified by Miodrag Bolic;
slides 4-9, 11,16-20, 24, and modified slide 29 by Olutayo Oladosu.
Questions?
Thank You

You might also like