What is Arduino?
Arduino is an open-source electronics platform based on easy-to-use
hardware and software. Arduino boards are able to read inputs -
a sensor, a finger on a button, or a Twitter message - and turn it into
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
Arduino programming language (based on Wiring), and the Arduino
Software (IDE), based on Processing.
Why Arduino?
There are many other microcontrollers and microcontroller platforms available for physical computing.
Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All
these tools take the messy details of microcontroller programming and wrap it up in an easy-to-use package.
Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for
students, and interested amateurs over other systems:
• Cross-platform
• Inexpensive
• Simple, clear programming environment
• Open source and extensible software
Installing Arduino IDE
•Download from:
[Link]/en/softwa
re
•Install IDE on
Windows/Mac/Linux.
•Connect board via USB
•Select Board: Tools >
Board > Arduino Uno
•Select Port: Tools > Port
Serial Peripheral Interface (SPI)
With an SPI connection there is always one Controller device (usually a microcontroller) which controls the
peripheral devices. Typically there are three lines common to all the devices:
•CIPO (Controller In Peripheral Out) - The Peripheral line for sending data to the Controller
•COPI (Controller Out Peripheral In) - The Controller line for sending data to the peripherals
•SCK (Serial Clock) - The clock pulses which synchronize data transmission generated by the Controller and
one line specific for every device.
•CS (Chip Select) - the pin on each device that the Controller can use to enable and disable specific devices.
When a device's Chip Select pin is low, it communicates with the Controller. When it's high, it ignores the
Controller. This allows you to have multiple SPI devices sharing the same CIPO, COPI, and SCK lines.
Generally speaking, there are four modes of transmission. These modes control whether data is shifted
in and out on the rising or falling edge of the data clock signal (called the clock phase), and whether the
clock is idle when high or low (called the clock polarity). The four modes combine polarity and phase
according to this table:
Clock Polarity Clock Phase
Mode Output Edge Data Capture
(CPOL) (CPHA)
SPI_MODE0 0 0 Falling Rising
SPI_MODE1 0 1 Rising Falling
SPI_MODE2 1 0 Rising Falling
SPI_MODE3 1 1 Falling Rising
Inter-Integrated Circuit (I2C) Protocol
•I2C = Inter-Integrated Circuit, uses two wires:
SDA (Data) and SCL (Clock)
•Allows one controller (Arduino) to communicate with multiple devices
•Each device has a unique address for identification
•Efficient wiring: Many devices, only two wires
•Commonly used for sensors, OLED displays, RTC, etc. •The controller sends out instructions through
the I2C bus on the data pin (SDA), and the
instructions are prefaced with the address, so
that only the correct device listens.
•Then there is a bit signifying whether the
controller wants to read or write.
•Every message needs to be acknowledged, to
combat unexpected results, once the receiver
has acknowledged the previous information it
lets the controller know, so it can move on to the
next set of bits.
•8 bits of data
•Another acknowledgement bit
•8 bits of data
•Another acknowledgement bit
Universal Asynchronous Receiver
Transmitter (UART)
• UART is one of the most used
device-to-device (serial)
communication protocols. It’s the
protocol used by Arduino boards to
communicate with the computer.
• The default TX/RX pins on an
Arduino board are the D0(RX) and
D1(TX) pins.
How UART Works
Timing and Synchronization
Baud Rate
Frame Format
Start Bit
Data Bits
Character Size
Parity
Stop Bits