Introduction to MSP430

Hello friends, I hope you all are doing great. In today's tutorial, we are gonna have a look at a detailed Introduction to MSP430.  MSP430 is a microcontroller portfolio that offers different varieties of sixteen-bit Microcontrollers. These microcontrollers are integrated with ultra-low power and digital and analog peripherals devices for sensing and measurement applications. MSP430 microcontrollers with non-volatile FRAM (ferroelectric random access memory) provide the lowest stand-by power (350nA with RTC), 100 µA/MHz active power and have the capability to recover system state after sudden power failures. MSP430 is used in different applications such as sensor systems which receive analog signals and convert them into digital values and after processing send these values to host systems. In today's post, we will have a look at its introduction, working, protocol, features, applications, etc. I will also share some links where I have interfaced it with other microcontrollers. If you have any questions please ask in the comments, and I will resolve your problems. So, let's get started with a basic Introduction to MSP430.

Introduction to MSP430

  • MSP430 is a microcontroller portfolio that offers different varieties of sixteen-bit Microcontrollers. These microcontrollers are integrated with ultra-low power and digital and analog peripherals devices for sensing and measurement applications.
  • This module consists of five low-power modes that increase battery life in portable measurement applications.
  • MSP430 has a feature of 16-bit registers, sixteen-bit RISC Cpu and constant generators which provides maximum code efficiency.
  • The digitally controlled oscillator (DCO) of this module converts low power modes to active mode in less than 6µs.
  • The MSP430x11x series is an ultra-low power signal microcontrollers that consist of a 16-bit timer and fourteen input and output pinouts.
  • MSP microcontrollers give ideas and enable designers to produce such high-performance applications, which support the industry's lowest stand-by power, analog and digital devices suitable for sensing and measurement applications, and also support 20+ wired and wireless connectivity applications.
  • The main applications that it provides are sensor systems that receive analog signals and convert them into digital values, and after processing this data sends to host modules. Another area of application is RF front-end sensor.

Now, we discuss its pinouts.

Pinout of MSP430

These are the main pinouts of MSP430 which are described below.
Pin# Type Parameters
Pin#13 P1.0/TACLK It is general-purpose digital I/O pin / Timer_A, clock signal TACLK input.
Pin#14 P1.1/TA0 It is general-purpose digital I/O pin/Timer_A, Capture: CCI0A input, Compare: Out0 output.
Pin#15 P1.2/TA1 It is general-purpose digital I/O pin/Timer_A, Capture: CCI1A input, Compare: Out1 output.
Pin#16 P1.3/TA2 It is general-purpose digital I/O pin/Timer_A, Capture: CCI2A input, Compare: Out2 output.
Pin#17 P1.4/SMCLK/TCK It is general-purpose digital I/O pin/SMCLK signal output/Test clock, an input terminal for device programming and test.
Pin#18 P1.5/TA0/TMS It is general-purpose digital I/O pin/Timer_A, Compare: Out0 output/test mode select, an input terminal for device programming and test.
Pin#19 P1.6/TA1/TDI It is general-purpose digital I/O pin/Timer_A, Compare: Out1 output/test data input terminal.
Pin#20 P1.7/TA2/TDO/TDI It is general-purpose digital I/O pin/Timer_A, Compare: Out2 output/test data output terminal or data input during programming.
Pin#8 P2.0/ACLK It is general-purpose digital I/O pin/ACLK output.
Pin#9 P2.1/INCLK It is general-purpose digital I/O pin/Timer_A, a clock signal at INCLK.
Pin#10 P2.2/TA0 It is general-purpose digital I/O pin/Timer_A, Capture: CCI0B input, Compare: Out0 output.
Pin#11 P2.3/TA1 It is general-purpose digital I/O pin/Timer_A, Capture: CCI1B input, Compare: Out1 output.
Pin#12 P2.4/TA2 It is general-purpose digital I/O pin/Timer_A, Compare Out2 output.
Pin#3 P2.5/ROSC It is general-purpose digital I/O pin/Input for an external resistor that defines the DCO nominal frequency.
Pin#7 RST/NMI It is Reset or nonmaskable interrupt input.
Pin#1 TEST/VPP It is selected test mode for JTAG pins on Port1/programming voltage input during EPROM programming.
Pin#2 VCC It is a Supply voltage.
Pin#4 VSS It is Ground reference.
Pin#6 XIN It is an Input terminal of the crystal oscillator.
Pin#5 XOUT/TCLK The output terminal of a crystal oscillator or test clock input.
Now, we discuss the features of MCP430.

Features of MSP430

  • These are the main features of MCP430, Lets's discuss them with detailed.
    • It is available in a 20 pin plastic small outline widebody package.
    • Its operating voltage range is 2.5v to 5.5 v.
    • Its active mode is 330 µA at 1 MHz, 3 V.
    • Its stands by mode are 1.5 µA.
    • It's off mode (Ram Retention) is 0.1 µA.
    • This module is available in 16-bit architecture, 200ns instruction cycle time.
    • This module consists of various internal resistors, single external resistor,32 kHz crystal, high frequency, resonator and external clock source.
    • It has a 16-bit timer with a three capture/compare registers.
    • In this module, programme protection is done by a security fuse.
    • It has serial onboard programming.
    • This module has 16 kb flash, 512 B RAM, 8ch 10-bit ADC, two 16-bit timer

MSP340 Interfacing with RFID

  • In the next coming lines, we will discuss MSP430 interfacing with RFID, first of all, we discuss components required for this circuit.
  • Circuit Components
    •  MSP430 Launchpad.
    •  EM-18 (RFID reader module).
    •  16*2 LCD.
    •  Potentiometer.
    •   Breadboard.
    •   Jumper wires.
  • In this circuit diagram, we are going to use UART hardware of MSP430, So you should put RXD and TXD jumpers on HM UART mode. After this connect the Tx of EM-18 to RXD (P1.1) of MSP430.
  • In this project, we are going to use serial communication of data transfer. RFID also has another mode than serial mode but we are using RS232 communication mode. The RS232 pin of RFID the module connects with RXD pin of MSP430.
  •  To connect the RFID reader with MSP430 we have to enable the serial communication in MSP430.
  • We can initialize serial protocol in MSP430 by using a simple command Serial.begin(9600), where 9600 is the baud rate.
  • Now in order to read the incoming Serial data, we need to use value=Serial.read().
  • We can see in the given diagram that for communication by RFID use BAUD rate of 9600 bits per seconds. For MSP430 to create baud rate equal to the RFID baud rate to start communication, we use the command of "Serial.begin(9600);". 9600 is a baud rate which can change.
  • After setting of baud rate, MSP430 is ready to receive data. This data can be received by command “data = Serial.read();”. By this way, serial data is taken in 'data ' named Integer.

  • When we take a card near the reader, the reader reads data and forward it to MSP430, MSP430 after getting data show on LCD. So we will have an ID of a card on LCD.

Applications of MSP430

  • These are some applications of MSP430.
    • It is used for Factory Control & Automation Applications
    • It is used in Building & Home Automation Applications.
    • It is used in Grid Infrastructure & Metering Applications.
    • It is used in Portable Test & Measurement Equipment.
    • It is used in Health, Medical & Fitness Applications
    • It also used in Consumer Electronics.
