Traffic Signal Control using Arduino

Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a Traffic Signal Control using Arduino. Few days earlier, I have posted the same tutorial but it was Traffic Light Signal Using 555 Timer in Proteus ISIS and today we will do the same thing but using Arduino programming. Its quite a simple but good starting project on Arduino. So, if you are new to Arduino then must give it a try.

Traffic Signal Control is quite a usual thing. We see traffic signals daily on our roads and usually engineers are asked to design such projects in their initial semesters. If we look at the traffic signals then we can see they are simply turning ON and OFF lights at some fixed regular intervals. and the pattern is quite simple as well. so I have simply followed that pattern and design the code. You should also have a look at Arduino 3 Phase Inverter. So let's start with designing this project named as Traffic Signal Control using Arduino.

Traffic Signal Control using Arduino

  • First of all, design a circuit in Proteus for Traffic Signal Control using Arduino as shown in the below figure:
  • Its quite a simple project so the circuit is quite simple as well. You can see I have just placed an Arduino board and plugged three LEDs with it and obviously they are Green, Yellow and Red in color.
  • These LEDs are attached to pins 2,3 and 4 of Arduino UNO.
  • Now next step is to write the Arduino Code for Traffic Signal Control using Arduino, so I have written and it is shown below:
#define GreenLed 4 #define YellowLed 3 #define RedLed 2 void setup() { pinMode(GreenLed, OUTPUT); pinMode(YellowLed, OUTPUT); pinMode(RedLed, OUTPUT); } void loop() { digitalWrite(GreenLed, HIGH); digitalWrite(YellowLed, LOW); digitalWrite(RedLed, LOW); delay(5000);delay(5000); digitalWrite(GreenLed, LOW); digitalWrite(YellowLed, LOW); digitalWrite(RedLed, HIGH); delay(5000);delay(5000); digitalWrite(GreenLed, LOW); digitalWrite(YellowLed, HIGH); digitalWrite(RedLed, LOW); delay(3000); }
  • That's the complete code for this project Traffic Signal Control using Arduino and I think its quite self explanatory plus I have also changed the color accordingly.
  • First of all Green LED is ON and the rest are OFF which is shown in green color.
  • Next Red LED is ON and the rest are OFF after around 10 seconds which you can change by changing these delays.
  • Finally the Yellow LED will be ON and you can see it goes OFF just after 3 sec because it has short delay, you can change these delays quite easily.
  • Below is the flow chart of above programming for Traffic Signal Control using Arduino which will clear the theme properly.
  • Now compile your Arduino code and get the hex file.
Note:
  • Now when you upload the hex file into your Arduino, it will give output as shown below:
  • So that's how it will work, I hope you got this clearly as its quite simple, will meet you soon in the next tutorial. Till then take care!!! :)

Interfacing of RFID RC522 with Arduino

Hello friends, hope you all are fine and having fun with your lives. Today's post is about interfacing of RFID module RC522 with Arduino. RC522 is very simple yet effective module. It is an RFID module and is used for scanning RFID cards. Its a new technology and is expanding day by day. Now-a-days it is extensively used in offices where employees are issued an RFID card and their attendance is marked when they touch their card to rfid reader. We have seen it in many movies that when someone places ones card over some machine then door opens or closes. In short, its a new emerging technology which is quite useful.

I recently get a chance to work on a project in which I have to use RFID reader to scan cards. In this project I have used it for for student attendance so I thought to share it on our blog so that other engineers could get benefit out it.

Let's first have a little introduction of RFID and then we will look into how to interface RC522 with Arduino. RFID is the abbreviation of Radio frequency identification. RFID modules use electromagnetic fields to transfer data between card and the reader. Different tags are attached to objects and when we place that object in front of the reader, the reader reads that tags.Another benefit of RFID is that it doesn't require to be in a line of sight to get detected. As in barcode, the reader has to be in the line of sight to the tag and then it can scan but in RFID there's no such restriction. So, let's get started with Interfacing of RFID RC522 with Arduino.

You should also read:

Interfacing of RFID RC522 with Arduino.

Now let's start with the interfacing of RFID RC522 with Arduino. There are many different RFID modules available in the market. The RFID module, which I am gonna use in this project, is RFID-RC522. Its quite easy to interface and works pretty fine. This module has total 8 pins as shown in the below figure:

  • SDA
  • SCK
  • MOSI
  • MISO
  • IRQ
  • GND
  • RST
  • 3.3V
It normally works on SPI protocol, when interfaced with Arduino board. Interfacing of Arduino and RC522 module is shown in below figure:
  • The pin configuration is as follows:
  • Now, I suppose that you have connected your RFID module with Arduino as shown in above figure and table, which is quite simple. You just need to connect total 7 pins, IRQ is not connected in our case.
  • Now next step is the coding, so first of all, download this Arduino library for RFID RC522 module.
Note:
  • Its a third party library, we haven't designed it, we are just sharing it for the engineers.

  • Now coming to the final step. Upload the below code into your Arduino UNO.
#include <SPI.h> #include <MFRC522.h> #define RST_PIN         9 #define SS_PIN          10 MFRC522 mfrc522(SS_PIN, RST_PIN); void setup() { SPI.begin(); mfrc522.PCD_Init(); } void loop() { RfidScan(); } void dump_byte_array(byte *buffer, byte bufferSize) { for (byte i = 0; i < bufferSize; i++) { Serial.print(buffer[i] < 0x10 ? " 0" : " "); Serial.print(buffer[i], HEX); } } void RfidScan() { if ( ! mfrc522.PICC_IsNewCardPresent()) return; if ( ! mfrc522.PICC_ReadCardSerial()) return; dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size); }
  • Now using this code, you can read the RFID no of your card quite easily. Now the main task is to use that number and distinguish them so for that I changed the dump_byte_array function a little, which is given below:
#include <SPI.h> #include <MFRC522.h> #define RST_PIN         9 #define SS_PIN          10 MFRC522 mfrc522(SS_PIN, RST_PIN); int RfidNo = 0; void setup() { SPI.begin(); mfrc522.PCD_Init(); } void loop() { RfidScan(); } void dump_byte_array(byte *buffer, byte bufferSize) { Serial.print("~"); if(buffer[0] == 160){RfidNo = 1;Serial.print(RfidNo);} if(buffer[0] == 176){RfidNo = 2;Serial.print(RfidNo);} if(buffer[0] == 208){RfidNo = 3;Serial.print(RfidNo);} if(buffer[0] == 224){RfidNo = 4;Serial.print(RfidNo);} if(buffer[0] == 240){RfidNo = 5;Serial.print(RfidNo);} Serial.print("!"); while(1){getFingerprintIDez();} } void RfidScan() { if ( ! mfrc522.PICC_IsNewCardPresent()) return; if ( ! mfrc522.PICC_ReadCardSerial()) return; dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size); }
  • Now using the first code I get the card number for all RFID cards and then in second code I used these numbers and place the check now when first card will be placed it will show 1 on the serial port and so on for other cards.
  • So, what you need to do is to use the first code and get your card number and then place them in second code and finally distinguish your cards.
  • Quite simple and easy to work.
  • Hope I have explained it properly but still if you get any problem ask me in comments.

Pure Sine Wave Inverter Simulation in Proteus

Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share Pure Sine Wave Inverter Simulation in Proteus. I have already posted a tutorial on Pure Sine Wave Inverter Design, which got quite popular and I got a lot of requests on posting its simulation  in Proteus. So, I worked on it and finally I got it working and here I am sharing it with your guys. As, it got a lot of effort to design it in Proteus that's why its not open source but I have placed a very small amount of $50 on it and you can easily buy it from shop by clicking on the below button. It include the complete code as well as the Proteus Simulation working perfectly.

