11-Level 3-Phase Capacitor Clamped Inverter

Buy This Project

Hello friends, hope you all are fine and enjoying. Today i am going a new project tutorial which is 11-level 3-phase Capacitor Clamped Inverter. In my previous post 11 Level 3-phase Cascaded H-Bridge Inverter, we have designed the simulation of 3 phase 11 level inverter but the only difference was the method used in that project was cascaded H Bridge but today we are gonna see How to design an 11 level 3 phase inverter using clamped capacitors.

Now i am going to share a new and advanced bulk of knowledge about inverters with you people. Since we are going to design a 3-phase capacitor clamped inverter so, we need to design some algorithm which should be able to invert DC into AC at some High voltages and after inverting these DC voltages into AC, we will create a phase sequence and most importantly phase polarity between these three phases so they should be able to feed the load and must supply load current. It is a very interesting but a bit complicated project and now-a-days it has got a large no of industrial applications. The study about inverters and their implementation is the back bone of Modern Renewable Energy and it is the future of Power Generation. It is a MATLAB simulation based project so, any kind of hardware is not included in this tutorial. So what actually we are going to do is to design the complete simulation of the project and we will discuss every component and also each sub-component which will be used in Simulink MATLAB. So let's get started with 11 Level 3 Phase Capacitor Clamped Inverter:

11-level 3-Phase Capacitor Clamped Inverter

  • Capacitor Clamped inverters are commonly known as Flying Capacitor Technology and they were first purposed by Meynard and Foch.
  • Flying Capacitor includes no of series combination of Capacitor Clamped Inverter Switching Cells and these capacitors are used to get high voltages.
  • The general concept related to flying capacitor is that it can charge up to one-half of the DC voltages and then within the circuit they can automatically increase or decrease the voltages, according to our requirement.
  • The block diagram of the complete simulation of capacitor clamped inverter in MATLAB is given in the image below:
  • The complete block diagram of the Capacitor 3-phase clamped inverter is shown above. In this image, you can notice that we have 30 input pulses numbered as no.1 to no.30 .
  • So we can say that we have 30 DC input pins and these DC voltages will be inverted to get High Voltage AC.
  • If you double click on any input pulse then, a new window will open and it will be showing that source from which we are gaining input DC voltages.
  • We are gaining DC voltages from DC generators and a no of generators are connected in parallel to get HIGH voltage DC.
  • The block to which all the inputs are connected is in fact a Capacitor Clamped Bank.
  • In this bank, no. of capacitors are connected in series. Since a charged capacitor behaves as a voltage source and these capacitors are connected in series and their voltages adds up and in this way we get, HIGH voltages.
  • To look inside the block then double click on the block and a new window will open and it will be showing all the components which are fabricated in that block.
  • The internal structure of the block for capacitor clamped inverter is shown below in image:
  • In the above shown image, you can see that within the block, we have a no. of sub-blocks which are connected with each other.
  • To see what is in that small box, double click on that and a new window will open, which will be showing the internal structure of the each small box.
  • The internal structure of sub-block is shown in the image given below:
  • In the above given figure you can see that, in every block we have a MOSFETS which are connected with antiparallel diodes for capacitor clamped inverter.
  • Ideal IGBT or GTO transistors can also be used but as I explained the properties of MOSFET in the beginning, that we give pulse to its base and it becomes operational.
  • Once MOSFET has been triggered it keep conducting and in order to stop it, we will have to provide reverse voltage on its base to bring it to rest state.
  • Since we are going to generate High Voltages 3-phase AC, so we have applied 3 big blocks and from each block, only one phase will be generated.
  • After each big block, we have a summing junction on which voltages arrives and then we have applied two different types of voltage measuring devices.
  • One device measures the phase voltages of inverted AC voltages. It can also be seen from the above given block diagram that the meter on the above side, measures phase voltages of all the three phases appearing on the summing junction.
  • Now if you look closely then, you will observe that only one wire from each summing junction is coming to the meter and we also know that in order to measure phase voltages, we also need a neutral wire.
  • We can get neutral wire from common ground of the system and the voltage difference between a phase and a neutral wire will give us Phase voltages.
  • The below meter measures line voltages. Line voltages means the voltage difference between 2 phases. In our system we have three phases which are A, B and C respectively.
  • To measure line voltages, this meter measures potential difference between phases and NO neutral wire is included in it.
  • The line voltages will be AB, BC and CA.
  • The Phase voltages and Line voltages have much difference between them and each have their own applications.
  • For example to run the single phase House-Hold load we need phase voltages (voltage difference between a phase and a neutral wire).
  • Whereas in industries, we need Line voltages to run the 3-phase load.
  • Now run the simulation of this capacitor clamped inverter, and after completion now click on the scope for Line Voltages and you will get the below results:
  • Now for Phase voltages of capacitor clamped inverter, click on the scope for phase voltages and you will get the below results:

APPLICATIONS

All type of Inverters have a large no of applications and now a days they are focus of Research and modern studies. Inverters have also made us able to get power from Renewable energy sources like solar panels, wind mills etc. Some industrial based applications of inverters are given below:
  • The biggest advantage of inverters are that they give good power quality.
  • Due to good power quality motors can reach at High speed at High voltages without producing any harmonics.
  • They are used in power supply circuits.
  • Now-a-days inverter Air Conditioners are also available in market and due to their High Efficiency and low power rating their demand is much High.
  • ECU( electrical control unit) which carries out in-vehicle control also carries inverted circuits and it's demand is also accelerating these days.