So, friends, that's was all about MSP430 If you have any question about it please ask I comments I will resolve your problems. Take care until next post.

Introduction to Arduino Zero

Hello friends, I hope you are all fine will be doing something interesting in your life. In today's tutorial, we are gonna have a look at detailed Introduction to Arduino Zero. Arduino Zero is a Microcontroller device. It is a 32-bit extension of UNO series. Its main features are Atmel Embedded Debugger (EDBG), it provides a full debug interface without additional hardware. This board provides a platform of new inventory projects in smart IoT devices, high technology automation, robotics and much more. As, Electronic devices coming in our life, they have become cheaper and performing more functions then there predecessor. The microcontroller was introduced in the industry to make our task easy in electronic devices and projects. Arduino Zero is a valuable addition in the electronics industry. It providing the improvement in Arduino role in our projects. In today's I will explain about Its pinout, projects, working, protocol, etc. So let's started with Introduction to Arduino Zero.

Introduction to Arduino Zero

  • Arduino Zero is a microcontroller board, based on Atmel SAMD21G18U ARM CORTEX MO+CPU. It is simply a 32 bit extension of Arduino UNO series.
  • It has 20 input-output pins (10 can be used PWM output), it also has six analog inputs, 2 UARTs, 48 MHZ clocks, 1 digital to analog converter (DAC), one SPI reader, one TWI and reset button.
  • One of the most important functions of it is that (EDGB), Which provide full debugging without any external hardware. EDGB also support a virtual com port that can be used for boat loader programming.
  • It allows the designer to control electronic devices in a comprehensive way. AC to DC adopter can also be used to power the board.
  • Arduino Zero boards are quite similar to other boards in the Arduino family in terms of use and functionality.
  • It can operate on external supply 6 to 20 volts. But if we supply below six volts it becomes unstable and if the voltage is greater then 12, the voltage regulator is overheating and may damage the board.
Now, let's discuss the pinout of Arduino Zero PINOUT:

Arduino Zero PINOUT & Description

There are main twenty pinouts of Arduino Zero, let's discuss which are most important and mostly used.
No.  Pin Name  Description
01 SCL SCL is a clock line. It uses to synchronized data on a protocol which it uses. It works on the I2C protocol.
02 SDA SDA is a line at which data is transferred by the serial way.
03 AREF AREF stand for Analogue reference. It used to supply Arduino reference voltage.
04 GND This pin is used for ground purposes.
05 TX/D1 This pin used for transmission of data.
06 RX/D0 This pin is used for receiving data
07 AD0 It used for analog to digital conversion.
08  IOREF This pin is used for input, output voltage reference purpose. For example, an Arduino would supply 5 v to this pin, but a due would supply 3.3 v. Sending a signal to this pin does nothing.
09 3.3 V  This pin is used for 3.3 v supply to Arduino.
10 REST This pin is used for resting of Arduino.
11 VUSB This is a USB port.
12 VIN At this pin, we supply input voltage to Arduino.
13 AO/DAC This is used for analog to digital conversion of the signal.
14 GND This is two ground in Arduino Zero, this one is second
15 PROGRAMMING PORT This pin is used for the feeding of programming to Arduino.
16 SUPPLY CONNECTOR This pin is used for 2.1 mm supply connector.
17  MCU  This pin is used to interface other microcontrollers with Arduino.
  [otw_is sidebar=otw-sidebar-5] Now, Let's discuss the specifications of Arduino Zero.

Features & Specifications of Arduino Zero

These are some specification of Arduino Zero:
  • Arduino Zero is a SAMD 21 Cortex M0+ 32bit low power ARM microcontroller.
  • Its board Power Supply (usb.in) is 5 volts.
  • DC current we can apply at the 3.3v pin is 600 mA.
  • DC current for the 5-volt pin is 600mA.
  • Its circuit operating Voltage is 3.3V.
  • Total digital input and output pins are 22.
  • Its PWM Pins  are 12 (0, 1, 2, 3, 4, 5, 6, 7, 8, 10, A3 - or 18 -, A4 -or 19).
  • It's flash memory is 256 KB.
  • It has flash memory for boot-loader is 8 kb.
  • It has SRAM of  32 KB.
  • Its Clock Speed is 32.768 kHz (RTC), 48 MHz.
  • Its supported battery is Li-Po single cell, 3.7 V, 700 mAh minimum.
  • It's Analog Input Pins are  6, 12-bit ADC channels
  • It's Analog Output Pins are 1 to 10-bit DAC.
  • There is no use of EEPROM.
  •  Its LED BUILTIN is at pin no 13.
For a better understanding of Arduino Zero, we discuss its use in project By an example.

Zero Drive

Lets discuss project of Arduino Zero.
  • Zero Driver is basically an Arduino Zero compatible dual motor driver board for mechatronics engineering projects and different types of industrial robots.
  • In robotic projects required two board, one is a microcontroller and other is a separate driver for a motor. Zero Driver combines both in one for our convenience.
  • Zero drivers come with the same microcontroller as an Arduino Zero 48 MHZ ARM cortex M0+ chip, which is better than any other an entry-level Arduino Uno.
  • For better understand how this work lets see a picture of zero drive.

Application of Arduino  Zero

These are some applications of Arduino Zero. We can use it as a parking Lot Counter.
  • It can be used in security and Defense System.
  • It is used in Digital Electronics and Robotics.
  • It is used in Weighing Machines.
  • It is used in Traffic Light Count Down Timer.
  • we can also use it in Medical Instrument.
  • It is also used in Emergency Light for Railways.
  • It is also used in Home Automation.
So, friends, this was all about Arduino Zero. If you any question regards it, you ask in comment box. I will resolve your queries. Thanks for reading. Take care until next post...

Interfacing of Arduino with 74HC595 & 74HC165

Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to Interface Arduino with 74HC595 & 74HC165. I have already interfaced these shift registers separately with Arduino. In the first tutorial we have seen Arduino 74HC595 Interfacing in which I have discussed How to increase the output pins of Arduino using 74HC595. After that in second tutorial we have seen Arduino 74HC165 Interfacing where we have increased the input pins of Arduino. So, now we are gonna interface both of these shift registers with Arduino UNO and will increase both input and output pins of Arduino. I have also given the Proteus simulations for download at the end of this tutorial along with Arduino code. So, lets get started with Interfacing of Arduino with 74HC595 & 74HC165:

Interfacing of Arduino with 74HC595 & 74HC165

  • As you can see in above figure, I have used 74HC165 & 74HC595 and interfaced its pins with Arduino UNO.
  • I could use same clock for these shift registers but it would have made the code quite complex.
  • That's why I have used separate clock pins and I have used the below code to reflect the input on output.
#define NUMBER_OF_SHIFT_CHIPS   1
#define DATA_WIDTH   NUMBER_OF_SHIFT_CHIPS * 8
#define TotalIC 2
#define TotalICPins TotalIC * 8

int LoadPin    = 8;
int EnablePin  = 9;
int DataPin    = 11;
int ClockPin   = 12;

int RCLK = 5;
int SER = 6;
int SRCLK = 7;

unsigned long pinValues;
unsigned long oldPinValues;
boolean Data[TotalICPins];

