Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

What is Arduino?

I2C, SPI, UART


I2C (Inter-Integrated Circuit)
• I2C is a two-wire communication protocol used for • Suppose you are designing a weather station
connecting multiple low-speed peripherals to a with Arduino. You need to connect multiple
microcontroller. The two wires are SDA (Serial Data sensors like a temperature sensor, humidity
Line) and SCL (Serial Clock Line). sensor, and a barometric pressure sensor to
• It's a multi-master, multi-slave, packet-switched, the Arduino. These sensors can easily
single-ended, serial communication bus. This communicate with the Arduino using the I2C
means multiple devices (masters and slaves) can protocol.
be connected to the same bus, and communication
occurs in a serial format where data packets are • In this setup, Arduino acts as the master,
switched between different devices. initiating communication with the sensors
• Each device connected to the bus is addressed (slaves), each having a unique address. The
through a unique address. The master device, SDA line is used for transmitting data, while
usually your Arduino, initiates and terminates the the SCL line synchronizes the communication.
data transfer, controls the clock line, and can You can connect all these sensors using only
communicate with any slave on the bus. two wires (apart from power and ground),
which simplifies wiring and conserves GPIO
pins on the Arduino.
SPI (Serial Peripheral Interface)
• SPI is a synchronous serial communication • Consider a project where you need to display
interface used for short-distance communication, data or images quickly, like an interactive
primarily in embedded systems. It operates in full game on an Arduino with a TFT display. The
duplex, meaning it can transmit and receive data SPI protocol is ideal for this.
simultaneously.
• It typically uses four lines: MOSI (Master Out Slave
• In this scenario, Arduino is the master, and
In), MISO (Master In Slave Out), SCK (Serial Clock), the TFT display is the slave. The MOSI line
and SS (Slave Select). MOSI and MISO are data sends data from Arduino to the display, MISO
lines, SCK provides the clock generated by the is used if the display has to send data back,
master, and SS is used by the master to select and SCK provides a clock signal to synchronize the
control individual slave devices. data transfer, and SS selects the TFT display
• SPI is faster than I2C and is often used for devices among potentially multiple SPI devices. Due
that require high-speed data transfer, like SD cards to SPI's high data transfer rate, it's great for
or TFT displays. applications requiring fast and efficient
communication.
Serial (UART):
• Serial communication in Arduino usually • A common application is Arduino
refers to UART (Universal Asynchronous communicating with a computer for data
Receiver/Transmitter) communication. It's a logging or control. Here, UART
protocol for two-way data transfer between communication is used.
devices. • The Arduino transmits data using its TX pin,
• It involves two pins: RX (Receive) and TX which is received by the RX pin of the
(Transmit). Data transmitted through TX of computer's serial port (or a USB-to-serial
one device is received by the RX of another, adapter). Conversely, data sent from the
and vice versa. computer's TX pin is received by the Arduino's
• UART communication is asynchronous, RX pin. This asynchronous communication
meaning there is no shared clock signal allows for easy data exchange between the
between the sender and receiver. Data bits, Arduino and the computer, without the need
start bits, stop bits, and optionally parity bits for a shared clock signal. It's useful for
are used to ensure proper data transmission. sending sensor data to the computer for
analysis or receiving commands from the
computer to control various devices
connected to the Arduino.

You might also like