Alright friends, that was all from today post. I hope you have learned something new today. If you have any question then don't hesitate to ask in comments. Stay tuned for more beneficial project tutorials. Until next tutorial Take Care !!! :)

Circuit Diagram of IR Sensor using 555 Timer

Hello everyone, hope you all are fine and having fun with your lives. Today's tutorial is quite simple and we will have a look at circuit diagram of IR sensor using 555 Timer. There are different types of IR sensors available in the market. IR is abbreviation of infrared and so they use infrared ray for detection of objects. There are many types of IR sensors with different functionality, but in all of them infrared rays are omitted from transmitter and are received by the receiver. and using these ray we can say whether an object is placed in the path or not.

Today we are gonna see how to design your own IR sensor using 555 Timer. We can also interface these IR sensors quite easily with any microcontroller like PIC Microcontroller , Arduino etc. I was also thinking of designing it in Proteus but Proteus doesn't have the IR leds in it so I couldn't do it. IR sensors available in market are quite costly ranging from 10$ to 100$ obviously they are also excellent in efficiency but in engineering cost efficiency also plays an important role so today we are gonna have a look at circuit diagram of IR sensor using 555 timer which will cost you just $2. Before going into the details, lets first have a look at types of IR sensors.

Types of IR sensors

  • There are normally two types of IR sensors available in market.
First Type of IR Sensors:
  • First type is transceiver IR sensor which has both transmitter and receiver in it. This type of IR sensor is used to detect the distance of object from the sensor.
  • In this type of IR sensors, rays are omitted from the transmitter and are reflected back after hitting some object and are captured by the receiver.
  • On the basis of the time taken by these rays to reflected back, we calculate the distance of the object from the sensor.
Second Type of IR Sensors:
  • In these types of IR sensors, transmitter and receiver are not on same chip but on seperate pieces.
  • These types of IR sensors are used for detection of object.
  • For example we need to count people entering in some room then we will place this IR sensor on the door of that room with transmitter on one end and receiver on the other.
  • So, now when some one will enter through the door , he will cut the IR beam and thus the IR light wont be received by the receiver and thus the sensor will know that someone entered.
  • These types of IR sensors are also used in electronic devices like TV remote etc.
In this tutorial we are gonna design this second type of IR sensor using 555 timer. so, lets get started.

Circuit Diagram of IR Sensor using 555 Timer

  • So, here we are gonna design the second type of IR sensor using 555 timer.
  • In this sensor we need to design both the transmitter and the receiver.
  • So, lets get started the transmitter.
  • Design the below circuit on some circuit board:
  • In the above circuit diagram of IR sensor, I have clearly mentioned all the values of components so that you can easily design it. Moreover there are two leds used in it, these are not simple leds. There are IR leds which emits IR rays. the range of this sensor will depend roughly on the number of leds you are gonna use here, as I used two leds.
  • So, now lets have a look at circuit diagram of receiver side.
  • On this side we have use IR led but that one is receiving and will received that IR rays coming from the transmitter IR leds.
  • These are quite simple in designing and you can design it without any trouble. Before going into PCB, its better if you first design them on some wero board or bread board.
  • Here's a manufactured piece of the above given circuit diagrams. The one with two leds is the transmitter and the other one is receiver.
 
  • The image is a bit blur, coz I was in a bit of hurry but they work perfectly fine. :)
  • That's all for today, will see you guys in the next tutorial. Till then take care!!!

LM317 Calculator

[LM317TEP] Hello friends, I hope you all are doing great. Today, I am going to share our new online tool which is named as LM317 Calculator. I am quite excited while posting this LM317 Calculator, as I was trying for a long time to post it but couldn't done it because of few problems. Anyways, its here now and is ready to be utilized. Its nothing but a simple LM317 Calculator. I have included two LM317 calculators posted above, one will be used to calculate the Vout while the other will be used to calculate the resistance (R1). You should have a look at Introduction to LM317, if you don't know much about it. LM317 is an IC regulator which is used to regulate the output voltage and its output voltage is regulated depending on the values of both the resistances attached at its output. Here's our first simple but awesome tool. :)

LM317 Calculator

  • First of all, let me give you some basic information of its circuit design.
  • You can check the basic circuit of LM317 in below figure:
  • You can see that we have Vin which is input voltage and then we have R1 = 510 ohm which is normally a fixed resistance and finally we have R2 which is a variable resistance.
  • Now, by changing the value of this variable resistance, you can change its output, this calculator will be used to calculate those values depending on the values of other two variables:
  • So here are these LM317 Calculators:
  •  The simple formula used for calculating the output voltage of LM317 is shown below:
  • Normally it is not required to use very specific output voltage and normally a predefined combination of resistors is used. Here's a list of normally available resistors, the output voltages for these resistor combination is shown in below table:
  • I have also designed a Proteus Simulation of LM317 which you can download from LM317 Voltage Regulator in Proteus.
  • Here's a screenshot of its working and you can see that the output voltage is quite less than input voltage:
So, that's all about LM317 Calculator. I hope you are gonna enjoy those tools. If you have any questions then you can ask in comments. Have a good day. Take care !!! :)

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!!! :)  
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