void setup()
{
    Serial.begin(9600);

    pinMode(LoadPin, OUTPUT);
    pinMode(EnablePin, OUTPUT);
    pinMode(ClockPin, OUTPUT);
    pinMode(DataPin, INPUT);

    digitalWrite(ClockPin, LOW);
    digitalWrite(LoadPin, HIGH);
    Serial.println("Visit us at www.TheEngineeringProjects.com");
    Serial.println();
    pinMode(SER, OUTPUT);
    pinMode(RCLK, OUTPUT);
    pinMode(SRCLK, OUTPUT);

    ClearBuffer();
    
    pinValues = read_shift_regs();
    print_byte();
    oldPinValues = pinValues;
}

void loop()
{
    pinValues = read_shift_regs();

    if(pinValues != oldPinValues)
    {
        print_byte();
        oldPinValues = pinValues;
    }

}

unsigned long read_shift_regs()
{
    long bitVal;
    unsigned long bytesVal = 0;

    digitalWrite(EnablePin, HIGH);
    digitalWrite(LoadPin, LOW);
    delayMicroseconds(5);
    digitalWrite(LoadPin, HIGH);
    digitalWrite(EnablePin, LOW);

    for(int i = 0; i < DATA_WIDTH; i++)
    {
        bitVal = digitalRead(DataPin);
        bytesVal |= (bitVal << ((DATA_WIDTH-1) - i));

        digitalWrite(ClockPin, HIGH);
        delayMicroseconds(5);
        digitalWrite(ClockPin, LOW);
    }

    return(bytesVal);
}

void print_byte() { 
  byte i; 

  Serial.println("*Shift Register Values:*\r\n");

  for(byte i=0; i<=DATA_WIDTH-1; i++) 
  { 
    Serial.print("P");
    Serial.print(i+1);
    Serial.print(" "); 
  }
  Serial.println();
  for(byte i=0; i<=DATA_WIDTH-1; i++) 
  { 
    
    Serial.print(pinValues >> i & 1, BIN); 
    Data[i] = pinValues >> i & 1, BIN;
    //if(BinaryValue == 1){Data[i] = HIGH;}
    //if(BinaryValue == 0){Data[i] = LOW;}
    UpdateData();
    if(i>8){Serial.print(" ");}
    Serial.print("  "); 
    
  } 
  
  Serial.print("\n"); 
  Serial.println();Serial.println();

}

void ClearBuffer()
{
    for(int i = TotalICPins - 1; i >=  0; i--)
    {
       Data[i] = LOW;
    }
    UpdateData();
} 

void UpdateData()
{
   digitalWrite(RCLK, LOW);
   for(int i = TotalICPins - 1; i >=  0; i--)
   {
        digitalWrite(SRCLK, LOW);   
        digitalWrite(SER, Data[i]);
        digitalWrite(SRCLK, HIGH);

  }
  digitalWrite(RCLK, HIGH);
}
  • In the above code, I have used Number_of_Shift_Chips 1 and it means I am using 1 chip each, so in total 2 chips.
  • Now get hex file from Arduino software and upload it in your Proteus software.
  • Run your simulation and if everything goes fine then you will get something as shown in below figure:
  • You can see in above figure that all those LED outputs are ON which has HIGH inputs.
  • I have also attached a Virtual Terminal with Arduino to have a look at the input bits.
  • Now let's add 2 chips of 74HC165 and 74HC959, so design a simple simulation as shown in below figure:
  • Now in your above code change the Number of Shift chips from 1 to 2, as now we are using 2 chips each.
  • Upload your hex file and if everything goes fine then you will get similar results:
  • So, that's how you can easily increase input and output pins of Arduino UNO.
  • I have just designed a simple code but you can work on it and can control these inputs separately as well.
  • You can interface different digital sensors on these input pins and can control motors, relays, solenoids etc. at output pins.
  • You can download both of these Proteus Simulations along with Arduino code by clicking the below button, but I would suggest you to dwsign it on yoru own so that you could learn from mistakes.

[dt_default_button link="https://theengineeringprojects.com/ArduinoProjects/Interfacing%20of%20Arduino%20with%2074HC595%20&%2074HC165.zip" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download Proteus Simulation & Arduino Code [/dt_default_button]

So, that was all about Interfacing of Arduino with 74HC595 & 74HC165. I hope you can now easily simulate it. If you have any questions then ask in comments and I will try my best to resolve them. Thanks for reading. Take care !!! :)

How to use analogWrite in Arduino?

Hey Fellas! Hope you are getting along with life pretty well. This post is another addition in this Arduino Tutorial for Beginners series. Today, I'll discuss How to use analogWrite in Arduino? The analogWrite is mainly used to update the status of analog pins and is also used to map the analog values on the PWM (Pulse Width Modulation) pins. You can check the article that I have posted previously on How to use analogRead in the Arduino - this command addresses the analog pins on the board and reads its status, while today's one does the exact opposite. In this post, I'll try to break down each and everything related to analogWrite in simple steps, so you can grab the main idea pretty well. Let's jump right in.

How to use analogWrite in Arduino?

  • The analogWrite Arduino command is used to update the status of analog pins and also used to address the PWM pins on the board.
  • The PWM pins are 8-bit pins, terming that you can set the duty cycle somewhere between 0 -255.
  • The duty cycle is described as the amount time the signal switches between ON and OFF condition. It is mainly written in percentage.
  • If the signal remains turned ON half of the total duty cycle and OFF in another half, then the duty cycle will be 50%.
  • The analogWrite comes handy when you plan to control the motor speed or the intensity of any LED.
  • The value you write on the PWM pins will control the speed.
  • For example, if you intend to run the motor at full speed, you will set the value 255 i.e. the maximum value it can handle that will ultimately run the motor at full speed.
  • Similarly, setting value as "0" will be sending no signal and motor won't start.
  • And if the motor requires to be run at half speed, then you will set the value 127 or 128 -  half of the maximum value that will cause the motor to be running at half speed.
  • Arduino Uno comes with PWM pins available on digital pin number 3,5,6 and 9,10,11. You can put any number, out of these pins.
  • Now let's have a look at How to use analogWrite Arduino command:
Syntax

analogWrite(int pin, int value);

where:
  • "pin" is the pin number you are targeting.
  • "value" is the duty cycle that can be set anywhere between 0  to 255 where former indicates the OFF condition and later indicates the system is running at full speed.
Example

analogWrite(10, 175);

Note: The analogWrite command doesn't return or store any value, unlike analogRead that returns value anywhere between 0 to 1023 depending on the voltage it gets in return from the connected sensor or device. The Arduino IDE is an official software used to program the Arduino Boards. It is an open source software, giving you the flexibility to program the Arduino Board as per your technical needs and requirements. It is free of cost and help is readily available on the Arduino site in case you feel any difficulty in shaping the desired code on the board. That’s all for now. I'll be writing more articles on how to code Arduino. If you are feeling skeptical about anything, making it difficult for you to grab the basic idea, you can approach me in the comment section below. I’d love to help you the best way I can. In the coming tutorial, we will have a look at How to use Arduino PWM Pins. Thanks for reading the article.

Arduino 74HC165 Interfacing: Increase Input Pins

