2arduino Intro
2arduino Intro
- Atmel ATmega328P
- The brain of the Arduino UNO
- Microcontroller is different than microprocessor. In microcontroller, there are lots of digital
input and output pins.
- Using a digital input/output pin, the microcontroller can read or change the state of an
external device like a button or a LED.
- Microcontroller has much less memory, less capable of doing general things such as
running a game.
- Atmel ATmega16U2
- Implements the USB
serial interface
- Specifically controls the
communication between
the computer and
Arduino.
Long header
Short header
Shield
Ethernet shield of
Arduino Uno
- Pins are numbered according the their functions.
- There are 14 digital input/output pins.
- SCL, SDA, AREF, TX and RX pins are dedicated for communication
with external devices such as sensors or other Arduino boards.
- A few pins are dedicated to power.
- 6 pins are dedicated for the Analog inputs.
USB connection socket
External power socket, this connector gives you the ability to detach
your Arduino from your computer. But be careful to connect a power
source with the appropriate voltage.
Voltage regulator:
7-12 V is recommended for the input voltage.
6-20 V is the absolute limit for the input voltage.
If you have around 15 V power source, you will have a lot of wasted
power on the voltage regulator and will result in heat.
In-Circuit Serial Programming (ICSP) headers:
You can program your microcontrollers using these headers.
In this course, we will not use ICSP, and instead, we will use Arduino IDE.
Reset button:
Executes the
program from
the beginning.
Crystal clock:
Calibrated to beat 16 million times in a second (16 MHz).
- Every microcontroller just like every microprocessor needs a clock to
operate.
- At every clock tick, the microcontroller will execute the next instruction.
- In real world, we have infinitely many ‘words’. For example, the light can be bright, very
bright, low, vs. (infinitely many physical values in between).
- In digital system, there is only 1 and 0, which are symbolic. 1 represent a real value (a
voltage level of 5V for Arduino), 0 represent 0V.
- An output. The Arduino can change the state of a LED by changing the voltage of the digital
pin where the LED is connected.
Pin 7 LED
HIGH ON
LOW OFF
- Digital Input
- The button’s state is changed by the user by pressing it, Not the Arduino. The Arduino
reads the button’s state so that it can determine whether it is pressed or not pressed.
- Hanging/floating: When button is up, pin 5
can not be defined by a particular value. It is
undeterminable.
Button Pin 5
UP HIGH
DOWN LOW
- Analog Output
- Pulse width modulation (PWM)
- Imagine that instead of a LED being ON constantly, it is turned ON then OFF then ON very
quickly.
- The digital pins with ‘Tilda ( ̴)’ are PWM pins and can be used as Analog output.
- Analog Input