Let's start with the basics of Pure Sine Wave Inverter Simulation, first of all, I would recommend you to read the Pure Sine Wave Inverter Design as I have shared all the basics in it. AC voltage is actually a fluctuating voltage and is in the form of sine wave. If you got a pure sine wave then it has no losses in it, but if your design has losses then you never got able to get a pure sine wave. Instead you get a modified sine wave. Efficiency of pure sine wave is approximately 100% and you decrease the efficiency your sine wave also start to distract. So, in short pure sine wave contains no losses and is highly desirable. So, let's get started with Pure Sine Wave Inverter Simulation in Proteus ISIS:

Note:
  • The buying package contains complete working Proteus Simulation, along with Programming code and hex file for PIC16F877A.
  • You can buy it from shop by clicking on below button.

Buy this Simulation

Pure Sine Wave Inverter Simulation - Logical Model

  • Now, let's get started with the pure sine wave inverter simulation in Proteus. In this project I have used 12V DC battery and then converted it into 220V AC voltage and the AC we got was pure sine wave.
  • In order to do so you have to follow a proper pattern as shown in below figure:
 
  • Its quite obvious in the above figure, you are getting 12V supply from a battery so what you need to do is to pass it through a H-bridge. H bridge converter the 12V DC into 12V AC.
  • This is the most important block for pure sine wave as it does the real working. Depending on the switching of H- bridge either you get a pure sine wave or a modified sine wave.
  • Switching of H-bridge is done by the Microcontroller, here I have used PIC16F877A, which is normally used.
  • Now, after H-bridge you have 12V AC voltage, now there's a need to convert these 12V into 220V so that you could use it and for that I have used Transformer. Its a step up transformer which converts 12V AC into 220V AC.
  • Finally I have used a small LC circuit which acts as a filter and removes the ripples or noise if there's any. Noise normally comes from transformer. So, its a good precaution to use a filter rite after Transformer.

Pure Sine Wave Inverter Simulation in Proteus

  • Following these steps mentioned above, I have designed the Pure Sine Wave Inverter Simulation in Proteus.
  • First of all, I have designed a power supply to convert 12V into 5V so that I could feed it to microcontroller. The circuit is shown below:
  • As you can see in the above figure, I have used 12V supply and then converted it into 5V using 7805, which is a voltage regulator. The output of 7805 is then fed to PIC Microcontroller which is 5V.
  • Next block shown in below figure is the PIC itself and its basic circuit along with AND gates. AND gates are used to convert the signal into positive and negative because normally microcontrollers contain single CCP pin so that's why I have used one pin here and converted this single signal into positive and negative waveform of sine wave. Figure is shown below:
  • So here, we are generating the pure sine wave via PWM, the carrier frequency used in this code is 20kHz. Let's have a look at this scope.
  • Next comes is the main part which is the H bridge design, where we are inputting these signals coming from the PIC Microcontroller, to switch them accordingly. and after this H-bridge is the Transformer which is converting the 12V into 220V AC output. The image is shown below:
  • Now let's have a look on this second scope where we should get the Pure Sine Wave. I have inputted both the terminals of AC into oscilloscope so you will get sine wave on one end and inverted sine wave on the other end, both will be displayed in the oscilloscope. The image is shown below:
  • Here we got the pure sine wave at the output. Now I am not sharing the code here as I mentioned above we have designed it after a lot of efforts so its not free but we have placed a small amount on it of $50 so that you can buy it. You can get it from the shop by clicking on the button above.
  • The buying package contains complete working Proteus Simulation along with Programming Code and hex file.
That's all for today. I hope you have enjoyed this Pure Sine Wave Inverter Simulation in Proteus ISIS. If you have any questions regarding Pure Sine Wave Inverter Simulation, please ask in comments. Will meet in the next post. Till then take care and have fun !!! :)

NRF24L01 Arduino Interfacing

Hello friends, I hope you all are fine and enjoying. I have been working on a project these days and one portion of my current project includes the NRF24L01 Arduino Interfacing. So, I thought why not share this knowledge with you people, I hope you will learn something new and more interesting. If you don't know much about it, then you should have a look at Introduction to NRF24L01.

Few days ago, I have also posted a tutorial on XBee Arduino Interfacing, in which we have seen how to make wireless communication between two XBee Modules which is also an RF module. So, now we are gonna have a look at How to make Wireless Communication between two NRF24L01 modules. I hope you are gonna enjoy this nrf24l01 arduino Interfacing. Here's the video demonstration of NRF24L01 Arduino Interfacing:

Basics of NRF24L01

Before staring this interfacing of Arduino with 24L01, lets have a little introduction of nrf24l01 module. NRF24L01 is, in fact, a Radio Transceiver module and it operates on 2.4 GHz frequency. This module is a by default half- duplex fabricated module and it has the capability to send and receive data simultaneously. It's a very cheap & small sized module but it's features are astonishing. For example this module is capable of sending from 1 to 25 bytes of raw data simultaneously and the data transmission rate is up to 1 mega bytes per second. If we summarize all the features of this small size but big capability module then, we can say that:

  • By using this NRF24L01 module we can send a message to a particular receiver.
  • We can receive a message from some particular sender. (remember as I told earlier, we can do both the steps simultaneously).
  • During sending the message through this module, we will have to specify the message sender's and receiver's address.
  • Also we will have to specify the size of that particular message, which we are going to transmit through this module.
  • In some particular applications, we also have to perform switching between the receiver and sending state. For example, if you are received a particular message then, we will stop the communication first and will read it and then you will send it. So in such situations, we have to perform the switching while sending or receiving data through this module.
Now above discussion was a brief introduction about NRF24l01 module. Now lets move towards the major theme of our project which is Interfacing of arduino with NRF24l01 module. Note:
  • I encountered a problem of "Failed, response timed out" with NRF24L01+ while interfacing it with Arduino, if you got the same problem then read this post Interfacing of NRF24L01+ with Arduino - Response Timed Out. This nrf24l01 arduino example will help you in understanding this Response Timed Out problem.

NRF24L01 Arduino Interfacing

Arduino is a very powerful and versatile microcontroller board and it gives us the ease to perform multitasking. NRF24l01 has total 8 pins. The pin configuration and the function of each pin is described below:
  • The very first pin is for GND and through the pin#1 of this module, ground is provided to module.
  • Pin#2 of this module is to provide power supply. This pin is designated as VCC. This module generally needs 1.9 to 3.6 volts for its operation. And in most cases we will apply 3 volts to it.
  • Pin#3 is designated as CE and it is used to select the mode of operation. Either you are using this module to transmit data or to receive data.
  • Pin#4 is designated as CSN and it is used to enable the SPI chip, embedded on the module.
  • Pin#5 is used to provide SPI clock to the module. When this pin is HIGH then, clock is enabled and when this pin is LOW then, the clock to this module is disabled.
  • Pin#6 is designated as MOSI and it is used to transmit data from this module to the external circuit.
  • Pin#7 is designated as MISO and if we wish to receive data through this module from any external source then, this pin is enabled.
  • Pin#8 is the last pin of this module and it is designated as IRQ pin.