Hello friends, I hope you all are doing great. In today's tutorial, I am going to do an Arduino 74HC165 Interfacing and we will have a look at How to increase Input Pins of Arduino. 74HC165 is a shift register and works on the principal of Parallel In Serial Out. In my previous tutorial Arduino 74HC595 Interfacing: Increase Output Pins, we have seen How to increase the output pins of Arduino and today we are gonna do exact the opposite and we will increase the input pins. 74HC165 will take 8 parallel inputs from different sensors or buttons etc and will send them to serial OUT Pin, which will be connected to Arduino. So, if you are working on a project where you want to get data of 15 or 20 digital sensors then you can use this shift register and just using a single pin of Arduino you can read data of all those sensors. We can only get digital inputs, we can't get analog input through this shift register. So, let's get started with Arduino 74HC165 Interfacing:

Arduino 74HC165 Interfacing

  • I will design a Proteus Simulation of Arduino 74HC165 Interfacing, I have given the files for download at the end of this tutorial, but I would recommend you to design it so that you could learn.
  • I will connect simple Logic buttons with this shift register and will read their status on the Serial Port.
  • So, first of all design a simple Proteus Simulation as shown in below figure.
  • I have used Arduino UNO and have connected Virtual Terminal so that we could have a look at Serial data.
  • As you can see in the above figure that I have connected four pins between Arduino and 74HC165, which are:
    • Pin # 8 of Arduino  ==> Shift (SH) of shift register.
    • Pin # 9 of Arduino  ==> Clock Enable (CE) of shift register.
    • Pin # 11 of Arduino ==> Serial OUT (SO) of shift register.
    • Pin # 12 of Arduino ==> Clock (CLK) of shift register.
  • Now open you Arduino software and copy paste the below code in it:
#define NUMBER_OF_SHIFT_CHIPS   1
#define DATA_WIDTH   NUMBER_OF_SHIFT_CHIPS * 8

int LoadPin    = 8;
int EnablePin  = 9;
int DataPin    = 11;
int ClockPin   = 12;

unsigned long pinValues;
unsigned long oldPinValues;

void setup()
{
    Serial.begin(9600);

    pinMode(LoadPin, OUTPUT);
    pinMode(EnablePin, OUTPUT);
    pinMode(ClockPin, OUTPUT);
    pinMode(DataPin, INPUT);

    digitalWrite(ClockPin, LOW);
    digitalWrite(LoadPin, HIGH);

    pinValues = read_shift_regs();
    print_byte();
    oldPinValues = pinValues;
}

void loop()
{
    pinValues = read_shift_regs();

    if(pinValues != oldPinValues)
    {
        print_byte();
        oldPinValues = pinValues;
    }

}

unsigned long read_shift_regs()
{
    long bitVal;
    unsigned long bytesVal = 0;

    digitalWrite(EnablePin, HIGH);
    digitalWrite(LoadPin, LOW);
    delayMicroseconds(5);
    digitalWrite(LoadPin, HIGH);
    digitalWrite(EnablePin, LOW);

    for(int i = 0; i < DATA_WIDTH; i++)
    {
        bitVal = digitalRead(DataPin);
        bytesVal |= (bitVal << ((DATA_WIDTH-1) - i));

        digitalWrite(ClockPin, HIGH);
        delayMicroseconds(5);
        digitalWrite(ClockPin, LOW);
    }

    return(bytesVal);
}

void print_byte() { 
  byte i; 

  Serial.println("*Shift Register Values:*\r\n");

  for(byte i=0; i<=DATA_WIDTH-1; i++) 
  { 
    Serial.print("P");
    Serial.print(i+1);
    Serial.print(" "); 
  }
  Serial.println();
  for(byte i=0; i<=DATA_WIDTH-1; i++) 
  { 
    Serial.print(pinValues >> i & 1, BIN); 
    
    if(i>8){Serial.print(" ");}
    Serial.print("  "); 
    
  } 
  
  Serial.print("\n"); 
  Serial.println();Serial.println();

}
  • The code is quite simple but let me give you a quick explanation of  it.
  • First of all, I have assigned names to all 4 pins of 74HC165 connected with Arduino.
  • Function read_shift_regs() is used to read the eight input pins of 74HC165 and print_byte() function is used to display that data on Serial Monitor.
  • So get your hex file from Arduino software and upload it in Proteus software.
  • Run your Proteus simulation and if everything goes fine then you will get results as shown in below figure:
  • If you change any input of your shift register then you will get the new value on your Virtual Terminal.
  • Now let's add another 74HC165 and increase our input pins by 16.
  • So, design a simple circuit as shown in below figure:
  • Now, in the above code, simply change the first line and make #define NUMBER_OF_SHIFT_CHIPS 2.
  • Simply changes 1 to 2, as we are using 2 shift registers now.
  • Now get your hex file and run the Proteus simulation.
  • Here's the output of our 16 increased inputs:
  • That's how you can easily interface multiple 74HC165 chips with your Arduino board and can increase the input options.
  • You can download these Proteus simulations and code for Arduino 74HC165 Interfacing by clicking the below button:

[dt_default_button link="https://www.theengineeringprojects.com/ArduinoProjects/Arduino 74HC165 Interfacing.rar" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download Proteus Simulation & Code[/dt_default_button]

  • You should also have a look at this video in which I have shown How to run these simulations:
So, that was all for today. In my coming tutorial, I will interface both 74HC165 and 74HC595 with Arduino UNO and will show you How to increase both input and output pins at the same time. Thanks for reading. Take care!!! :)

Arduino 74HC595 Interfacing: Increase Output Pins

Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you Arduino 74HC595 Interfacing and we will have a loook at How to Increase Arduino Output Pins with 74HC595. Suppose you are working on some project where you need to control 20 LEDs with Arduino UNO and you know we will 12 digital Pins so we can't control all of these 20 LEDs with Arduino UNO. We can use Arduino Mega as well but if we wanna stick to Arduino UNO then we need to increase its Output Pins and we will use 74HC595 for that purpose. You should read this basic Introduction to 74HC595, it will help you to better understand this shift register. It's a Serial In Parallel Out Shift register and we will give it value serially from single Pin of Arduino and it will output that data to 8 output pins. Moreover, we can also connect these registers in parallel to increase the output pins even further. So, let's have a look at Arduino 74HC595 Interfacing:

Arduino 74HC595 Interfacing

  • As I told earlier 74HC595 is a serial In Parallel Out Shift Register and is used to increase the output pins of Arduino.
  • I am gonna use Proteus software and we will design its simulation and then will check out How it works.
  • So, design a simple circuit as shown in below figure:
  • As you can see in above figure, I have done the following connections between Arduino and HC595:
    • Pin # 5 of Arduino ==> ST_CP
    • Pin # 6 of Arduino ==> DS
    • Pin # 7 of Arduino ==> SH_CP
    • All output pins of 74HC595 are connected to LEDs.
  • Now upload the below Arduino code and get your hex file.
int RCLK = 5;
int SER = 6;
int SRCLK = 7;

#define TotalIC 1
#define TotalICPins TotalIC * 8

boolean Data[TotalICPins];

void setup()
{
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);

  ClearBuffer();
}              


