Lec2 Arduino Landscape
Lec2 Arduino Landscape
CSE 3105
Computer Interfacing & Embedded System
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.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping, aimed at students
without a background in electronics and programming.
Introduction
Why Arduino?
Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The
least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled
Arduino modules cost less than \$50
Open source and extensible software - The Arduino software is published as open source tools,
available for extension by experienced programmers. The language can be expanded through C++
libraries, and people wanting to understand the technical details can make the leap from Arduino to the
AVR C programming language on which it's based.
Arduino Uno Components
Functionality:
Microcontroller: At the heart of
every Arduino is a
microcontroller. This is the
brain of your Arduino.
Programming: Programming
interfaces enable you to load
software onto your Arduino.
I/O: Input/Output (I/O) circuitry
is what enables your Arduino
interface with sensors,
actuators, etc.
Power: There are a variety of
ways to supply power to an
Arduino. Most Arduino boards
can automatically switch
between power from multiple
sources (such as USB and a
battery).
Blue Pill Components
STM32 is a family of 32-bit
microcontroller integrated circuits
by STMicroelectronics. The
STM32 chips are grouped into
related series that are based
around the same 32-bit ARM
processor core.
These boards typically provide features such as power regulation, clock circuitry,
input/output pins, communication interfaces (e.g., USB, UART, SPI, I2C), and
sometimes built-in sensors or LEDs.
Popular examples of microcontroller boards include the Arduino Uno, STM32 Blue
Pill, and Raspberry Pi.
Microcontroller
Architecture: The architecture of a microcontroller refers to its internal design and
organization of components, including the CPU (Central Processing Unit), memory,
peripherals, and input/output interfaces.
Word Size: It represents the size of the binary data that the microcontroller’s CPU
can process or manipulate in a single instruction cycle. It also represents size of all
addresses, integers, and other key data types.
For example, an 8-bit microcontroller architecture processes data in chunks of 8
bits at a time. Maximum size of addresses or data type is also 8 bit.
Flash Memory: Flash memory is non-volatile memory used for storing program
code (firmware) and data in a microcontroller. It retains its data even when power
is removed from the microcontroller and is typically used to store the
microcontroller's firmware.
RAM: RAM (Random Access Memory) is volatile memory used for temporary
storage of data and variables during program execution.
Arduino Uno Diagram
[Link
]
ATMega328P
[Link
]
328P =
‘32’ means 32 kByte of Flash or
Program Memory (Code Space).
‘8’ means 8 bit architecture.
‘P’ stands for ‘picopower’; lower
power consumption.
ATMega328P
Pin Pin Description Secondary Function 10 PB7 Pin7 of XTAL2 (Chip Clock Oscillator pin 2)
No. name (XTAL2/TO PORTB TOSC2 (Timer Oscillator pin 2)
SC2)
1 PC6 Pin6 of PORT Pin by default is used as RESET pin.
(RESET) C PC6 can only be used as I/O pin when 11 PD5 Pin5 of T1(Timer1 External Counter Input)
RSTDISBL Fuse is programmed. (T1/OC0B) PORT D
OC0B(PWM - Timer/Counter0 Output
2 PD0 Pin0 of PORT RXD (Data Input Pin for USART) Compare Match B Output)
(RXD) D USART Serial Communication
12 PD6 Pin6 of AIN0(Analog Comparator Positive I/P)
Interface
(AIN0/OC0 PORTD
[Can be used for programming]
A) OC0A(PWM - Timer/Counter0 Output
Compare Match A Output)
3 PD1 Pin1 of PORT TXD (Data Output Pin for USART)
(TXD) D USART Serial Communication
Interface 13 PD7 (AIN1) Pin7 of AIN1(Analog Comparator Negative I/P)
[Can be used for programming] PORTD
INT2( External Interrupt 2 Input) 14 PB0 Pin0 of ICP1(Timer/Counter1 Input Capture Pin)
(ICP1/CLKO PORTB
4 PD2 Pin2 of PORT External Interrupt source 0 ) CLKO (Divided System Clock. The divided
(INT0) D system clock can be output on the PB0
pin)
5 PD3 Pin3 of PORT External Interrupt source1
15 PB1 Pin1 of OC1A (Timer/Counter1 Output Compare
(INT1/OC D
(OC1A) PORTB Match A Output)
2B) OC2B(PWM - Timer/Counter2 Output
Compare Match B Output) 16 PB2 Pin2 of SS (SPI Slave Select Input). This pin is low
(SS/OC1B) PORTB when controller acts as slave.
6 PD4 Pin4 of PORT T0( Timer0 External Counter Input) [Serial Peripheral Interface (SPI) for
(XCK/T0) D XCK ( USART External Clock I/O) programming]
1. Barrel Jack
2. VIN Pin
3. USB cable
4. 5v and 3v3
5. GND
6. RESET
7. IOREF
Power Supply
1. Barrel Jack
2. VIN Pin
3. USB cable [Link
]
1. Barrel Jack
2. VIN Pin
3. USB cable [Link
]
1. Barrel Jack
2. VIN Pin
[Link
3. USB cable ]
4. 5v and 3v3
5. GND
6. RESET
7. IOREF
They provide regulated 5v and 3.3v
to power external components.
Power Supply
4. 5v and 3v3
5. GND
6. RESET
7. IOREF
You can find 5 GND pins, which are
all interconnected. The GND pins are
used to close the electrical circuit
and provide a common logic
reference level throughout your
circuit. Always make sure that all
GNDs are connected to one another
and have a common ground
Power Supply
4. 5v and 3v3
5. GND
6. RESET
7. IOREF
Resets the Arduino.
Power Supply
4. 5v and 3v3
5. GND
6. RESET
7. IOREF
This pin is the input/output
reference. It provides the voltage
reference with which the
microcontroller operates.
Power Supply
[Link
]
Serial Communication
UART (Universal Asynchronous Receiver/Transmitter)
[Link]
A universal asynchronous receiver/transmitter (UART) is a block of circuitry responsible for
implementing serial communication. Essentially, the UART acts as an intermediary between
parallel and serial interfaces. On one end of the UART is a bus of eight-or-so data lines (plus
some control pins), on the other is the two serial wires - RX and TX.
Serial Communication
SPI (Serial Peripheral Interface)
[Link] MISO ->
Serial Peripheral Interface (SPI) is an interface bus commonly
used to send data between microcontrollers and small
POCI
peripherals such as shift registers, sensors, and SD cards. It uses MOSI ->
separate clock and data lines, along with a select line to choose
the device you wish to talk to. PICO
SS -> CS
Serial Communication
I2C (Inter-Integrated Circuit)
The Inter-Integrated Circuit (I2C) Protocol is a protocol intended to allow multiple "peripheral" digital integrated circuits ("chips") to
communicate with one or more "controller" chips.
▪ Industrial
Automation
Systems
▪ 3D Printer
Controller
▪ Unmanned
Aerial
Vehicles
(UAVs)
▪ High-
Fidelity
Motor
Control
▪ Internet of
[Link
] Things (IoT)
Arduino Uno vs STM32 Blue Pill