✨ DOWNLOAD OUR APP - Use RCAPP
for additional 5% discount! + Redeem RC COINS 👇
Skip to content
All the orders confirmed after 3pm on 3rd March will only be shipped on 5th March. Store Pick-Up orders to be collected on 5th March 2026

ARDUINO - BRIEF ON SOFTWARE AND HARDWARE

What is Arduino?

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It can be programmed to execute commands and make decisions based on various inputs. Arduino comes in several variants such as Nano, Uno, and Mega. They generally use Atmel controllers like ATmega8, ATmega168, ATmega328, ATmega1280, or ATmega2560.

Here, we will talk about the Arduino Nano, which uses an ATmega328p.

ARDUINO NANO HARDWARE

Talking about Arduino nano, we have various analogue, digital, and communication pins for Arduino programming. Some significant pins and their multiple functionalities are listed below.

Digital Pins

There are a total of 14 digital pins (PINs -  1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, and 16) which can work with a maximum voltage of 5v(1) and a minimum voltage of 0v(0). Any voltage provided is fixed between these two levels of operation.

Analog Pins

Nano has eight analog pins numbered from A0 to A7. Each of these analog pins has a built-in ADC (Analog to Digital Converter) of bits resolution.

Serial Communication Pins-

The two serial communication pins, RX- receive and TX- transmit, are used for TTL serial data communication. The pins are connected to the pins of the USB-to-TTL Serial chip.

PWM (Pulse Width Modulation) Pins-

Pulse Width Modulation, or PWM, is used for getting analog results with digital means. Every one of these digital pins can generate a PWM signal of a specified resolution (of some bits). The PWM pin generates the PWM signal with the help ‘analogWrite()’ function. There are 5 PWM pins in nano (pins - 6, 8, 9, 12, 13, and 14).

I2C-

Pins 23, 24 as A4 and A5 are the I2C pins. It uses the I2C protocol for long-distance communication. It has two wires, one for the clock and another for data.

RESET-

Reset pins in Arduino are active LOW pins, which means if we make this pin value as LOW, i.e., 0v, it will reset the controller. Pin 28 is the reset pin in nano.

Other Pins-

3.3V: This pin outputs 3.3V.

5V: This pin outputs 5V.

GND (Ground pins): There are five ground pins on the board, i.e., considered to have a potential of 0V.

REF: It provides the voltage reference at which the microcontroller is operating.

 

ARDUINO SOFTWARE

Arduino supports a language known as the Arduino Programming Language or Arduino Language in general. When working with Arduino, we commonly use the Arduino IDE, which gives us two advantages:

  • It is an editor with library support and a compiler.
  • It uploads our program to the Arduino Board.

The Arduino Programming Language is an open framework for microcontrollers. The Arduino Programming Language Also has built-in libraries that allow to easy integration of various functionalities provided by the Arduino board.

The Arduino IDE is the text editor used for Arduino programming. It is where you can add the program (also called a sketch) to be executed through an Arduino board by uploading the program to the board.

Arduino Programming

Here's a quick look at how to get started with Arduino programming.

A sketch always contains two functions-

setup():

As the name states, it is used to set up the board. It executes all the code inside it once. setup() is used for setting up modes of pins and setting up the serial monitor.

loop():

It contains the body of the program. Everything that’s inside this function is repeated or looped continuously.

 

Now, let us jump on to some basic functions of Arduino, which we use often:

pinMode(pin,mode) :

This function is used to set the pin specified to behave as Input or Output.

Example – pinMode(3,INPUT) reads digital pin 3 as an input pin.

 

digitalRead(digital_pin) :

This function is used to read the digital signal from the specified.

Example - digitalRead(5) reads value on pin 5.

 

digitalWrite(pin,value) :

This function is used to write a HIGH or a LOW value to a digital pin.

Example - digitalWrite(4, HIGH) makes the pin 4 HIGH.

analogRead(analog_pin)

This function is used to read the analog signal from an analog pin and returns an integer in the range of 0 to 1023.

Example - analogRead(A3) reads the value on analog pin A3.

analogWrite(pin,value)

Value can be a number between 0 and 255.Example- analogWrite(3, 128) generates a PWM wave of 50% duty cycle on pin 3.

delay()

This function pauses the execution of the program for the mentioned amount of time. It accepts input in milliseconds, so for a value of 2000, it will wait for 2secs before the execution of the next line.

OBSTACLE SENSOR WITH ARDUINO

The following program explains the working of an IR Led and glow of led with a variable distance of the obstacle from the IR Led with the help of photodiode.

Components Used-

  • Basic Red LED (5mm)
  • Infrared Led (550nm)
  • Photodiode
  • Arduino Nano
  • 220-ohm Resistor (with Red LED)
  • 470-ohm Resistor(with Infrared LED)
  • 10k ohm Resistor (with Photodiode)