void loop()
{
   for(int i = TotalICPins - 1; i >=  0; i--)
   {
      Data[i] = HIGH;
      UpdateData();
      delay(300);
      ClearBuffer();
   }

   for(int i = 1;i < TotalICPins - 1;  i++)
   {
      Data[i] = HIGH;
      UpdateData();
      delay(300);
      ClearBuffer();
   }
   
}

void ClearBuffer()
{
    for(int i = TotalICPins - 1; i >=  0; i--)
    {
       Data[i] = LOW;
    }
    UpdateData();
} 

void UpdateData()
{
   digitalWrite(RCLK, LOW);
   for(int i = TotalICPins - 1; i >=  0; i--)
   {
        digitalWrite(SRCLK, LOW);   
        digitalWrite(SER, Data[i]);
        digitalWrite(SRCLK, HIGH);

  }
  digitalWrite(RCLK, HIGH);
}
  • The code is quite simple but let me explain it a bit.
  • First of all we have given names to our 3 Pins connected to Arduino UNO.
  • After that we have made all those 3 Pins as OUTPUT as we are gonna send the data.
  • We are using single chip of 74HC595 that's why I have made it 1.
  • In the UpdateData function, you can see we have to make RCLK Low and after that we have sent our data.
  • But for sending each bit of Data we have to make SRCLK from LOW to High.
  • SER is our Serial IN from Arduino to 74HC595.
  • So, in loop section, I am simply sending HIGH from first Pin to Last and then from last Pin to first and we are getting below results:
  • Now let's have a look at How to connect two 74HC595 chips in parallel to increase the output pins to 16.
  • I have also given these Proteus simulations for download at the end of this tutorial but I would recommend you to design them on your own so that you got better understanding of this shift register.
Arduino 74HC595 Interfacing: 2 Chips in Parallel
  • Now we are gonna place two shift registers in parallel and we will be able to control 16 outputs from single Arduino Pin.
  • Although we are using 3 Arduino Pins but the data is sent through Pin # 6 of Arduino and Pin # 5 and 7 are CLK Pins.
  • Now design a circuit as shown in below figure:
  • Now in Arduino Code, you just need to change the TotalIC to 2 and as you have seen we have already multiplied it with 8 so now our for loop will move from 0 to 15.
  • Pin # 5 and 7 will simply connected to same pins of second shift register but DS will be connected to Q7' of first shift register.
  • Now get your hex file from Arduino software and if everything goes fine then you will get something as shown in below figure:
  • Now let's make it a bit more complex by adding 4 shift registers in parallel.
  • So, design a Proteus Simulation as shown in below figure:
  • We have followed the same principal, Q7' of second chip is connected to DS to 3rd chip and goes on.
  • I have placed these default Pins instead of connecting the wires, it works the same.
  • If this image is not clear then open it in new tab and zoom out to check the connections.
  • Now in your Arduino code, you need to change the TotalIC to 4, as now we are using four chips.
  • Get your Hex File and run Proteus simulation and if everything goes fine then you will get similar results:
  • So, that's How you can quite easily do the Arduino 74HC595 Interfacing and can increase Arduino outputs as much as you want.
  • You can download these Proteus Simulations along with code by clicking the below button:

[dt_default_button link="https://www.theengineeringprojects.com/ArduinoProjects/Arduino 74HC595 Interfacing.rar" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download Proteus Simulation & Arduino Code[/dt_default_button]

  • I have also designed this YouTube video to give you a better understanding of Arduino 74HC595 Interfacing:
So, that was all for today. I hope you have enjoyed this Arduino 74Hc595 Interfacing. If you have any questions, then ask in comments and I will try my best to resolve them. In my coming tutorial, I will show you How to increase the Arduino Input Pins. So stay tuned and have fun. :)

How to use analogRead in Arduino?

Hi Friends! Welcome you onboard. I have been writing these Arduino tutorial for beginners for quite a while now and today we are having the next episode. Today, I'll discuss How to use analogRead in Arduino. The analogRead is mainly used to program and address analog pins on the board. In our previous tutorial, we have seen How to use digitalWrite Arduino Command, which deals with digital pins of Arduino but today's one deals with analog pins. There are many types of boards available in the market ranging from Arduino UNO, Arduino Mega2560, Arduino Micro and many more, which you can use based on your technical requirements. Arduino Programming is made simple by the Arduino.cc - the manufacturer of Arduino Boards, providing an open source software and hardware features and give you the flexibility to modify and tweak the boards as per your requirements. In this post, I'll discuss how you can easily program the Arduino Board using analogRead if you intend to target the analog pins on the board. Let's dive in.

How to use analogRead in Arduino

The analogRead is a command mainly used to program the analog pins on the board. If you are using analogRead functions, it indicates you are making the pins as input i.e. you can connect the Arduino analog pins with any sensor and read its value by making the analog pins as input. Following figure shows the placement of analog pins on the Arduino Uno Board.
  • If you have already got a hold of some features of Arduino Board, you must have known that analog pins are 10-bit pins. It means each pin can store 0 - 1023 values.
Analog pins are different than digital pins as the later can store only two values: HIGH and LOW while the former comes with an ability to store any random value ranging from 0 - 1023 where 0 will indicate the ground signal or zero volts while 1023 will be representing 5 volts. The voltage values are directly proportional to the values stored in the Arduino Pins. For example, if the sensor voltage is around 2.5 V then the value we get on an analog pin will be half the total value it can store in the pin i.e. 512. Syntax:
  • The syntax of analogRead is given as follows:

int data = analogRead(int pin);

where:
  • Pin defines the number of a pin you are targeting. Most of the Arduino Boards come with 6 analog pins and marked as A0 to A5 while Arduino Pro Mini and Arduino Nano come with 8 pins, marked from A0 to A7 and Arduino Mega stands out in terms of having the most number of analog pins, around 16, marking from A0 to A15 on the Mega.
Return:
  • analogRead returns value anywhere between 0 to 1023 depending on the voltage it gets in return.
Example:

data = analogRead (4);

Note: 
  • If you are aiming to read analog pins from digitalRead, you must write A4, instead of simply pointing the required pin number i.e. analogRead(A4).
Here's a sample code for testing the analogRead Arduino command:
int sensorPin = A0;
int sensorValue = 0;  

void setup() {
 
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() 
{
  sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue);
}
I have written an Article on Introduction to Arduino IDE - An Official Software used to program the variety of Arduino Boards. In this Article, I have broken down everything in simple steps, detailing how to select the relevant board you are working on and make it compatible with the software. That’s all for today. I hope you have got valuable information out of this read. However, if you are unsure or have any question you can approach me in the comment section below. I’d love to help you according to the best of my knowledge. In the coming tutorial, we will have a look at How to use analogWrite in Arduino, which is used to update the status of analog pins. Thanks for reading the article.

Introduction to Arduino Duemilanove

