#arduino #sensors #intersface #automation

Dibyanshu Kumar Oct 18 2020 · 3 min read
Share this

Arduino is an open source hardware-software development board that is used to design and build devices that interact with the real world. Arduino actually refers to a company which manufactures a specific implementation of these boards.

You can tell your Arduino boards what to do by sending the set of instructions to the microcontroller on the board using Arduino programming language (wiring based) and the Arduino Software (IDE) based on processing. These are able to read inputs such as light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online.

Why use Arduino?

The Arduino software is-easy-to use for beginners, yet flexible enough for advanced users. It can run on Mac, Windows, and on Linux. Anyone - children, hobbyists, artists, programmers - can start tinkering just following the step by step instructions of a kit, or sharing ideas online with other members of the Arduino community. There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handy board, and many others offer similar functionality. Some of its advantages over other systems are:

  • Inexpensive
  • Cross-platform
  • Simple, clear programming environment
  • Open source and extensible software
  • Open source and extensible hardware
  • You can also build an Arduino for yourself or for selling. Although it is allowed to build and sell cloned Arduino boards, it’s not allowed to use the name Arduino and the corresponding logo.

    Arduino Boards

    What is an Arduino board made up of?

    Although its design varies from one version to another but it mainly consists of:

    Power connector

    which work is to provide power to the device itself, and provides a low voltage which can be used in powering low voltage requiring devices. It can be connected to an AC adapter or a small battery.


    the primary chip, which allows you to program the Arduino in order for it to be able to execute commands and make decisions based on various input. With every type of Arduino, the exact chip being used differs but they are generally Atmel controllers, usually a ATmega8, ATmega168, ATmega328, ATmega1280, or ATmega2560. The biggest difference between these is the different amounts of onboard memory.

    Serial connector

    which on most newer boards now are implemented through a standard USB port. This connector allows the communication to the board from the computer, also to load new programs onto the device. Many times, these USB ports are used to give power to the board.


    used to establish a connection with various components that are to be used with the Arduino:

  • Digital pins, which can read and write a single state, on or off.
  • Analog pins, which can read a range of values, and are useful for more fine-grained control
  • Popular Arduino Board

    Arduino UNO

  • Most popular board. Ideal for starters
  • Standard USB for data and power and programming
  • Power Input connector
  • female headers
  • 14 digital I/O ports (of which 6 PWM)
  • 6 analog input ports
  • 1 hardware serial port (UART)
  • Arduino UNO board
    PIN configuration

    Arduino Nano

  • Much smaller than the UNO (only 18x43 mm)
  • Mini USB for data and power and programming
  • Input 6-20 V on Vinn (6-12 recommended)
  • Male headers at the bottom side, so ideal to use on a solder less breadboard
  • 14 digital I/O ports (of which 6 PWM)
  • 8 analog input ports.
  • Arduino Nano board
    PIN configuration
    Microcontroller Atmega328
    Operating Voltage 7-12 V recommended, 6-20 V limits
    Digital I/O pins 14 (of which 6 PWM)
    Analog input pins 8
    DC current per I/O pin 40 mA
    DC current for 3.3V pin 50 mA
    Flash memory 32 KB
    FTDI USB to TTL serial  FTDI FT232RL
    UART  1
    Pin No. Name Type Description
    1-2, 5-16 D0 - D13 I/O Digital input/output port 0-13
    3, 28 RESET INPUT Reset (Active Low)
    4, 29 GND PWR Supply ground
    17 3V3 OUTPUT +3.3 V Output (from FTDI)
    18 AREF INPUT ADC Reference
    19-26 A7 - A0 INPUT Analog Input Channel 0 - 7
    27 +5V Output/Input +5V output (from onboard regulator) or +5V output(input from external power supply)
    30 VIN PWR Supply voltage

    Arduino Mega

  • Largest Arduino board for large number of I/O ports
  • Normal size USD for data and power and programming
  • Power input connector
  • Input 6-20 V (7-12 recommended)
  • Female headers at the top side
  • 54 digital I/O ports (of which 15 PWM)
  • 16 analog input ports
  • 4 serial ports
  • Arduino Mega board
    PIN configuration
    * * *

    IDE used for Arduino programming – Sketch

    Structure of Arduino program

    Arduino programs can be divided in three main parts: Structure, Values (variables and constants), and Functions

    Structure - Software structure consist of two main functions

  • Setup() function
  • loop() function
  • void setup()

    void loop()


    Purpose of using setup() function

    The setup() function is called when a sketch starts. Use it to initialize the variables, pin modes, start using libraries, etc. The setup function will only run once, after each power up or reset of the Arduino board.

    Purpose of using loop() function

    After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board.

    What is delay and use of delay function?

    delay function is used to suspend execution of a program for a particular time .

    How to write our own delay function for 1 sec delay?

    Note: Keep both the files in same directory

    void delay_ms(unsigned int ms)
    unsigned char i;
    Read next