In order to do this Arduino with NRF24L01 communication, you will need two Arduino boards and two NRF24L01 modules. Now I suppose that you have these 4 items in your hand. So, first of all, let's do the transmitter side of NRF24L01 Arduino Interfacing.
NRF24L01 As Transmitter
  • Connect your NRF24L01 with Arduino as shown in the below figure:
  • Total 7 pins of NRF24L01 will be connected while the 8th pin IRQ doesn't need to connect.
  • Now, next thing you need to do is to download this RF24 Library of Arduino and place it in the libraries folder of your Arduino software so that we could compile our code of nrf24l01 arduino example.

Arduino Library for NRF24L01

  • We haven't designed this library, we are just sharing it for the engineers to use it in their projects.
  • Now upload the below sketch into your Arduino which you want to act as Transmitter.
    #include <SPI.h>
    #include "nRF24L01.h"
    #include "RF24.h"

    RF24 radio(9,10);

    const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
    unsigned long Command = 1;
    void setup()
    {
    Serial.begin(57600);

    radio.begin();
    radio.setRetries(15,15);
    radio.openReadingPipe(1,pipes[1]);
    radio.startListening();
    radio.printDetails();
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
    radio.stopListening();
    }

    void loop(void)
    {
    radio.stopListening();

    radio.write( &Command, sizeof(unsigned long) );

    radio.startListening();

    delay(1000);
    }
  • In this code, I have marked the variable Command, this is the variable which I am sending via NRF24L01, rite now its value is 1 which you can change.
  • So, if you want to send 3 you can change its value to 3.
  • Now lets design the receiver side.
NRF24L01 As Receiver
  • Again connect your Arduino with NRF24L01 as shown in below figure. Its same as we did for Transmitter side.
  • Now upload this below code into the Receiver and you will start receiving the value coming from transmitter.
    #include <SPI.h>
    #include "nRF24L01.h"
    #include "RF24.h"

    RF24 radio(9,10);

    const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

    typedef enum { role_ping_out = 1, role_pong_back } role_e;

    const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};

    role_e role = role_pong_back;

    void setup(void)
    {
    Serial.begin(57600);
    radio.begin();
    radio.setRetries(15,15);
    radio.openReadingPipe(1,pipes[1]);
    radio.startListening();
    radio.printDetails();
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
    radio.startListening();
    }

    void loop(void)
    {

    if ( radio.available() )
    {
    unsigned long data = 0;
    radio.read( &data, sizeof(unsigned long) );
    Serial.println(data);

    delay(20);
    }
    }
  • Now open your Serial Monitor of Receiver side and you will see that you are getting "1" in the Arduino Serial Monitor, which is the value of Command variable we set in the Transmitter side, as shown in below figure:
  • Its quite easy and I hope you will make it work in the first attempt but if you still got problem then ask in comments.
  • I will share more Arduino Projects on this RF module soon.
So, that's all for today and I hope now you can easily Interface Arduino with NRF24L01 and can do the RF communication. If you have any problem in this Interfacing of Arduino with NRF24L01 then ask in comments and I will try my best to resolve them. Take care. :)

Getting Started with Arduino Programming

Hello friends, i hope you all are fine enjoying. Today i am going to share a new project tutorial which is Getting Started with Arduino Programming. In the previous tutorial, which was titled as Getting started with Arduino Software, I have explained in detail the basics of Arduino software. How this software is installed and run.

Today's post is also related to arduino software but, the difference is that, in previous post we learn How to use the arduino software, What are the function keys of this software and Where to write the code(sketch) and after writing the sketch, how it is debugged. Now in today's post which is ' Getting started with Arduino Programming', we will see How a Code is written in Arduino software? What are the built-in functions of Arduino software? How comments are made in sketch? What are the main loops, used in Arduino programming? How pin selection is done in Arduino software? How Digital pins are controlled, which are embeded on Arduino board? To explain this whole software in detail, i have divided this tutorial into major parts and also their sub-parts. Above was a little introduction about what actually we are going to learn in this post. Now without wasting any further time on introduction (as i will be explaining each and every step in below tutorial) i think now we should move towards the actual learning of the Arduino software to use it for programming.

You should also read:

1- How to make Comments in Arduino Programming

  • I hope that you are a beginner and i will start to elaborate the soaftware from very beginning.
  • First of all open your Arduino software. Go to file menu, a new window will open, from there click on the Examples and then go the Basics.
  • After clicking on basics a third new window will open and it will be showing all the basic Arduino built-in basic functions.
Note:
  • If you haven't bought your Arduino UNO yet, then you can buy it from this reliable source:

  • For beginners the function named as blink is very useful, so i will also teach you from this basic level tutorial.
  • When you will click on 'blink' option then, a new window will open, which is shown in the image given below:
  • In the above shown image you can see that we have opened a basic level example from built in Arduino software.
  • Now under this heading title, i will explain how to make comments in Arduino programming?
  • This is in fact the syntax to make comments in your sketch.The above code is of very basic level and it elaborates how to blink a single led by using Arduino board.
  • If you look closely in the above image then you will see that some words are written in the start of the sketch and these words are encloses in these signs " /* ..........*/ ".
Note: Comments have no rule in sketch, neither they are as necessary to write in every sketch. We only add them in code to make the code user friendly or to make the user understand that what actually in happening in the code.
  • An other way to add the comments is to write " // .........." before every line in your sketch.
  • When you will do that before any particular line then, that line will become green and it will no longer have any effect in the sketch.
  • There is also a little difference in these both techniques of making comments.
  • First technique is used at that place where we have to write 3 or 4 lines together, or a large paragraph is to introduced in the sketch to make the user understand the sketch. We don't have make every line comments one by one. So, this method of making comments gives us ease.
  • While the second technique is used at that place, where we have to make comments in a single line.
  • Both these techniques have there own purposes and are used at that place where, we wish to use them.

2- Main Loops In Arduino Programming

  • Now the next step in learning Arduino programming is to learn about the main loops, which are used in Arduino programming.
  • To see what are the main loops, you simply go to the file menu and click on the new button and a second new window will open, which is shown in the image given below:
  • Above image is showing the main loops, which are used in Arduino software while programming.
  • The first loop is 'void setup' and the second loop is 'void loop'.
  • The syntax to write these both loops is also shown in the above image. But you should don't worry about the syntax of these loops because the good news is that the software it-self generated the syntax, when you open a new file to write the sketch.
  • Void setup is the first and the main loop while programming in Arduino. It is used for initialization and for configuration of constant values.
  • For example while writing a sketch if you are gonna need some constant values in your code then, it is necessary that you must initialize them first in this loop.
  • If you didn't initialize those constants first then, code will not execute properly and it will generate error.
  • The other main loop which is used while using programming in Arduino is "void loop", as you can also see it from the above given image.
  • An important thing to note here is that the compiler checks each and every line one by one in steps.
  • The compiler moves from top to bottom and in the first step, it will read every line of the " void setup() " and then it comes to the " void loop() " and it reads/compiles every line written in this portion.
Note: An important thing to remember here is that, the compiler reeds ' void setup() ' loop only once and on the other hand it reeds the second loop, named as ( void loop() ) again and again.
  • So from the above given info, we can conclude that ' void loop() ' is similar to ' while(1) ' loop, which is in fact an infinite loop.

3- Pin Mode Selection in Arduino Programming

  • In the above two portions of the today's tutorial we have seen, How to make comments while doing programming in Arduino software and secondly What are the main loop being used in Arduino programming.
  • Now we are going to the third stage which is Pin Mode selection in Arduino programming.
  • If you are aware of the other micro controllers like ATmel series, PIC or AVR, then you may also know that the pin configuration of these micro controllers are fixed.
  • Which means you have pre-decided input and output pins of the micro controller. Those micro controllers have definite pins for inputs and also for outputs and they can only be used for that specific purpose.
  • For example if a micro controller have a input port then all the pins on that port will be used to receive data and you can't use them to send data.
  • While working with Arduino micro controller gives us a flexibility that every I/O pin available on the board (except for some definite pins like VCC,GND, etc) can be used as input or output pin.
  • For example if we wish to connect a led at the pin#2 of our Arduino board, which means we are going to make this pin#2 as a output pin.
  • For Arduino board we will send data to this pin through our code, which means we have made this pin as an output pin.
  • The syntax to write command to do this function is:
pinMode (2 , OUTPUT)
  • By writing this command in the code, we have made pin#2 as a output pin.
  • And if we connect some kind of sensor at this port and we have to take the value of that sensor as an input then, we will have to make pin#2 as an input pin.
  • In order to make the same pin as an input pin, we will have to write the command in the following syntax:
pinMode (2 , INPUT)
  • By writing this command, Arduino board will automatically made the pin#2 as an output pin.
  • Pull-up criteria is also very important in writing any commands for Arduino board.
  • There is only one problem with all the Arduino boards that, we whenever an un-initialized pin is used in our code then the Arduino board send some garbage value to that particular pin.
  • To overcome this problem we have to set some particular value for each and every pin. and we ahve to define state of every pin that either it is HIGH or LOW.
  • For example we can say that the function of pin#3 is that GND is always connected to that pin and if ground is not available at any case then we will send +5V to that pin to keep that pin in a particular position.
  • The Arduino board command for pull-up purpose is:
pinMode(2 , INPUT_PULLUP);
  • This command will automatically decide the particular value of every pin.

4- Digital Pins Controlling in Arduino Programming

  • Now the fourth part of the today's tutorial in learning of Arduino Programming is How digital pins are controlled while coding in Arduino.
  • Arduino board is a multi purpose micro controller and it is also capable of sending and receiving data from Digital as well as Analogue data.
  • It is our choice to make every pin as an input or output pin and similarly either it has to send or receive Digital data or it has to send or receive analogue data.

I/P Digital Pins:

  • For example, i wish to make my pin#2 as an Digital input pin, which means it will read digital data from some external source.
  • The command to do this function is given below as:
digitalRead(2); boolean sensor=digitalRead(2);
  • The first command is teeling the Arduino compiler to make pin#2 as a digital pin and the compiler will take Digital input data from that pin.
  • While the second command i have written is to save the command in a variable.
  • In this command i have introduced a datatype named as 'boolean' . You can also change the name of this datatype.
  • And the name of the variable is 'sensor'. I have kept the name 'sensor' and you can also change this name according to your own choice.

O/P Digital Pins:

  • Next if you wish to make these pins as an output pins then we can also do that.
  • Suppose now if you want to make your pin#2 as an output pin and you wish to send data to this pin or you want to define the state of this pin then the commands, which you will write are:
digitalWrite(2,HIGH); digitalWrite(2,LOW);
  • In the syntax of writing the command, we will first write no of the pin and then we write it's state.
  • The first command is showing that we are writing digital data on our pin#2 and we are going to set it in HIGH/ON state.
  • The second command shows that we are going to set the pin#2 in OFF state.

5- Analogue pins controlling in arduino programming

  • In this section of the tutorial we are going to see how to control the Analogue pins of an Arduino board.

I/P Analog Pins:

  • As i have explained above in detail that how we can digitally take or send data using Arduino pins.
  • An interesting feature is that Arduino board pins can also be used to send or receive data in an analog pattern.
  • Since my heading is to input analog data, to understand this pattern suppose that you are going to read some analog voltage from pin#2 of arduino board.
  • In order to do that, the commands which you will write in Arduino software are as:
analogRead(2); int sensor Value = analogRead(2);
  • As you can see that the syntax to read Digital and Analog Data is same.
  • In first command i am reading the analog data from external source at pin#2 of arduino board.
  • In the next command i have stored that data into a variable named "sensor value" .
  • After that all the analog data which will appear at pin#2 will be stored in 'sensor value'.

O/P Analog Pins:

  • Now if we wish to use the pins of Arduino board as an output pins then it is also very easy and you can also do that by following some simple steps.
  • If you wish to use any pin to write data or we can say that you wish to turn a switch ON or OFF then, the syntax will be as:
analogWrite (3,HIGH); analogWrite (3,LOW);
  • The first is showing that a switch has been connected at pin#3 and you wish to turn it ON and you will write the first command in Arduino sketch.
  • The second command is showing that a switch is already in ON state, which is connected at pin#3 and we wish to turn it OFF then, we will write the second command in our Arduino sketch.
Alright friends, today's tutorial was a little bit lengthy but very informative for beginners who are keen to learn Arduino software. If you have any questions then, ask in comments and i will try my best to solve the problem. Till next tutorial take care !!! :)

What is Serial Port

Hello friends, i hope you all are fine and enjoying. Today i am going to share a new project tutorial which is What is serial port? We can also judge from its name that this pin that this may be the pin used for data communication. So we can say that Serial port is such a device which is used for communication of data in a serial manner. and an important thing to remember here is that this port can communicate only one bit at a time.

Serial port is now used in almost all type of computers and it is used to connect some some devices like modems, monitors, LCDs and some models of printers to the mother board of computer. If we talk broadly then some devices connected to the computer like Ethernet, USB etc  also requires serial data stream for communication but the name serial port is reserved for that case when you connect a Modem or some similar device which needs to communicate data in a serial manner. Serial ports have been used in past with almost all models of the computers but with the invention of modern technologies like USB, FireWire and some other faster means of data communication, serial ports have been eliminated now and are now replaced by the modern means of data communication. If you still have a old model of a computer at your home or work and you wish to identify that which one is serial port then, look at the back side of your computer and you will observe a 8 pins D shape male connector. As i have shown one of them in the featured image of this tutorial. Now lets move towards the hardware of the serial port and see whats hidden inside this small port and what are the practical applications of this port. so'save a the answer question,

What is a Serial Port?

The old models of IBM computers had been using a small electronic integrated circuit named as UART and it was used to transmit and receive data to and from a external asynchronous device in a serial manner. But with the inventions of modern technology some small home computers then started to make a algorithm in which CPU was used directly to send and receive data from external means. And this technique was known as bit-banging technique.

Early invented computers also have a at-least one serial port and this serial port had different pins in it and every pin was designed to work on a different voltage level, and this serial pin was compatible to work with RS-232. But there was a problem with the operation of such system that the serial port was unable to understand the different voltage levels of RS-232 and different manufacturers had different devices that operated on different voltage levels. So there was need to design such device which should be able to work on same voltages and should be compatible with all the devices, of any manufacturer. Now with the invention of modern devices like USB, FireWire the modern and even low cost processors are able to serial communicate data with a faster speed. And they are able to support devices like mass storage, sound players and video player devices. Now a days in-spite of that fast that what have been invented, every personal computer in use also contains a serial port. The small laptops have a very conserve space so it is possible that some companies may have omitted serial ports from their models but as i have stated above that serial ports had been used for a very long time periods and the circuits used to control and operate the serial ports have become very cheap and some models also comes with the serial port chip fabricated with the circuitry of parallel port.

Pin Configuration of Serial Port