Hey Fellas! Hope you are doing well. I feel pleasure to have you on this platform. Today, I'll discuss the detailed Introduction to Arduino Duemilanove which is a Microcontroller Board, introduced by Arduino.cc and is based on ATmega168 or ATmega328. It comes with 14 pins that can be used both ways: Input or Output. Duemilanove means "2009" in Italian. Arduino boards have always been a good pick for hobbyists and students who intend to design projects that are mainly related to embedded system and automation. These boards are similar to microcontrollers, with little advantage over them as they come with some built-in peripheral features, setting you free from buying external components to employ automation in your project. If we focus on Arduino Duemilanove, it incorporates an ICSP header, a power jack, a reset button, and USB connection. A 16 MHz crystal is added on the device, aiming to produce clock pulses with regular intervals. In this post, I'll try to cover each and everything related this Arduino Board i.e. main features, pinout, pin description, software used and applications. Let's jump right in.

Introduction to Arduino Duemilanove

Arduino Duemilanove is a Microcontroller Board that is based on ATmega168 or ATmega328.
  • It comes with 14 I/O pins, out of which 6 are used as a PWM output Pins.
This board is useful where low speed and memory space is required. You can not compare it with Arduino Mega that proves to an ideal choice for high-speed applications. Still, if you aim to produce a project with simple functions, Arduino Duemilanove comes handy and stands fit for your technical requirements. It is a most recent version of the board housing USB connection and can operate at 5V with an Input voltage ranging between 6 to 20 V, however, it is advised to keep the voltage range from 7 to 12 V.
  • The Flash Memory is different depending on the microcontroller incorporated into the board: 16 KB for ATmega168 and 32 KB for ATmega 328. Out of this total flash memory, 2 KB is reserved for a bootloader. 
Similarly, SRAM featured on the device is 1 KB  while using ATmega168 and 2 KB for ATmega328. 
  • This board can be powered up both ways: connecting with a computer using USB cable or using DC adopter.
A reset button is added on the device that helps in resetting the module in case there comes a glitch in a running program and module requires instant reset that brings it back to the initial condition.
  • There is a built-in LED connected to digital pin 13, toggling between ON and OFF as you send HIGH and LOW respectively.

1. Arduino Duemilanove Features

Features of any device help you make a final decision before buying it for your project. Following table shows the main features of Arduino Duemilanove.
Microcontroller ATmega168 or ATmega328
CPU 32-Bit ARM Chip
Digital I/O Pins 14
PWM Output 6 (out of 14 I/O pins)
Analog Input 6
Flash Memory (Program Memory) 16 KB for ATmega168 and 32 KB for ATmega 328
SRAM 1 KB  for ATmega168 and 2 KB for ATmega328
EEPROM 512 bytes for ATmega168 and 1 KB for ATmega328
Input Voltage 7-12 V
Operating Voltage 5 V
Oscillator up to 16 MHz
Software Used Arduino IDE
Reset Button Yes
ICSP Header Yes
USB Port 1
UART (Serial Communication) Yes
SPI Protocol Yes
I2C Protocol Yes
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
  • Three communication protocols available on the board will help in connecting the module with external devices.
  • There is a slight difference in the memory used in the module based on the controller incorporated on the board. Before you intend to buy the module, make sure your technical requirements are quite in line with the memory space available on the board.

2. Arduino Duemilanove Pinout

Following figure shows the pinout of this Arduino Board.
  • There are total 28 physical pins on the board and six pins are available on the ICSP header. Four female headers are available covering all physical pins for the connection with the external devices.

3. Arduino Duemilanove Pin Configuration

In the previous section, you have got a brief overview of the Arduino module pinout. Now, we will highlight the major functions associated with each pin, so you can anticipate what each pin is capable to perform, helping you use the relevant pin for your project.
Digital I/O Pins
There are 14 digital I/O pins on the board that can be used as an input or output based on requirement. If you are working with sensors, these pins can be made as an input to accept the digital input from the sensor, similarly, if you are aiming to control the motor, these pins are used as an output for writing the required command to control the motors.
Analog Pins
There are 6 analog pins available on the board. These pins can accept any value, unlike digital signals that are designed to deal with only two values: HIGH and LOW. The following figure shows the location of analog pins on the board.
PWM Pins
There are six PWM pins (out of 14 digital I/O pins) incorporated on the board. PWM (pulse width modulation) is a process for getting analog results with digital means. These pins appear on the right side of the board as you place the board with power jack pointing upward.  Following figure shows the placement of these pins on the board.
ICSP Header
ICSP (In-Circuit Serial Programming) header is added that help to connect the board with computer and upload a sketch in case USB port is not available.  This feature is mainly used to program Arduino with another Arduino.
Power Source Pins
There are four main voltage sources i.e. Vin, 5V, 3.3V, AREF, available on the board. The Vin is the input voltage that ranges between +7 to +12 V and comes from the external power source. The board operates at 5V while 3.3V is the operating voltage of each pin. There are four ground pins on the board where one is reserved for AREF and another for ICSP header while remaining two are available for the board. The AREF is an Analogue reference voltage, used for analog pins. The following figure shows the power source pins.
Communication Protocols

Common communication protocols like SPI, UART and I2C are available on the board. It is important to note that SPI communication is available on both: digital I/O pins and ICSP header pins.

Serial Peripheral Interface (SPI) is commonly used to send data between microcontrollers and small peripherals such as sensors, shift registers, and SD cards. It comes with separate clock and data lines, layered with a select line to choose the device for communication.

Similarly, I2C is a two-wire interface that contains two main lines known as SDA and SCL where former is s serial data line that carries the data and later is serial clock line that is used to synchronize all data transfers over the I2C bus.

4. Programming and Communication

Almost all modules falling under the Arduino family are programmed using  Arduino IDE - Official software introduced by Arduino.cc for programming Arduino Modules. This software is compatible with common operating systems like Windows, Linux or MAC.
  • You need to take care before installing the software version for your system i.e. if you want to download Arduino IDE App version, you must have Windows 10 installed in your system as app version is not compatible with Windows 7 or 8.1.
The software is very easy to use and is readily available on the Arduino Website. It is an open source software i.e. you can use it freely and modify your Arduino Board as per your requirements. Some basic codes are already available on the software, you just need to connect the board with the computer and upload the required program and start playing with your board right away.
  • Arduino never fails to keep your budget at the bare minimum as no external burner is required to burn the code inside the module due to Module's built-in bootloader, however, if you aim to insert a new controller on the module, you have to install the bootloader again using IDE software.
Arduino IDE comes with a number of options to select the required Arduino Board, simply go to Tools Menu and click Board section and select the board you are working on.
  • Software comes with a compilation option that allows you to see the code compilation on the bottom of the screen as you upload the code, generating a code hex file which then is transferred to the board.
The physical pin 0 and 1 are used for UART communication and FTDI  chip on the board sets a pathway to bridge the serial communication between FTDI drivers and USB. As you send the data using FTDI chip and USB connection, the RX and TX will flash, indicating information is being transferred to the computer.

5. Arduino Duemilanove Projects and Applications

Arduino Duemilanove comes with a wide range of applications and features a number of peripheral features. Following are some major applications it can be used for:
  • Student Projects
  • Industrial Automation
  • Health and Security Systems
  • Embedded Systems
  • Motor and Sensor Control
That’s all for today. I hope I have given you everything you needed to know about Arduino Duemilanove. However, if you are unsure or have any question you can comment in the section below. I’d love to help you in any way I can. You are most welcome to keep us updated with your valuable feedback and suggestions, they help us provide you quality work as per your needs and requirements. Thanks for reading the article.