Code:

int RedLed=5;

Int PhotoDiode=4;              

int senPin=A0; // to read value of sensor                

int thresValue=400; // threshold value                

void setup()  

{

 pinMode(PhotoDiode,OUTPUT);

 pinMode(RedLed,OUTPUT);

 pinMode(senPin,INPUT);

 digitalWrite(RedLed, LOW);

 digitalWrite(PhotoDiode,HIGH); // can also use 1 instead of HIGH and 0 instead of LOW      

}

void loop()

{

 int value=analogRead(senPin);          

 if(value <= thresValue)              

 {

  digitalWrite(RedLed,HIGH); //Red LED Glows    

  delay(20);

 }

 else if(value > thresValue)          

 {

  digitalWrite(RedLed,LOW);  //Red LED doesn’t glow

  delay(20);

 }

}

 

EXPLANATION-

This is a real-life based simulation that is a part of the Line-Following Bot. The photodiode receives reflected infrared light from the IR sensor which is read by the analog pin. The red LEDs glow or not depending on the threshold value set (thresValue), i.e., depending on whether the obstacle is close or far away.

NOTE- The amount of light reflected not only depends on the closeness of the obstacle but also the color of the obstacle i.e., a white obstacle reflects more light compared to a black obstacle.

This blog has been submitted by Cyborg, NIT Rourkela under the Robocraze Club Outreach Program.

Author - Jagdish

Excerpt

Learn Arduino basics with a clear overview of its software and hardware. Understand boards, controllers, and how Arduino works for electronics projects.

Frequently Asked Questions

1. What is Arduino?

Arduino is an open-source electronics platform that enables users to create interactive projects. It comprises both hardware, like microcontroller boards, and software, like the Arduino IDE. With its user-friendly environment, Arduino is perfect for beginners and experts alike, allowing for easy prototyping and experimentation in electronics and robotics.

2. What are the types of Arduino boards?

Arduino offers various board types, including the Arduino Uno, Mega, Nano, and Leonardo. Each board caters to different project needs, whether it's small-scale applications or complex systems requiring more inputs and processing power. Selecting the right board is essential for optimal performance in your projects.

3. What microcontrollers do Arduino boards use?

Arduino boards primarily use Atmel AVR microcontrollers like the ATmega328 for the Uno and ATmega2560 for the Mega. These microcontrollers are known for their reliability and versatility, making them suitable for a wide range of applications, from simple tasks to intricate robotics.

4. What is Arduino IDE?

The Arduino Integrated Development Environment (IDE) is a software platform where users can write, compile, and upload code to their Arduino boards. It supports C and C++ programming languages, providing a simple interface that streamlines the coding process and enhances productivity in developing projects.

5. How to upload code to an Arduino?

To upload code to your Arduino, connect the board to your computer using a USB cable. Open the Arduino IDE, select the correct board and port from the Tools menu, write your code, then click the upload button. The IDE compiles your code and transfers it to the board, ready to run your project.

6. What languages can you use to program Arduino?

Arduino primarily uses C and C++ programming languages. With its libraries and extensive community support, beginners can easily grasp the basics. Advanced users can leverage these languages for more complex applications, making Arduino a flexible platform for various projects.

7. What are Arduino shields?

Arduino shields are modular circuit boards that can be stacked on top of Arduino boards to expand their functionality. They add features like Wi-Fi, Bluetooth, or motor control without the need for additional wiring. This makes it easier to design and enhance projects quickly and efficiently.

8. How to connect sensors to Arduino?

To connect sensors to Arduino, identify the sensor's output pins and power requirements. Use jumper wires to connect the sensor to the board’s corresponding digital or analog pins. After wiring, you'll typically write a program in the Arduino IDE to read data from the sensor and implement its functionality in your project.

9. What are digital and analog pins used for?

Digital pins on Arduino can read or write two states: HIGH or LOW. They’re used for simple on/off sensors or devices. Analog pins, however, read varying voltage levels, allowing for more nuanced inputs, such as from temperature sensors. Using the right pin type is crucial for your project's success.

10. How is Arduino different from Raspberry Pi?

Arduino is a microcontroller platform focused on simple tasks and real-time control, whereas Raspberry Pi is a mini-computer designed for complex computing tasks. Arduino is excellent for hardware interfacing, while Raspberry Pi excels at running operating systems and applications, making them suitable for different project types.

Prev Post
Next Post

Leave a comment

Please note, comments need to be approved before they are published.

Thanks for subscribing!

This email has been registered!

Shop the look

Choose Options

Edit Option
Back In Stock Notification
Compare
Product SKU Description Collection Availability Product Type Other Details

Choose Options

this is just a warning
Login
Shopping Cart
0 items
FREE SHIPPING!
₹100 OFF
₹200 OFF
WhatsApp Chat Chat