Serial port have total 9 pins. Every pin has its own functioning and purpose. The purpose of each pin is explained below as:

  • The pin#1 of serial port is named as 'DCD'. The purpose of pin#1 is Data Carrier Detect. It is used to detect the data stream which is being carried bu the buses for sending to other devices or for receiving.
  • Pin#2 of serial port is named as 'RxData'. The purpose of this pin is to monitor the data which is received by serial port from some external means.
  • The next pin which is pin#3 of serial port is named as 'TxData'. The purpose of this pin is to transmit data from serial port to the external module, where we wish to send data. Remember that serial port only transmit data at the rate of one bit per second.
  • Pin#4 of serial port is named as 'DTR' and it is called Data Terminal Ready. The purpose of this pin is to see the data which is to transmit but it has not been sent yet. The data is available at the sending port of serial port and it needs the go signal from micro processor.
  • Pin#5 of the serial port is 'GND' and it provides ground to the serial port voltages for data communication.
  • Pin#6 is 'DSR' and it is abbrivation of Data Set Ready. This pin is used to determine the data transmission rate. Data is available at the port but it has not been sent yet.
  • Pin#7 is 'RTS'. This pin is the signal for sending the data to external means. When data is available at pin#3 of the serial port and to send this data you have to get permission from control circuit and pin#7 which is in fact RTS pin does this job.
  • Pin#8 is 'CTS'. It is known as Clear to send. When pin #7 gets requests to send the data and if it gets the permission then data is now ready to send and pin#8 sends it in serial manner.
  • Pin#9 is the last pin of serial port it is a ring indicator and it is abbreviated as 'RI'.

Applications and Usage of Serial Port

Serial port possess a large no of practical applications and usage. It is true that it have been eliminated by the modern technology but still there are many devices which are only connected through serial port. Some of serial port's applications are listed below as:

  • They are most commonly used on some engineering projects with micro controller, where they have to communicate with a personal computer or some other similar devices.
  • Biggest application of serial ports is that they are used to connect to modems.
  • LCD and flat screen monitors are used to connect to the computers through this serial port device.
  • Some devices which are used for network sharing are also connected through this serial port. Some networking devices are like firewalls and rotors etc.
  • Serial port is also used in special applications of GPS (global positioning system) and they are used either to send data or to receive data in serial manner.
  • Also used for scanning bar codes of different products. Mostly serial port is used in some big shops and markets to detect which product you are selling.
  • Serial port sends or receive data in a serial manner, so they are also used in some applications where you wish to display some text on a particular LCD.
  • Serial port is a portable and very much sensitive device and it is also used is modems of satellites and also in some transceivers.
  • Used in some digital testing and measuring electrical instruments like digital multimeter. Where you measure the voltages or current of a particular system.
  • Serial ports have a variety of applications in some mechanical design CNC machines. In these machines, serial port is used to transmit or receive data from micro controller of the machine.
  • Also used in some definite models of UPS (uninterruptible power supply). These UPS are specially designed to operate with computers or LCDs.
  • Used to connect some old models of printers or digital cameras with your computer.
  • The early models of telescopes also had a port for serial port and used for serial data communication.
  • Serial port is also used to operate serial type mouse.
Alright friends, that was all from today's post. I hope you have learned from today's post. If you have any problem then, feel free to ask. Till next tutorial Take Care!!! :)

Interfacing PIR sensor with Arduino

Hello friends, i hope you all are fine and enjoying. Today i am going to share a new project tutorial which is Interfacing PIR sensor with Arduino. First of all lets, have a little introduction about the basics and working of the PIR sensor. PIR sensors are in fact a Passive Infrared Sensor. PIR sensors are actually electronic sensors and they are used for motion detection. They are also used to detect the Infrared waves emitting from a particular object. You should also have a look at PIR Sensor Library for Proteus, using this library now you can easily simulate your PIR Sensor in Proteus software.

PIR sensors are widely used in motion detection projects now a days. Since my today's tutorial is about interfacing of PIR sensor with Arduino micro controller. Before going to that it is necessary that we should first understand the construction and working principle of PIR sensor. So i am going to divide my tutorial into different blocks and i will describe PIR sensor from its construction to practical applications. So first of all, lets see the construction and operating principle of PIR sensor.

Construction of PIR sensor

The construction of PIR sensor is very simple and easy to understand. In the bottom or you can say in the core of the PIR sensor we have a set of sensors which are made of pyro-electric materials. The properties of this material is that when this material is exposed to heat then, it generates energy. Different methods are used to to measure this energy generated by PIR sensor. On the top of the PIR sensor and above the internal sensors we have a small screen through which infrared radiations enters into sensor. When these radiations falls on the pyro-electric material then it generates energy. Generally the size of this sensor is very small and it is available in the form of thin film in market. Many other materials are also used in collaboration with pyro-electric material like galliam nitrite and cesium nitrate and all these materials take the form of an small integrated circuit.

Operating Principle of PIR sensor

The modern studies in the field of quantum physics tells us the fact each and every object when it is placed at a temperature above absolute zero, emits some energy in the form of heat and this heat energy is in fact the form of infrared radiations.  So an other question comes into mind that why our eyes can't see these waves? It is because that these waves have infrared wavelengths and his wavelength is invisible to human eyes. if you want to detect these waves then, you have to design a proper electronic circuit.

If you see closely the name of PIR sensor which is Passive Infrared Sensor. Passive elements are those elements that don't generate their own voltages or energy. They just only measures things. So we can say that this sensor is a passive infrared sensor and it doesn't generate anything by itself. It is only capable to measure the rediations emitted by other objects around it. It measures those raditions and do some desired calculations on them.

Interfacing of PIR Sensor with Arduino

PIR sensor have total 3 pins. The configuration of each pin is shown in the image given below:
  1. Pin#1 is of supply pin and it is used to connect +5 DC voltages.
  2. Pin#2 is of output pin and this pin is used to collect the output signal which is collected by PIR sensor.
  3. Pin#3 is marked as GND pin. This pin is used to provide ground to internal circuit of PIR sensor.
This whole configuration is also shown in the image given below:

The pin configuration of a PIR sensor is shown in the image given above. Since we have to interface the PIR sensor with Arduino micro controller. The image showing the interfacing of PIR sensor with Arduino is shown below as:

Interfacing Code

The code for interfacing Arduino micro controller with PIR sensor is given below as:
    #define pirPin 2

    int calibrationTime = 30;
    long unsigned int lowIn;
    long unsigned int pause = 5000;
    boolean lockLow = true;
    boolean takeLowTime;
    int PIRValue = 0;

    void setup()
    {
    Serial.begin(9600);
    pinMode(pirPin, INPUT);
    }

    void loop()
    {
    PIRSensor();
    }

    void PIRSensor()
    {
    if(digitalRead(pirPin) == HIGH)
    {
    if(lockLow)
    {
    PIRValue = 1;
    lockLow = false;
    Serial.println("Motion detected.");
    delay(50);
    }
    takeLowTime = true;
    }

    if(digitalRead(pirPin) == LOW)
    {

    if(takeLowTime){lowIn = millis();takeLowTime = false;}
    if(!lockLow && millis() - lowIn > pause)
    {
    PIRValue = 0;
    lockLow = true;
    Serial.println("Motion ended.");
    delay(50);
    }
    }
    }

Applications of PIR sensor

PIR sensors possess a no of applications and due to their low cost and much advanced features they are the main focus of different projects being made now a days. Some of their features and practical applications are listed below as:

  • They are able to sense the detection of people and other objects.
  • PIR sensors are also used in automatic lightening systems. In these type of systems, when a person comes in the vicinity of the sensor then, the lights are automatically turned ON.
  • They are used in outdoor lightening systems and also in some lift lobbies. You may have observed that when a person comes in front of the lift and if the doors are being closed then, the doors are opened again. This is all due to PIR sensors.
  • They are widely used in underground car parking system. At every parking position a PIR sensor is installed and when that position is vacant then, a green light glows over that place which means you can park here. And if that position has been occupied then, a red light will glow, representing that this position is already occupied.
  • PIR sensor is much compatible sensor and it has the ability to detect a particular motion and the output of this system is very sensitive and doesn't have any kind of noise in it.