Introduction to Arduino Leonardo

Hi Guys! Hope you are getting along with life pretty well. I always strive to keep you updated with most valuable information related to engineering and technology. Today, I'll discuss the detailed Introduction to Arduino Leonardo. It is a microcontroller board based on the ATmega32U4 and comes with 23 digital input/output pins. It is developed by Arduino.cc, aiming to provide easy to use interface with the ability to perform a number of functions on a single chip. It incorporates everything required to drive the automation in the relevant project. Simply connect this device with the USB cable or power it up using DC adapter and start playing with it In this post, I'll try to cover each and everything related to Arduino Leonardo, so you don't need to wrestle your mind browsing the whole internet and find all the information in one place. Let's dive right in and get down to the nitty-gritty of this tiny module.

Introduction to Arduino Leonardo

  • Arduino Leonardo is a microcontroller board developed by Arduino.cc. It is based on the ATmega32U4 and comes with 23 digital input/output pins that are enough to connect with external devices and turn your innovation into reality.
  • The Microcontroller on the board incorporates a built-in USB communication, setting you free from the use of a secondary processor. The USB communication helps Leonardo disguise the mouse or keyboard when it is connected to a computer.
  • The module supports the crystal oscillator with the frequency up to 16 MHz that is enough to generate clock pulses with decent pace required for the synchronization of all the internal operations.
In-circuit programming header is added in the device that gives you the flexibility to tweak the already written code after its installation in the relevant project.
  • This board supports common communication protocol like UART, SPI, and I2C. The UART is a serial communication protocol mainly used for transferring and receiving serial data using two pins called TX and RX.
While I2C is a two-wire interface that involves two main lines known as SDA and SCL where former is s serial data line that carries the data and later is serial clock line that is used to synchronize all data transfers over the I2C bus.
  • Serial Peripheral Interface (SPI) is a third communication protocol added on the board that is commonly used to send data between microcontrollers and small peripherals such as sensors, shift registers, and SD cards using separate clock and data lines, layered with a select line to pick the device for communication.

1. Arduino Leonardo Features

If you aim to work on your desired project, you must know the common features this device holds in order to avoid any hassle in future, getting you a clear idea if the ratings of the device are quite in line and stand fit for your project. Following table shows the main features of the Arduino Leonardo.
Microcontroller ATmega32U4
CPU 8-Bit
Digital I/O Pins 23
PWM Output 7
Analog Input 12
Flash Memory (Program Memory) 32 KB (Out of which 4 KB is used by bootloader)
SRAM 2.5 KB
EEPROM 1 KB
Input Voltage 7-12 V
Operating Voltage 5 V
Oscillator up to 16 MHz
Software Used Arduino Software (IDE)
Reset Button Yes
ICSP Header Yes
USB Port 1
UART (Serial Communication) Yes

2. Arduino Leonardo Pinout

Following figure shows the pinout of Arduino Leonardo.
  • USB jack, Power Jack and Reset button are quite in line with each other and are surfaced on one side of the board. Nonetheless, all components and pins on the board are designed in a regular pattern, giving a compact and symmetrical interface.

3. Arduino Leonardo Pin Description

You have got a clear idea about some of the basic functions of this Arduino Module. In this section, we will break down pinout of the board with different images and describe them in terms of pin description of the board. Let's get started.
Analog Pins
There are 12 analog pins added on the board. As per the nature of these pins, they can utilize any number of values, unlike digital signals that are designed to deal with only two values: HIGH and LOW. The following figure shows the placement of these analog pins on the board.
PWM Output
There are seven PWM pins available on the board. If you place the board with power jack pointing upward, these pins appear on the right side of the board. PWM is a process for getting analog results with digital means. You can see these pins in the figure below.
Communication Protocols

Three communication protocols including SPI, UART and I2C are incorporated on the board. You can see them on the figure below. It is important to note that SPI communication is not available on the digital I/O pins like other boards instead, it houses in the ICSP header as shown in the figure below.

Power Source
Difference power sources are available for a variety of purpose. Mainly, the board operates at 5V while 3.3V is the operating voltage of each pin. The Vin is the input voltage that ranges between +7 to +12 V. This voltage comes from the external power source. There are two ground pins on the board. The AREF is an Analogue reference voltage, mainly used for analog pins. The IOREF is useful for powering and developing a compatibility between this board and Arduino Shields. As the shield is connected with this pin, it (shield) wears the I/O voltage provided by the Board. The Shield using IOREF pin will be compatible with both 3V3 and 5V. You can see the power source in the figure below.
ICSP Header
ICPS stands for In-Circuit Serial Programming – A feature used for programming Arduino with another Arduino. ICSP header is added that helps in connecting the board with a computer for uploading a sketch in case USB port is not available.

4. Programming

  • Arduino.cc has introduced its own official software, called Arduino IDE, for programming the Arduino module. This software supports common operating systems like Windows, Linux or MAC. Before you download this software, make sure the required software version is compatible with your system i.e. if you aim to download App version, you must have Windows 10 installed in your system as app version is not compatible with Windows 7 or 8.1.
You are ready to use the software as you install it. Some simple LED programs are already available on the software, giving you the flexibility to start working on the board in due course.
  • No external burner is required to burn the code inside the module as it comes with a built-in bootloader. Having said that, if you intend to insert a new controller on the module, you need to install the bootloader again using IDE software.
The Serial Monitor is added in Arduino Software, that helps you see the code working in real time as you verify and upload the code.
  • Arduino IDE comes with a compilation option that allows you to see the code compilation on the bottom of the screen as you upload the code. It generates hex file of the code which then is transferred into the board.

5. Difference between Arduino Leonardo and Arduino Uno

There is a slight difference between these two boards in terms of controller used, number of digital pins, PWM pins, and the pins reserved for SPI communication.
  • Arduino Uno incorporates ATmega328 while Arduino Leonardo comes with ATmega32U4.
Similarly, Uno has 20 digital I/O pins, out of them 6 are analog input pins and Leo has 23 digital I/O pins, out of which 12 are analog input pins.
  • There are 7 PWM output pins available on the Leonardo and 6 are added on the Uno board.
Uno comes with SPI protocol on the digital I/O pins while Leonardo contains SPI communication on the ICSP header pins.

6. Arduino Leonardo Projects and Applications

You can not write off the importance of Arduino Modules if you are working on a project that comes with a remote connection with automation. Arduino Leonardo comes with a wide range of applications and incorporates a number of peripherals, setting you free from the hassle of spending too much for buying external components. Following are some major applications Arduino can be used for:
  • Industrial Automation
  • Health and Security Systems
  • Creating wireless keyboard
  • Automatic Pill Dispenser
  • Embedded Systems
  • Student Projects
  • USB Trackpad
  • Water Level Meter
That’s all for today. I hope you have got a lot of information regarding Arduino Leonardo. However, if you are unsure or have any question you can approach me in the comment section below. I’d love to help you the best way I can. You are most welcome to keep us updated with your valuable feedback and suggestions, they help us provide you quality work that resonates with your needs and requirements. Thanks for reading the article.

Introduction to Arduino IDE

