Let’s get started with Arduino!

Posted on Posted in elecProjects

Arduino is an open-source electronic prototyping platform that is used to create microcontroller based projects using various sensors and displaying the required output. Arduino consists of both a physical programmable circuit board i.e. a microcontroller and software or IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board.

But what is open-source software? It is software with source code that anyone can inspect, modify, and enhance and get the required results.

Arduino is the best platform for beginners in electronics because unlike previous circuit boards which require a separate piece of hardware (called a programmer) in order to load new code onto the board, Arduino requires only USB cable. Apart from that Arduino IDE uses a simplified version of C and C++ and once you understand how to write it, it will be pretty easy for you.

Arduino hardware and software can interact with LED, motor, LCD, camera, buttons, internet, Bluetooth and what not! It is a very flexible platform and allows you to make cool projects easily and at a very low cost. Well, a bit costlier than analog circuit projects. 😛

Arduino Uno is the most popular board in Arduino family. In this tutorial, we will discuss Uno and the rest of the boards in the family are not that different.

So what’s on the board?

uno

  1. Microcontroller (rectangular black piece of hardware): It is the brain of Arduino. Arduino boards consist of Atmel 8-, 16- or 32-bit AVR microcontroller. Uno uses Atmega328PPU. It is important to know the microcontroller IC type (along with your board type) before loading up a new program from the Arduino software.
  1. Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF): The pins on your Arduino are the places where you connect wires to construct a circuit.

    GND
    : Short for ‘Ground’. There are several GND pins on the Arduino, any of which can be used to ground your circuit.
    5V & 3.3V: 5V pin supplies 5 volts of power and the 3.3V pin supplies 3.3 volts of power.

    Analog (in green rectangular box): Pins labeled A0 through A5 on the UNO are Analog Input pins. These pins can read the signal from an analog sensor (like a temperature/pressure sensor) and convert it into a digital value that we can read.
    Digital (in red rectangular box): Pins labeled 0 through 13 on the UNO are the digital pins. These pins can be used for digital input (like telling if a button is pushed) and digital output (like powering a LED).
    PWM: You may have noticed the tilde (~) next to some of the digital pins (3, 5, 6, 9, 10, and 11 on the UNO). These digital pins can also be used to generate Pulse-Width Modulation (PWM) i.e. to simulate analog output (like fading a LED in and out).
    AREF: It stands for Analog Reference. Most of the time you can leave this pin alone. It is sometimes used to set an external reference voltage (between 0 and 5 Volts) as the upper limit for the analog input pins (for analog-to-digital converter).
  1. Power (USB/Barrel Jack): The boards can be powered from the computer using USB port or from AC main using 12V-2A (recommended) adapter by connecting it to barrel jack.
    Do NOT use a power supply greater than 20 Volts as you will overpower (and thereby destroy) the Arduino. The recommended voltage for most Arduino models is between 6 and 12 Volts.
  1. Voltage regulator (in pink rectangular box): The function of the voltage regulator is to control the voltage given to the Arduino board and stabilize the DC voltages used by the processor and other elements.
  2. Crystal Oscillator (in orange rectangular box): The crystal oscillator helps Arduino in dealing with time issues. How does Arduino calculate time? The answer is, by using the crystal oscillator. The number printed on top of the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000 Hertz or 16 MHz.
  3. Reset: You can reset the UNO board in two ways. First, by using the reset button (in purple rectangular box) on the board. Second, you can connect an external reset button to the Arduino pin labeled RESET.
  4. LED indicators (in light blue rectangular boxes): There are 4 LED indicators: Power LED (ON) should light up when you plug Arduino into a power source to indicate that your board is powered up correctly. If this light does not turn on, then there is something wrong with the connection. There is another indicator situated just beside digital pin 13 (indicated as L) that should blink about 5 times whenever power source is connected. If it does not blink, then microcontroller might not be properly connected with the board or worst case, there is a problem with the board itself.
    On the board, you will find two labels: TX (transmit) and RX (receive). They appear in two places on the Arduino UNO board. First, at the digital pins 0 and 1, to indicate the pins responsible for serial communication. Second, the TX and RX LED. The TX LED flashes with different speed while sending the serial data. The speed of flashing depends on the baud rate used by the board. RX flashes during the receiving process (baud: bits per second).pindetails
  5. ICSP (in yellow rectangular box): In-Circuit Serial Programming is an AVR, a tiny programming header for the Arduino consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an SPI (Serial Peripheral Interface).It is used in boot-loading and SPI communication.

    Bootloading: Arduino has put a .hex file on their AVR chips that allows you to program the board over the serial port, meaning all you need to program your Arduino is a USB cable. The bootloader is basically a .hex file that runs when you turn on the board.

    It is very similar to the BIOS that run on your PC. It looks around to see if the computer is trying to program it. If it is, it grabs the program from the computer and uploads it into the ICs memory (in a specific location so as not to overwrite the bootloader). That is why when you try to upload code, the Arduino IDE resets the chip. This basically turns the IC off and back on again so the bootloader can start running again. If the computer isn’t trying to upload code, it tells the chip to run the code that’s already stored in memory. Once it locates and runs your program, the Arduino continuously loops through the program and does so as long as the board has power. Currently, optiboot bootloader is the default bootloader installed on Arduino UNO.SPI: Serial Peripheral Interface is a full duplex system for serial communication which means data can be sent and received simultaneously. It’s maximum baud rate > I2C. Four modes of operation in SPI:

    Mode 0: CPOL=0, CPHA=0
    Mode 1: CPOL=0, CPHA=1
    Mode 2: CPOL=1, CPHA=0
    Mode 3: CPOL=1, CPHA=1

    MISO (Master In Slave Out) – The Slave line for sending data to the master.
    MOSI (Master Out Slave In) – The Master line for sending data to the peripherals.

    I2C: Inter-Integrated Circuit is used when the distance between Microcontroller and specialized ICs is short. The connection is established via two conductors- one for data transfer and the other one for synchronization. The I2C bus consists of SCL (Serial CLock) and SDA (Serial DAta).

Phew, that was something! I hope you have liked this tutorial and in the next section, we will discuss Arduino IDE, how to write your first code and other Arduino boards and Shields briefly. 🙂

Spread it!

Leave a Reply