Alright friends, that was all from today's post. If you have any questions, fell free to ask. Till next tutorial Take Care!!! :)  

What is Operational Amplifier?

Hello friends, i hope you all are fine and enjoying. Today i am going to explain a very simple but very important tutorial which is named as what is operational amplifier? Operational Amplifier or commonly known as op-amp is a voltage amplifying device. The output of op-amp is much much larger as compared to the potential difference between its input terminals. Operational amplifier has much importance in today's electronic projects and it is also known as a fundamental building block of the analogue electronic circuits. Operational amplifiers were invented a long time ago and they ere also used in computers of old age. In those computers the function of operational amplifiers was to perform mathematical operations.

Operational amplifiers have a large no of applications and are most commonly use to perform some electronic operations like signal conditioning. When signals are transmitted over a long distances and what mostly happens is the strength of the signal is weakened. and some noise and disturbances are also included in it. to overcome these issues, we use repeater circuits and after some times the amplitude of signal is again boosted up with the help of operational amplifier. Similarly op-amp are also used for filtering of the signal. They are also used in logic designed projects to perform mathematical operations like addition, subtraction, integration and differentiation. The reason why operational amplifiers are much popular and are widely used in digital electronic circuits is that, they possess versatility.

Above was a little introduction about operational amplifier, its working and its applications. Now lets explain some other parameters of operational amplifiers which are given as below:

Pin configuration of operational amplifier

Operational Amplifier has major 3 pins. Among these 3 pins, 2 pins are reserved for input and these pins are of much High Impedance. One input of the operational amplifier is known as inverted input and it is marked as negative sign (-) while the other pin of the operational amplifier is known as non-inverting input and it is marked as positive sign (+). Both these inputs have High impedance. The third terminal of the operational amplifier is its output pin and it is of Low impedance. You can also see the pin configuration of op-amp in the feature image of this tutorial.

Characteristics of an op-amp

Operational amplifier is a very important amplifier and used as a building block in various electronics projects. Op-amp possess the following features:

  • The open loop gain of the differential amplifier is Infinite. Formula to calculate gain is:

G = V(out)/V(in)

Now if we are using the operational amplifier in open loop condition then, the input voltages 'V(in)' will becomes zero and the Gain will become infinite.

  • In op-amp there is an input impedance between both terminals of the operational amplifier. In OFF condition, the value of this impedance is much HIGH and mostly it is taken as 'infinite'. The reason to kept such a high value is to permit any current to flow between the input terminals of the op-amp.
  • For a differential operational amplifier input offset voltages are kept zero. This also permits any current to flow.
  • A very important feature of the operational amplifier is that we have a large no of voltage range, which can appear at the output terminal of op-amp. Since op-amp are designed to amplify the voltages up to a wider value, that's why we can say that infinite values of voltages are available at output terminal of operational amplifier.
  • When AC voltages are applied at its input terminals then, op-amp is capable to perform zero shift. Reason is that in electrical, we have various instrument like Transformer, which gives us the phase shift at output voltages. And the output voltages possess a different phase angle as compared to input voltages.
  • Operational amplifier have no impedance connected to its output terminals and we can say that it has zero or negligible impedance.
  • The operation of op-amp is without any kind of noise. The operation of op-amp is noise proof and no problems occurs during its operation.

Operation of Op-Amp

Operational amplifiers have 2 differential inputs which are named as 'Inverting' and 'non-inverting' inputs. In actual case the operational amplifier only amplifies those inputs difference which is applied between its input terminals. The output generated at its terminals can be calculated by the formula given below:

V(out) = G(o.l) {(V+)-(V-)}

  • In the above formula you can see that V(out) represents the output voltages which appears at the output terminal of operational amplifier.
  • G(o.l) is the open loop gain of the operational amplifier.
  • V+ are the voltages applied to the non-inverting input of op-amp.
  • V- are the voltages applied to the inverting input of op-amp. Generally ground is connected at this pin.

Applications of Operational Amplifier

Operational Amplifiers have a large no. of applications and some of them are given below as:
  • Operational amplifiers are widely used in designing of basic and also advanced electronic projects. The use of operational amplifier as a building block in various projects allows us to get our output much pure and cleaner. The word cleaner emphasis on the part that the other circuit elements like resistance, capacitance, inductance etc, effects the output of the circuit and they also distort it.
  • The biggest application of the operational amplifier is 'voltage comparator'. In order to use op-amp as a comparator, we design a circuit without any feedback. To use op-amp as a comparator gives us the opportunity to get wider range of output voltages and also state switching is done in a faster way, which means it can go from ON to OFF state within no time.
  • Op-amp can also be used to design a level detection circuit in terms of voltages. For example if you connect the input or the reference voltages of the  circuit to one of the input of the op-amp then, it will start behaving as an voltage level detection circuit.
  • Op-amp are commonly used in radio transmission circuits. They are able to amplify the output many times, that's why they are preferred for signal transmission.
  •   Op-amp have wide applications in digital electronics and are commonly used to design filter circuits, differential amplifiers and some integration based circuits.
  • Op-amp are also commonly use to design ADC (analog to digital converters) and also DAC (digital to analog converters).
  • Op-amp are used as a major element in designing voltage clamping circuits and oscillators.
  • An interesting application of op-amp is that they are also used to design analogue calculators and some similar electronic products.
Alright friends, that was all from today's tutorial about operational amplifiers. In the coming tutorials, i will also explain some practical applications of operational amplifiers. If you have any questions then, feel free to ask in comments and i will try my best to solve the issue. Till next tutorial Take Care!!! :)

What is 555 Timer?

Hello friends, i hope you all are fine and enjoying. Today i am going to share a new tutorial in which I am gonna explain What is 555 timer? We all know about 555 timer, which is an 8-pin IC (integrated circuit), most commonly used in electronic projects, built now a days. As you can see fron its name that it is a timer and designed to generate PWM.

In today's tutorial i am going to explain, what's hidden inside this 555 timer IC and what is 555 timer. A 555 timer is a much compatible electronic device and the biggest feature of this IC is that it able to work on both analogue and digital techniques. Now if we simply consider the output of the 555 timer then, at any particular time, this timer has only 1 definite state. Which means at any time, it will be either ON or OFF. It is not possible that its output is ON and OFF simultaneously. A new invention of 555 timer has also been discovered which is named as 556 timer. 556 is in fact a Dual version of 555 timer and it contains 2 555 timers in a single IC. 556 is a 14 pin IC. Now you will think that 555 timer is a pin IC and as i said that 556 contains two 555 timers then, it should have 16 pins. The answer to this question is that, when two 555 timers are connected to each other then the VCC and GND of both ICs is made common so, we have 14 pins instead of 16. Now let's move towards the basic theme of our tutorial. In this tutorial i will be explain the steps, the pin configuration of 555 timer, It's different modes and project applications.

Internal Design of 555 Timer