Hey Guys! Hope you are doing well. Today, I'll discuss the detailed Introduction to Arduino IDE, where IDE stands for Integrated Development Environment - An official software introduced by Arduino.cc, that is mainly used for writing, compiling and uploading the code in almost all Arduino modules/boards. Arduino IDE is open-source software and is easily available to download & install from Arduino's Official Site.

In this post, I'll take you through the brief Introduction of the Software, how you can install it, and make it ready for your required Arduino module. Let's dive in and get down to the nitty-gritty of this Software.

Where To Buy?
No.ComponentsDistributorLink To Buy
1Arduino UnoAmazonBuy Now

Introduction to Arduino IDE

  • Arduino IDE is an open-source software, designed by Arduino.cc and mainly used for writing, compiling & uploading code to almost all Arduino Modules.
  • It is an official Arduino software, making code compilation too easy that even a common person with no prior technical knowledge can get their feet wet with the learning process.
  • It is available for all operating systems i.e. MAC, Windows, Linux and runs on the Java Platform that comes with inbuilt functions and commands that play a vital role in debugging, editing and compiling the code.
  • A range of Arduino modules available including Arduino Uno, Arduino Mega, Arduino Leonardo, Arduino Micro and many more.
  • Each of them contains a microcontroller on the board that is actually programmed and accepts the information in the form of code.
  • The main code, also known as a sketch, created on the IDE platform will ultimately generate a Hex File which is then transferred and uploaded in the controller on the board.
  • The IDE environment mainly contains two basic parts: Editor and Compiler where former is used for writing the required code and later is used for compiling and uploading the code into the given Arduino Module.
  • This environment supports both C and C++ languages.

How to Download Arduino IDE

You can download the Software from Arduino main website. As I said earlier, the software is available for common operating systems like Linux, Windows, and MAX, so make sure you are downloading the correct software version that is easily compatible with your operating system.

  • If you aim to download the Windows app version, make sure you have Windows 8.1 or Windows 10, as the app version is not compatible with Windows 7 or older version of this operating system.
  • You can download the latest version of Arduino IDE for Windows (Non-Admin standalone version), by clicking below button:
Download Arduino IDE

The IDE environment is mainly distributed into three sections

  1. Menu Bar
  2. Text Editor
  3. Output Pane

As you download and open the IDE software, it will appear like an image below:

The bar appearing on the top is called Menu Bar that comes with five different options as follow

  • File - You can open a new window for writing the code or open an existing one. The following table shows the number of further subdivisions the file option is categorized into.
  • As you go to the preference section and check the compilation section, the Output Pane will show the code compilation as you click the upload button.
  • And at the end of the compilation, it will show you the hex file it has generated for the recent sketch that will send to the Arduino Board for the specific task you aim to achieve.
  • Edit - Used for copying and pasting the code with further modification for font
  • Sketch - For compiling and programming
  • Tools - Mainly used for testing projects. The Programmer section in this panel is used for burning a bootloader to the new microcontroller.
  • Help - In case you are feeling skeptical about software, complete help is available from getting started to troubleshooting.

The Six Buttons appearing under the Menu tab are connected with the running program as follows.

  • The checkmark appearing in the circular button is used to verify the code. Click this once you have written your code.
  • The arrow key will upload and transfer the required code to the Arduino board.
  • The dotted paper is used for creating a new file.
  • The upward arrow is reserved for opening an existing Arduino project.
  • The downward arrow is used to save the current running code.
  • The button appearing on the top right corner is a Serial Monitor - A separate pop-up window that acts as an independent terminal and plays a vital role in sending and receiving the Serial Data. You can also go to the Tools panel and select Serial Monitor, or pressing Ctrl+Shift+M all at once will open it instantly. The Serial Monitor will actually help to debug the written Sketches where you can get a hold of how your program is operating. Your Arduino Module should be connected to your computer by USB cable in order to activate the Serial Monitor.
  • You need to select the baud rate of the Arduino Board you are using right now. For my Arduino Uno Baud Rate is 9600, as you write the following code and click the Serial Monitor, the output will show as the image below.
  • The main screen below the Menu bard is known as a simple text editor used for writing the required code.
  • The bottom of the main screen is described as an Output Pane that mainly highlights the compilation status of the running code: the memory used by the code, and errors that occurred in the program. You need to fix those errors before you intend to upload the hex file into your Arduino Module.
  • More or less, Arduino C language works similar to the regular C language used for any embedded system microcontroller, however, there are some dedicated libraries used for calling and executing specific functions on the board.

Arduino Libraries

  • Libraries are very useful for adding extra functionality into the Arduino Module.
  • There is a list of libraries you can check by clicking the Sketch button in the menu bar and going to Include Library.
  • As you click the Include Library and Add the respective library it will be on the top of the sketch with a #include sign. Suppose, I Include the EEPROM library, it will appear on the text editor as

#include <EEPROM.h>

  • Most of the libraries are preinstalled and come with the Arduino software. However, you can also download them from external sources.

Making Pins Input or Output

The digitalRead and digitalWrite commands are used for addressing and making the Arduino pins as an input and output respectively.

These commands are text sensitive i.e. you need to write them down the exact way they are given like digitalWrite starting with small "d" and write with capital "W". Writing it down with Digitalwrite or digitalwrite won't be calling or addressing any function.

How to Select the Board

  • In order to upload the sketch, you need to select the relevant board you are using and the ports for that operating system.
  • As you click the Tools on the menu, it will open like the figure below:
  • Just go to the "Board" section and select the board you aim to work on. Similarly, COM1, COM2, COM4, COM5, COM7 or higher are reserved for the serial and USB board. You can look for the USB serial device in the ports section of the Windows Device Manager.
  • The following figure shows the COM4 that I have used for my project, indicating the Arduino Uno with the COM4 port at the right bottom corner of the screen.
  • After correct selection of both Board and Serial Port, click the verify and then upload button appearing in the upper left corner of the six-button section or you can go to the Sketch section and press verify/compile and then upload.
  • The sketch is written in the text editor and is then saved with the file extension .ino.

It is important to note that the recent Arduino Modules will reset automatically as you compile and press the upload button the IDE software, however, the older versions may require the physical reset on the board.

  • Once you upload the code, TX and RX LEDs will blink on the board, indicating the desired program is running successfully.
Note: The port selection criteria mentioned above are dedicated to Windows operating system only, you can check this Guide if you are using MAC or Linux.
  • The amazing thing about this software is that no prior arrangement or bulk of the mess is required to install this software, you will be writing your first program within 2 minutes after the installation of the IDE environment.

Arduino Bootloader

  • As you go to the Tools section, you will find a bootloader at the end.
  • It is very helpful to burn the code directly into the controller, setting you free from buying the external burner to burn the required code.

When you buy the new Arduino Module, the bootloader is already installed inside the controller. However, if you intend to buy a controller and put it in the Arduino module, you need to burn the bootloader again inside the controller by going to the Tools section and selecting the burn bootloader.

That's all for today. I hope I have given you everything you needed to know about Arduino IDE. If you are unsure or have any questions, you can ask me in the comment section below. I'd love to help you the best way I can. You are most welcome to keep us updated with your valuable feedback and suggestions, they help us provide you quality work so you keep coming back for what we have to offer. Thanks for reading the article.

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir