Arduino Pins and Components Explained
1. RX (Receive) and TX (Transmit) Pins
RX and TX are used for serial communication between Arduino and other devices.
- RX: Receives data.
- TX: Transmits data.
Use Case: Connect Arduino to a computer or other microcontroller for data transfer via
UART.
2. ICSP (In-Circuit Serial Programming)
ICSP is a 6-pin header used to program the Arduino's microcontroller directly using an
external programmer.
Pins:
- MOSI (Master Out Slave In)
- MISO (Master In Slave Out)
- SCK (Serial Clock)
- Reset
- VCC
- GND
Use Case: Reprogram the bootloader or update the firmware.
3. PWM (Pulse Width Modulation) Pins
PWM pins generate analog-like signals by modulating the width of digital pulses.
Pins: Marked with a "~" symbol (e.g., ~3, ~5, ~6, ~9, ~10, ~11 on Arduino Uno).
Use Case: Control brightness of LEDs, speed of motors, or servos.
4. Analog Reference Pin (AREF)
Provides a reference voltage for the analog-to-digital converter (ADC).
Use Case: Improve ADC accuracy when using external sensors with a specific voltage
range.
5. Reset Button
Resets the microcontroller, restarting the program from the beginning.
Use Case: Useful during debugging or to restart the program manually.
6. GND (Ground)
Acts as the reference point for the circuit and completes the circuit.
Use Case: All components in a circuit should connect their GND to Arduino's GND.
7. ATmega16U2 (16 MHz)
Acts as a USB-to-serial converter on Arduino Uno.
- Clock Speed: 16 MHz.
Use Case: Enables communication between the Arduino and a computer via USB.
8. USB Protection
Protects the board from overcurrent or short circuits through the USB connection.
- Component: Usually a polyfuse that resets itself after removing the fault.
9. Voltage Regulator
Converts higher input voltage (e.g., 12V) to a stable 5V or 3.3V for Arduino and
connected components.
Use Case: Allows safe power supply to the board.
10. Input Voltage Comparator and Selector
Detects whether the Arduino is powered via USB or an external power source and
switches accordingly.
Use Case: Ensures uninterrupted power supply without user intervention.
11. IOREF Pin
Provides the voltage reference used by the Arduino (e.g., 5V or 3.3V).
Use Case: Shields can use this pin to adapt to the board's voltage.
12. Reset Pin
Resets the microcontroller just like the reset button.
Use Case: External devices or shields can trigger a reset.
13. Voltage Input (VIN)
Used to supply power to Arduino when not connected to USB.
Use Case: Connect a power source (7–12V recommended) to power the Arduino.
14. Analog Pins
Used to read analog signals (e.g., from sensors).
Pins: Typically labeled A0 to A5 on Arduino Uno.
Use Case: Measure varying voltage levels, such as temperature or light intensity.
15. ATmega328P (16 MHz)
Main microcontroller on the Arduino Uno.
- Clock Speed: 16 MHz.
- Features: 32 KB flash memory, 2 KB SRAM, 1 KB EEPROM.
Use Case: Executes the Arduino program and handles input/output operations.
MOSI (Master Out, Slave In)
Definition
MOSI is a pin used in SPI (Serial Peripheral Interface) communication, which is a
protocol for high-speed, synchronous data transfer between devices.
Purpose
The MOSI pin is responsible for transmitting data from the master device to the slave
device in an SPI communication setup.
SPI Connections
In an SPI connection, the following pins are typically used:
1. MOSI (Master Out Slave In): Data from the master to the slave.
2. MISO (Master In Slave Out): Data from the slave to the master.
3. SCK (Serial Clock): Synchronization clock signal from the master.
4. SS (Slave Select): Selects which slave device is active.
Use Case Example
If you have an SPI-based OLED display:
The Arduino sends display data via the MOSI pin.
The data updates the pixels on the screen.
SDA (Serial Data Line)
Definition
SDA is a pin used in I2C (Inter-Integrated Circuit) communication, a protocol for
synchronous, multi-device data exchange. It handles the data transfer between devices.
Purpose
The SDA pin is responsible for transmitting and receiving data between the master and
slave devices in an I2C setup.
I2C Addressing
Each device on the I2C bus has a unique 7-bit address (sometimes 10-bit). The master
uses this address to communicate with the specific slave.
Use Case Example
When using an I2C-based temperature sensor (e.g., BMP280):
The Arduino sends commands to the sensor via the SDA line.
The sensor sends temperature data back via the SDA line, synchronized with the
clock on the SCL line.
Advantages of I2C (and SDA)
1. Multi-Device Capability: Connect multiple devices to the same SDA and SCL
lines.
2. Two Wires Only: Reduces wiring complexity compared to SPI.
3. Bi-Directional Communication: Enables both sending and receiving data over
the same wire.