Before going into details of what is 555 timer, let's first come to the internal design of a 555 timer. The outer shape of the 555 timer may look like very simple but there is a complex mechanism hidden inside that small IC. A 555 timer contains 25 transistors, 15 resistors and 2 diodes, which are connected to each other in a very complex manner. An interesting thing to know here is that all these components are embedded on a single small silicon chip. Some other series of 555 timers are also available in market like NE555 timer, which we commonly use in our engineering or electronic projects. And the second series is SE555.  SE555 series was designed for military purposes. These operating temperature ranges of both NE555 ans SE555 are given below as:

  • NE555 is mostly used for basic level projects and such high level accuracy is not demanded in it so it is capable to operate from 0 ~ 70 degree Celsius.
  • SE555 was designed for military applications and it is used in those projects where high precision is required. The operating temperature of this IC is -55 ~ +125 degree Celsius.

Pin configuration of 555 Timer

Let's have a look at pin configuration to know what is 555 timer. As I described earlier that 555 timer has total 8 pins. As i described that 555 timer is a multipurpose IC and it is capable to perform variable function. So through some proper arrangement of connections, we can made this IC to do different tasks. Now i will explain the every pin no. and its purpose so that we know the answer to our main question what is 555 Timer ??? :)

  1. The pin designated as pin#1 is GND pin. This pin is used to provide reference voltage or ground to 555 timer.
  2. The pin designated as pin#2 is TR pin. It is used for triggering of 555 timer. The operating voltages of 555 timer is 4.5V ~ 15V. When the operating voltages exceeds 5V then, the 555 timer triggers and it generated output or we can say that now it has crossed that limit above which it will generate output.
  3. The pin designated as pin#3 is the output pin of 555 timer. Through this pin, the output of 555 timer goes to the external circuit. The output depends on the purpose for which you are using 555 timer. For example if you are using your 555 timer to generate PWM then its output will vary. Sometimes it will go High and some time it will go Low.
  4. The pin designated as pin#4 is Reset pin of 555 timer. If you look closely on the first feature image of the tutorial then, you yourself will understand that it is a NOT function. Which means that in order to reset the 555 timer you will have to give '0' at that pin and after the compliment it will become High and 555 timer will 'Reset' .
  5. The pin#5 of 555 is 'CTRL' pin. It is in fact a control pin of 555 timer. This pin gives us the direct access to the internal voltage divider of the 555 timer, which is fabricated inside that small silicon chip. We can divide the voltages according to our output requirements.
  6. The pin#6 is named as 'THR' pin of the 555 timer. For the supply voltages, 555 timer has kept a reference value for them. For example when the supply voltages exceeds 5 volts then, the this pin becomes activated and the 555 timer starts to generate output or it sends data to its output pins.
  7. Pin#7 is named as 'DIS' of the 555 timer. This pin is in fact the discharge pin of 555 timer and used to discharge the capacitors between intervals. This pin has the biggest advantage when, we are generating PWM through 555 timer.
  8. The last pin is pin#8 and it is designated as 'VCC' . This is the supply pin of 555 timer. Source is connected at this pin and as i have already explained that the supply voltages range for 555 timer is 4.5V ~ 15V, but generally it triggers above 5 volts.

Modes of Operation - What is 555 Timer ???

In order to know what is 555 Timer, we should have a look at its modes of operation. 555 timer has 3 major modes of operations. All these modes have there own applications and advantages. All the 3 modes are explained in below:

Astable Mode of 555 timer:

From the name of this mode 'astable mode', you can understand that, in this mode, we don't have any stable output of 555 timer. While operating in this mode, the output will be continuously fluctuating and we will be obtaining a square wave form on the output pin of the 555 timer. To operate the 555 timer in Astable mode, you will have to draw the following circuit, which is shown in the image below:

  • Astable mode is also used to flash lamps and leds. A very similar project named as Sequential LED blinking using 555 timer has also been uploaded by our team. In that project 555 timer was again being used in astable mode.

Monostable Mode of 555 timer:

In this mode of operation the 555 timer gives only one output pulse in addition to the intentional trigger input. For example if you will press the button then, 555 timer will produce a output pulse and its length remains constant until you again press the button and the 555 timer will generate another pulse. The circuit to use 555 timer in monostable mode is shown in the image given below:

  • Monostable mode of 555 timer has wast application. In this state it is used as a timer, touch switches.
  • The biggest example of this mode is to generate PWM. If you recall one of my previous tutorial which was Angle control of servo motor using 555 timer, then at that stage we were using a 555 timer to generate a PWM and through this PWM, we were controlling the angle of micro servo motor.
  • This mode is also used for capacitive measurement and also for missing pulse detection.

Bistable Mode of 555 timer:

The third and the last mode of operation of 555 timer is to use it in bistable mode. This thing is understood from its name 'Bistable' which means this circuit will have 2 stable states, which we are going to control. The circuit diagram to operate a 555 timer in bistable state is shown in the image given below:

  • The above shown circuit is of bistable mode of 555 timer.
  • As you can see in the above figure, we have 2 push buttons. One is connected to 'THR' pin and the other is connected to 'TRIG' pin of 555 timer.
  • When we will press the 'TRIG' button, which means that we have connected the trigger state to ground and its state has become LOW. By doing that the output of 555 timer will become High.
  • On the other hand, when i will press the 'RESET' button then 'THR' pin of 555 timer will be grounded and the output of 555 timer will become LOW.
  • In this way we have made the 555 timer to work in 2 different states and that's why it is called Bistable mode of operation of 555 timer.
If you wanna read more about 555 Timer then you must check below simulations on 555 Timer: Alright friends, that was all from today's post. I hope you have learned something new today and have got your answer for our first question what is 555 timer and if you have any questions then please ask in comments and i will try my best to resolve the issue. Till next tutorial Take Care !!! :)

Getting Started with Arduino Software

Hello friends, i hope you all are fine and enjoying in life. On a friends request, today i am going to share a new tutorial which is 'Getting Started with Arduino Software'. Previously i have uploaded a large no of project tutorials made on 555 timers and some MATLAB based Simulations. Now we are going to touch the next level and from now on we will work on mostly projects containing Arduino microcontroller.

To get started with Arduino microcontroller, we first need to learn the operating software of Arduino microcontroller. This tutorial is very informative and i will be using Arduino software 1.0.5. It is a very basic level software and very easy to learn. IF you have already worked on Arduino software then you don't need to go through it. This tutorial is only for begineers who have just bought the Arduino board and don't know wht to do with it. :)

This software is very user friendly. There are two versions of Arduino software available on theArduino official site. One isexe file which you need to install in your computer. While the second version is a simple rar file and you don't have to install the 'exe' file in your computer. You only copy the software at a particular folder and when you double click on it, it automatically starts to run. I will be explaining this tutorial in various parts. We will see all the options available in main menu and their functioning. Now i think we should move towards the actual working of the software and see how it woks and what are its control parameters.

Getting Started with Arduino Software

  • First of all copy the Arduino software folder where you can easily access it. For example, copy the folder on desktop of your computer.
  • Double click the folder and the next window will show all the sub-folders, which contains the libraries, hardware tools, references and all other things.
Note:
  • If you haven't bought your Arduino UNO yet, then you can buy it from this reliable source:

  • That window is also shown in the image given below:
  • The above image is showing all the sub-folders and and the Ardunio running application.
  • The above folder is showing the examples, drives, hardware, libraries, references, tools of the Arduino software.
  • When you will double click on the icon named as 'ardunio' then arduino software will start to run.
  • The next window which will open is shown in the image given below:
  • A very important thing to note is that when we write code in Arduino software window then, it is called a sketch.
  • This software automatically gives the name to the code, which you are going to write.
  • For example i have open the command window of Arduino software, then it saves every sketch with that particular date on which you are gonna write that sketch.
  • Since today is May 13, 2015 and this software has automatically saved the sketch with today's date.
  • Now coming towards menu bar, we have 5 options. I will explain all of them one by one.

File Menu Description

  • When you will single click the 'File' button then, a new window will open which is shown in the image given below:
  • This list is showing all the components which are encoded in 'File' button.
  • First option is 'new' and it will open a new window or new sketch. Next is 'open' and it will open the file or sketch which you will select and will try to open in Arduino software.
  • Next options are 'sketch book' and 'examples'. When you will click the examples button then it will open the Arduino libraries.
  • The Arduino libraries are shown in the inage given below:
  • This option will give all of the Arduino libraries. Arduino libraries are very useful in learning the basic code of Arduino.
  • For starters, you can go to the first option which is, '01. Basics' and it will give you some libraries of that projects which are very easy to understand.
  • You can simply click on any option and the code will automatically load into Arduino software.
  • Next options are 'close', 'save' , 'save as'. These options are very simple and every user is aware of these options.
  • Next option is 'upload'. It is very important option and it will load the particular code into Arduino sketch file.
  • Next option is of 'upload using programmer'. This option uploads the code into Arduino sketch which is written in some other software.
  • Next option is of 'page setup'. It gives you the options about alignment of the page and what size of sketch you want to keep.
  • Then comes the 'print' option and 'preferences'. When you will click on  'Preference' option then a new window will open and this window is shown in the image given below:
  • This window will open and it will be showing sketckbook location. where you wish to save all your sketches. We will give it location only once and afterwards it will automatically save the file at that particular location.
  • You can also select the language, in which Arduino sketch will be written and the font size can also be selected.
  • This option also gives the check flag. For example either you want to update or Arduino software version or you tends to use the existing software and many other options.
  • The last option in file menu is 'Quit'. By clicking on this option, Arduino software will close and the sketch which is running at that particular time will stop.

Edit Menu Description

  • After file menu then comes the 'Edit' menu. When you will single click on that icon then, a new window will open, containing all the options which are ancoded in 'Edit' menu.
  • That new window is shown in the image given below:
  • The first 2 options in Edit menu are 'Undo' and 'Redo'. If accidentally something goes wrong then, you will press undo button and problem will be eliminated.
  • Redo is the opposite of Undo option.
  • Next options are 'cut' and 'copy'. Nearly all users are aware of their functions.
  • The next option is 'copy from forum'. It will copy the sketch from a particular forum and will automatically save it into sketch window of Arduino software.
  • The very option is 'copy as HTML'. This option is used at that place where, you want to upload your sketch or code.
  • After writing you sketch, you just single click on this button and it will automatically convert the sketch language into HTML language and then you can easily upload it.
  • Next option is of 'paste'. You copy the sketch from some other folder and you can 'paste' it in this sketch menu. and you can easily compile it.
  • Next to paste option we have 'select all' option. Once you click on this option and the whole sketch will be selected. It's upto you either you want to copy it or whatever you want to do with the sketch.
  • The next option is very important which is 'comment/un-comment'. For those people who have done the coding before and are aware of the basics it is a simple options.
  • You bring the curser to any particular line and when you will first click on this button then, it will be commented. Which means physically this line is written in the code but logically it has no importance anymore.
  • to avail this particular line, you will again click on that particular line and then it will be 'un-comment'.
  • After un-commenting the line, now you can use it in code.
  • Next option is 'increase indent', by single clicking on this option you will observe that the width of blinking curser has been increased.
  • This is also very interesting feature in looking and also very beneficial for those people who have a little weak eye-side.
  • And if you are not comfortable with this feature then, don't worry we also have a secondary feature for it.
  • Then you will click on the next option named as 'Decrease indent' and it will automatically decrease the width of the curser and it will start to look like as before.
  • The next option is very interesting and it is to find anything within your sketch.
  • When you will click on that option, a new window will open which is shown in the image given below:
  • In this window you can see that we have no of options. First bar is of find.
  • Write in the first bar whats actually you want to find.
  • And if you think something has gone wrong and you want to make changes in your code, you just simply write that things in 'replace with' menu and the whole code will be changed accordingly.
  • Next options in the edit menu are 'find next' and 'find previous'. When you write something in find menu and the software finds it for you.
  • Now if you want to find what's written next to those lines, you just simply click on that options and it will show whats next to that thing in sketch.
  • Similarly you can also find whats written previous to that thing in our sketch.

Sketch Menu Description

  • After edit menu we have 'Sketch Menu' in the list. When you will click on that option then, a new window will open which is shown in the image given below:
  • In sketch menu we have total 4 options.
  • The first option is 'verify/compile'. If you have written a code and when you will click on this option, it will verify the whole code and it will compile it and if there is no error then, the sketch will start running.
  • Next option is of show sketch folder. By clicking on that icon, we will access that particular folder in which sketch has been saved.
  • Next option is of 'Add file' and if you want to add any particular file in your sketch, you just simply click on that option and that file will be added in your sketch.
  • The last option in sketch menu is very very important and it will enables you to 'import library' into your sketch.
  • When you will click on that button then, a new window will open which is shown in the image given below:
  • As you can see in the above shown image that in this software there are a large no of built in libraries and if you need to import any library in your sketch then, you can easily import it.

Tools Menu Description

  • The next option in the main menu is 'Tools'. In order to explore it you just simply click on it and a new window will open, which is shown in the image given below:
  • The very first option in 'sketch menu' is auto format and it will automatically give format to the sketch.
  • Next are Archive Sketch, Fix encoding and reload.
  • The most important option in tools menu is 'select board'. By clicking on this option a new window will open which is shown in the image given below:
  • You can see that we have a large no of options available here .
  • Its your choice to choose that Arduino board which you are going to use in your project.
  • Next option is of programmer and when you will click on this button then a new window will open, which is shown in the image given below:
  • You can see from here we can select that which type of programmer we are going to use in our project.
  • The default setting for this version is AVRISP, as shown in the above image.
  • The last option in tools menu is Burn Boothloader and the beauty of Arduino software is that it is capable to burn the code into its micro controller itself and no external burner is required for this purpose.

Help Menu Description

  • This is the last option in menu and when you will click on it then a new window will open which is shown in the image given below:
  • The help menu of Arduino software is very user friendly and it gives you ease to learn the software and to do something new.
  • You can see that the very first option is 'getting started' and when you will click this option it will guide you about the features of the Arduino software. How we are going to use it and what are its basics?
  • Other options are also related to help and are much informative, if you are writing a particular sketch and at any stage if you don't know what to do the next then, don't worry, Help will guide at every step.
  • Now coming towards next menu, which is below the main menu, it has 5 major icons, which are shown in the image given below:
  • In the above image you can see that, we have 5 major icons.
  • The icon numbered a '1' is of 'verify'. After writing the whole code, you just simply click on that icon and it will verify the whole sketch and if there is any error then it will also generate error.
  • The icon numbered as '2' is to upload the sketch into your micro controller.
  • The icon numbered as '3' is of 'New'. By clicking on that icon a new menu will open and it will allow you to write a new sketch in it.
  • The icon numbered as '4' is of 'open'. When you wish to open a existing file in your present code, you just simply click on that.
  • The icon numbered as '5' is of 'save'. When you have written a particular sketch, you simply click on that and that sketch will be saved automatically.
  • The last icon which is numbered s '6' is of serial monitor and after writing the whole code you just simply click on that and it will monitors the whole sketch thoroughly step by step.
  • if any error will present at any stage then it will generate error.

Alright friends, that was all from today's post. Today's tutorial was very informative so i conclude that you hve learned something new today. Till next tutorial Take Care !!! :)

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