Protect Simulink Design in MATLAB

Hello friends hope you all are healthy and enjoying good health. In today's tutorial, I am going to share How to Protect Simulink Design in MATLAB and in order to do so I have used S Function method. In my previous post I have explained How to Protect your m-file Codes in MATLAB by converting it to p-file so that no one can reach to your code and now I am gonna explain how to protect your simulations in MATLAB which you create in Simulink so that your intellectual work wont go waste.There are many methods to protect the Simulink simulations and the easiest of them is using S-function. Now follow these simple steps and it won't be much difficult.

Protect Simulink Design in MATLAB

  • Open the simulation which you want to protect. Make sure you are done with the simulation and don't need any more editing. As after conversion you wont be able to edit it.
  • Now select whole of your simulation and right click on it.
  • Click on the Create Subsystem in right click listing.This will create a single block for your whole system.If you double click click this block a new window will pop up and you can see your whole model again.
  • Now right click on this newly created subsystem block and then in the listing click on Real Time Workshop and the Generate S-Function.
  • On clicking a new window will pop-up add variables if you want to control any otherwise just tick the corner which says Use Embedded Coder and hit Build.
  • It will take few seconds to build the S-function for your simulation and when its done Hurrah your simulation is now protected.
  • Now double click on your subsytem and you won't be able to open your design, instead a window pops up which will give some description.
  • You can add the complete description while generating your simulation.
  • Now start your simulation , it will work fine but no one could find your design.
Note :
  • This method is mostly used by the developers to protect their simulations.
  • Users can use their simulation but couldn't get the design of it, the design got fully protected.

Convert m File into p File in MATLAB

Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to Convert m File into p File in MATLAB. Now the question arises that why we need to do that? & the answer is if you want to protect your code and don't want anyone to access it then you need to your Convert m File into p File. P File is like an encrypted file which performs the same functionality as your original m file but no one can get the code out of it. Like me explain it with an example, suppose you are some sort of developer and you have created some code for a company and now you want to protect your code and just send the company some sort of software. MATLAB has a function in which you convert your m-file into p-file and no one can open that p file code. P-file functionality is as same as of m-file but no one can check what's inside p-file.

Convert m File into p File in MATLAB

  • Suppose you have created your m-file and you are now want to protect your code and the send the rest to your employer so that he can use it without knowing the code inside it.
  • Use these command to do this :
pcode(fun) pcode(fun1,...,funN)
  • If fun is the name of the m-file then MATLAB will conver the fun.m to fun.p and create it in the same folder.
  • If fun is the name of the folder then MATLAB will convert all the m-files within that folder into p-files.
  • If you want to convert more than one m-file into p-file then use the second code and place all the m-files there.
  • You can also convert more than one folder using the second command.
So, that's all for today. In my next post I will tell you a way of protecting your simulink model in the same way as we protected our m-file. Till then take care & stay blessed .... :))

Difference Between AC and DC Power

Hello friends, I hope you all are fine and having fun. In today's tutorial, I am going to share the difference between AC and DC Power. In our everyday life, we have noticed many times about AC and DC but very few of us know exactly the difference between them, and this is mostly the favorite question of interviewer, so today we will see their difference.Electricity is basically a type of energy, which  is produced or generate because of movement of electrons within any conductor. This movement of electrons can be in one direction only or they can also move in two directions. On the basis of the movement of electrons, we get two types of electric energy, one is called Direct Current (DC) and other one is Alternating Current (AC). You should also have a look at Difference Between AC and DC Motors.Lets check Difference Between AC and DC Power in detail one by one:

Direct Current (DC)

  • Direct Current originate because of movement of electrons in a conductor in one direction.
  • In DC case, electrons don't change their direction and keep on moving in one direction.
  • A magnetic field near a wire causes the electrons in the wire to flow in one direction along the wire. The reason of movement of electrons is because they are repelled and attracted by the poles of the magnet.
  • DC current was invented by Thomas Edison.
  • DC batteries we use in the cars based on this phenomena.

Alternating Current (AC)

  • When electrons in a conductor moves in two directions than AC current generates.
  • AC current was invented by Nikola Tesla , a Serbian scientist.
  • Instead of applying the magnetism along the wire steadily (in one direction), he used a magnet that was rotating.In other words changing its direction.
  • When the magnet was oriented in one direction, the electrons start to flow towards positive direction and when magnet oriented in opposite direction, they begin to move in opposite direction.
  • That's the reason alternating current keeps on changing its polarity.
The Question is ???
  • Now the question arises that when we had Direct Current , then whats.'s the need of Alternating Current ???
  • Answer to this question is DC stores very low energy that's why we can't use it for long distances but the AC current can easily move to very long ranges.
  • You have observed that all those thing where we need current just on the spot we use DC, such as in the cars. We are generating DC and using it at the same spot.
  • But when there's a need to send energy at long distance we use AC such as in our house, all the energy coming from Power Plant to our houses is AC.
Note :
  • There is also a limit of range for AC and for that reason we use transformers, which acts as a recharger and makes the energy of AC high again.
So, that's all about Difference Between AC and DC Power. I hope you guys got something out of it. Let me know did you like it. Thanks.

Difference Between DC and AC Motors

Hello everyone, I hope you all are fine and having fun with your lives. In today's tutorial, I am going to share a Difference Between DC and AC Motors. Both of these motors are used almost in every kind of robotic projects and if we talk about engineering projects then they are used in like 70% of the engineering projects.There are two main types of motors. Both are electrical motors named as :
  • DC Motors
  • AC Motors
You should also have a look at Difference Between AC and DC Power. So, let's get started with Difference Between DC and AC Motors:

1. OperatingSource

DC Motor
  • DC motor operates on DC (Direct Current) and converts the electrical energy into mechanical energy.
AC Motor
  • DC motor operates on DC (Direct Current) and converts the electrical energy into mechanical energy.
Its actually the main common difference between them which also depicts in their names.

2. Main Types

DC Motor
  • DC Motor has two main types named as :
    • Brushless DC Motor
    • Brush DC Motor
AC Motor
  • AC Motor is divided into three main types :
    • Single Phase Motors (Also named as General Purpose Motor)
    • Double Phase Motors
    • Triple Phase Motors
  • They are further classified as :
    • Synchronous AC Motors.
    • Induction AC Motors.

3. Basic Working Principle

DC Motor
  • A simple DC motor contains a coil of wire that can rotate in a magnetic field provided by the permanent magnets.
  • So when the coil placed in the magnetic field is provided with the current, a force is exerted on this coil which can be find by the Flemming's Right Hand Rule.
  • This force generates a torque in the coil and the coil starts to rotate in the magnetic field as shown in the image below :
  •  The current is provided to the coil through the brushes which are in contact with the split rings.
  • The force produced in the coil of length 'L' placed in the magnetic field 'B' carrying a current 'i' is equal to iLBsin(theta) , where theta is the angle between 'B' and 'i'.
Function of Split Rings :
  • When the coil surface comes in horizontal with the magnetic field, we can see that now torque becomes 0 , because current is zero at this point and also the brushes comes in the gap between split rings.
  • At this point, no current is provided to the coil but coil still continue its motion because of its momentum and then again split rings come in contact and the process continues.
AC Motors
  • AC motor works on the same principle as I have described for the DC motor, the only difference lies in the split rings.
  • For AC motors we use continuous rings as shown in image below, they doesn't block the current and the current can move in both directions easily.
  • Moreover, in most of the AC motors armature remains stationary and the magnetic field keeps on rotating.

4. Applications

DC Motors
  • DC Motors are used where you want to controlled speed.
  • It doesn't provide high energy so its used mostly where low energy is required.
AC Motors
  • AC motors provide high energy that's the only reason AC motors are mostly used in industries.
  • We can't control the speed of AC motor.

A Newly Launched Thread - Difference Between

No. Difference Between
Give Your Suggestions !!!
1. DC and AC Motors
2. AC and DC Power
Hello friends, today we are going to start a new session in our site. This session is named as Difference Between. In this session, I am gonna give a difference between any two things which are of same nature. Like Difference between DC motor and AC motor. Their function is quite the same but their working is different and most of the people don't know much about it. Let's have a look why I am starting this thread and how you guys can help me to improve it.

Why am I starting This ???

There are many reasons of starting this thread.
  • First of all, these are the most commonly asked questions during the vivas.
  • Moreover, mostly during job interviews, these kind of questions are asked.
  • Its a general behavior of human mind that the difference thing is much captured by it than a simple plain topic.
  • You guys have noticed that when you read some difference between two things, it lasts in memory much longer than a simple tutorial on any topic.
  • So, these are the few things because of which I am gonna start this thread.

Where you can access it ???

  • I am gonna make a tab above in which I will post all the topics so that you guys can access easily.
  • Moreover, I am working on adding a google search to our blog because I am getting these complaints that user can't search the site

Your Role ???

  • If you are confused about any topic, then you can contact me and I will try to post on it as well.
  • One important thing, I am open to suggestions, so if anyone have any kind of idea in his/her mind, let me know about it , I will be really obliged.
  • I am also thinking of adding some admins to our site, so if you think you have knowledge then contact me asap.
At the end, I would like to thank my friend Adnan because of whom this idea hit me. .... :))

Create Setup File in Visual Studio 2010

Hello friends, I hope you all are healthy and having fun. Today I am posting a simple tutorial in which I will show you How to Create Setup File in Visual Studio 2010. Actually I got a request from one of our members to post this tutorial, he was having some problems in it, so i thought to share it. In my previous tutorial How to use Serial Port in VB 2010, we have designed a simple tool, now what if I want to create an exe file so that I could easily share my tool with my friends, without giving them the access to my code. So, in today's tutorial, we are gonna have a look at How to create exe or setup file in Visual Studio 2010. No one can get your code from the exe file so its like your code is safe but anyone can use your software. These days I am planning on designing such small free tools, which I think will help our readers and we can add our logo for free publicity. In simple words, there are numerous uses of giving professional look to your software by creating its exe or setup file. So, let's get started with How to Create Setup File in Visual Studio 2010:

Why you Need to Create it ?

  • Suppose you have created your software on Visual Studio 2010 and now you want to use that software on any other computer.
  • So to do this, there's no need to copy whole code and create project in the second computer.
  • Instead just create executable (.exe) file of that software and install it on other computer.
  • You can also publish your software online on your blog etc.
Now follow these simple steps carefully in order to Create Setup File in Visual Studio 2010:

Create Setup File in Visual Studio 2010

  • Complete your software and test it to confirm that its ready.
  • Now click on the Project in your Top Menu Bar and at the bottom click on Properties.
  • CNC Gcode is actually the name of my software as shown in image below :
  •   After clicking on properties a new tab will open as shown in image below :
  •  These are actually the properties of our software, like you can change the icon and can also do many other things.
  • Right now we are not changing anything but if you want you can play with its properties.
  • Now click on the Publish button at the bottom and the below screen will appear.
  • Now click on the Publish Now button and it will create the .exe file of your software.
  • You can change the location of the file where it is gonna store in the properties.
So, in this way you can quite easily Create exe File or Setup File in Visual Studio 2010. If you got into any trouble then ask in comments and we will try our best to help you out. So, that was all for today, will see you guys in the next tutorial. Till then take care and have fun !!! :)

Modified Sine Wave Design With Code

Hello guys, I hope you all are doing great. In today's tutorial, I am gonna give you a detailed introduction of Modified Sine Wave Inverter with code. In this inverter series, I have first explained the Basics of Inverters with Topology in which we have seen the Introductionof inverter and its different types. After that, we have discussed the Major Components of Inverter which are essential for its designing. Now in today's post, I am gonna explain the modified sine wave inverter. I have used AVR microcontroller in this project. Before starting on modified sine wave inverter, you should also read this Pure Sine Wave Inverter. I tried my best to keep it simple but still if you guys got stuck at any point ask in comments and I will remove your query. 

Modified Sine Wave Inverter

  • Modified sine wave inverter gives an output which is intermediate between the square wave and pure sine wave.
  • Its actually a sine wave, which has a lot of steps.
  • Let's have a look at the below figure:
  • In the above figure, the red wave is a pure sine wave and the green signal is a square signal but the blue one is in between and its called modified sine wave.
  • Here's a modified sine wave in MATLAB, I have designed it for another project but it will clear the idea How Modified Sine wave looks.
  • Modified sine wave has much lower efficiency than the pure sine wave.
  • The circuit diagram of a modified sine wave inverter is shown below:

Explanation.

  • For a modified sine wave inverter we need two inverted square waves signal to switch the MOSFETs. Two generate these signals we use HEF4047 multi-vibrator IC.
  • We use it in a-stable mode. It gives a buffered output so there is no need for impedance matching between TTL based ICs and CMOS based ICs.
  • In a-stable mode it generates square wave of exactly 50% duty cycle at its pin 10 and gives its inverted signal on pin 11.
  • It also generates frequency double to that of pin 10 at pin 13. It can be done by using 0.2µF capacitor and a 7.6KO resistor as mentioned in its datasheet to generate frequency of 500Hz at pin 13.
  • From pin 13 we give a signal to HCF4017 IC as a clock. HCF 4017 is a decade counter with 12 outputs. It is used to generate a 50Hz signal with controlled delay at both positive and negative edge. Pins 1, 5, 6, 9 and pins 2, 4, 7 are used as output.
  • All other outputs are grounded as CMOS ICs are very sensitive and even a small stray signal can burn them out.
  • The output of HCF4047 is about 1v, which cannot be used to drive MOSFETs so the signal is amplified by using BC-547 as an amplifier (connected in common emitter biased configuration.
  • This signal is again amplified and inverted. The signal obtained is a controlled PWM which we now give at the MOSFET gates.
  • The block diagram of the modified sine wave inverter module is given below:
 

Working

  • We gave a PWM signal to the pair of MOSFET connected in a push pull configuration.
  • When M1 MOSFET is turned on by a high input (Q), the M2 MOSFET turns off at that time because on its input we had given an inverted signal (Q ) with some delay.
  • This delay is used so that one of the MOSFETs gets time to turn off before second one turns on.
  • In this mode, the current flows from source to MOSFET M1 as shown in figure.
  • When Q1 goes low Q becomes high and M2 turns on, resulting in a current flowing from source as shown in diagram by I2.
  • Thus, we get a bipolar high voltage output at the transformers secondary.
  • The 22kO resistor from Gate to the source as shown in the diagram is important because when the input signal goes to zero, the MOSFETs may not completely turn off because of the capacitance between gate and source so this resistance makes sure that signal is fully grounded.
  • The threshold voltage to turn on a MOSFET is approximately 4V. We are driving MOSFETs with 12v signal so that MOSFETs is completely turned on otherwise it will result in power dissipation.

Results

FIGURE 4 : Delayed inverted output

Problems

  • In power inverter, shoot through current is a major problem and needs to be solved.
  • It is a short circuit current, and as described in the previous topic, occurs when both MOSFETs are on. This happens for a very short time i.e. for some Nano-seconds.
  • But eventually it results in a short circuit current, which causes loading and thus it may damage the MOSFETs.
  • This situation can be avoided by introducing a dead time between the two signals both at rise and fall edge.
  • If the dead time is increased too much, the output voltages drop because MOSFETs are turned ON for a very short time.
  • Finally impedance matching is an important factor.
  • Transformers output impedance (Secondary) should be low so that minimum voltage drop occurs when we connect any load to with it.
So, that was all about Modified Sine Wave Inverter Design. I hope you will like it. Have a good day !!! :)

Pure Sine Wave Inverter Design With Code

Hello guys, in the last post I have explained the Basics of Inverters along with its types and also the inverters topology in other words working of inverters, then we discussed the Major Components of Inverters. Now in this post I am gonna explain the pure sine wave inverter and how to create it. I have used AVR microcontroller int his project. The reason I am using random microcontrollers is that so you guys get a taste of each one. Before starting on sine wave inverter read this article again and again as I have also mentioned the problem i got while making it. You should also read the Modified Sine Wave Design with Code.

I have divided this tutorial into four parts which are shown below. This is a step by step guide to design and build an inverter and I hope at the end of this tutorial you guys will be able to design your own inverter. I tried my best to keep it simple but still if you guys got stuck at any point ask in comments and I will remove your query. This project is designed by our team and they put real effort in getting this done so that's why we have placed a small fee on its complete description. You can buy the detailed description of this project along with the complete code and circuit diagram, by clicking on the below button:

Buy This Project Note:

Pure Sine-Wave Inverter

  • Pure Sine wave inverter consist of a microcontroller unit which generates a switching signal of 15 KHz, an H-bridge circuit to convert the signal into AC, a low pass LC filter circuit to block the high frequency components and the transformer unit to step-up the voltages.
  • Block diagram of sine wave circuit is given below:
FIGURE 1 : Block diagram of pure sine wave inverter

AVR Micro-Controller Unit

  • Microcontroller unit is a multi-purpose control unit which can handle multiple tasks simultaneously.
  • We have used it just to generate a switching signal of 15 KHz.
  • I am using AVR micro-controller unit for this pure sine wave inverter.
Explanation for PWM in AVR
  • AVR is acting as the brain of Pure Sine Wave Inverter.
  • Below is the program for atmega16 microcontroller with a clock frequency of 8 MHz (Fcpu = 8MHz). We have worked on a compiler named AVR GCC.
  • Initially we included AVR libraries,then we initialized sine table in which the values of a complete sine wave are stored (we generated a sin table in range 0-359 degrees whereas, zero of sine wave is set at decimal 128(0x80 in Hex).
  • Then in the next chunk of the code, we used timer0 (8-bit) which starts from 0 and peaks to 255 (it gives a saw tooth output).
  • The constant float step = (2*180)/256 = 1.40625 For i=0; s = sin (0*1.40625) = 0 For i = 255 s = sin (255*1.40625) = 358.5937 = 359deg approx.
  • This is how the sine wave is generated from 0-359deg.
  • When timer reaches 255 then interrupt over flow is generated (Refer the sine wave code, at the end).
  • The next part of the code shows that we have used the clock select bits as pre-scalar.
  • TIMSK| = (1<<TOIE0) means we are enabling timer overflow interrupt enable 0.
  • The last part of the code is the most important part of pure sine wave generator.
  • OCR0 is output compare register for timer 0 and it continuously compares timer0 values i.e. 0, 1, 2.......255, and for each value of timer the value from sine wave table is computed then sample++increases the pointer of sine wave table to the next i.e. the value at the second index of sine table and that is computed for the output until samples equals to 255.
  • Then we used the command sample = 0 the cycle is repeated again and again.
  • Here's the programming code for Pure Sine Wave Inverter:
    #include <stdlib.h>

    #include <avr/io.h>

    #include <util/delay.h>

    #include <avr/interrupt.h>

    #include <avr/sleep.h>

    #include <math.h>

    #include <stdio.h>

    0x80, 0x83, 0x86, 0x89, 0x8C, 0x90, 0x93, 0x96,

    0x99, 0x9C, 0x9F, 0xA2, 0xA5, 0xA8, 0xAB, 0xAE,

    0xB1, 0xB3, 0xB6, 0xB9, 0xBC, 0xBF, 0xC1, 0xC4,

    0xC7, 0xC9, 0xCC, 0xCE, 0xD1, 0xD3, 0xD5, 0xD8,

    0xDA, 0xDC, 0xDE, 0xE0, 0xE2, 0xE4, 0xE6, 0xE8,

    0xEA, 0xEB, 0xED, 0xEF, 0xF0, 0xF1, 0xF3, 0xF4,

    0xF5, 0xF6, 0xF8, 0xF9, 0xFA, 0xFA, 0xFB, 0xFC,

    0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,

    0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFD,

    0xFD, 0xFC, 0xFB, 0xFA, 0xFA, 0xF9, 0xF8, 0xF6,

    0xF5, 0xF4, 0xF3, 0xF1, 0xF0, 0xEF, 0xED, 0xEB,

    0xEA, 0xE8, 0xE6, 0xE4, 0xE2, 0xE0, 0xDE, 0xDC,

    0xDA, 0xD8, 0xD5, 0xD3, 0xD1, 0xCE, 0xCC, 0xC9,

    0xC7, 0xC4, 0xC1, 0xBF, 0xBC, 0xB9, 0xB6, 0xB3,

    0xB1, 0xAE, 0xAB, 0xA8, 0xA5, 0xA2, 0x9F, 0x9C,

    0x99, 0x96, 0x93, 0x90, 0x8C, 0x89, 0x86, 0x83,

    0x80, 0x7D, 0x7A, 0x77, 0x74, 0x70, 0x6D, 0x6A,

    0x67, 0x64, 0x61, 0x5E, 0x5B, 0x58, 0x55, 0x52,

    0x4F, 0x4D, 0x4A, 0x47, 0x44, 0x41, 0x3F, 0x3C,

    0x39, 0x37, 0x34, 0x32, 0x2F, 0x2D, 0x2B, 0x28,

    0x26, 0x24, 0x22, 0x20, 0x1E, 0x1C, 0x1A, 0x18,

    0x16, 0x15, 0x13, 0x11, 0x10, 0x0F, 0x0D, 0x0C,

    0x0B, 0x0A, 0x08, 0x07, 0x06, 0x06, 0x05, 0x04,

    0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,

    0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03,

    0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x0A,

    0x0B, 0x0C, 0x0D, 0x0F, 0x10, 0x11, 0x13, 0x15,

    0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24,

    0x26, 0x28, 0x2B, 0x2D, 0x2F, 0x32, 0x34, 0x37,

    0x39, 0x3C, 0x3F, 0x41, 0x44, 0x47, 0x4A, 0x4D,

    0x4F, 0x52, 0x55, 0x58, 0x5B, 0x5E, 0x61, 0x64,

    0x67, 0x6A, 0x6D, 0x70, 0x74, 0x77, 0x7A, 0x7D

    void InitSinTable()

    {

    Page | 42

    //sin period is 2*Pi

    const float step = (2*M_PI)/(float)256;

    float s;

    float zero = 128.0;

    //in radians

    for(int i=0;i<256;i++)

    {

    s = sin( i * step );

    //calculate OCR value (in range 0-255, timer0 is 8 bit)

    wave[i] = (uint8_t) round(zero + (s*127.0));

    }

    }

    void InitPWM()

    {

    /*

    TCCR0 - Timer Counter Control Register (TIMER0)

    -----------------------------------------------

    BITS DESCRIPTION

    NO: NAME DESCRIPTION

    --------------------------

    BIT 7 : FOC0 Force Output Compare

    BIT 6: WGM00 Wave form generartion mode [SET to 1]

    BIT 5: COM01 Compare Output Mode [SET to 1]

    BIT 4: COM00 Compare Output Mode [SET to 0]

    BIT 3: WGM01 Wave form generation mode [SET to 1]

    BIT 2: CS02 Clock Select [SET to 0]

    BIT 1: CS01 Clock Select [SET to 0]

    BIT 0: CS00 Clock Select [SET to 1]

    Timer Clock = CPU Clock (No Pre-scaling)

    Mode = Fast PWM

    PWM Output = Non Inverted

    */

    TCCR0|=(1<<WGM00)|(1<<WGM01)|(1<<COM01)|(1<<CS00);

    TIMSK|=(1<<TOIE0);

    //Set OC0 PIN as output. It is PB3 on ATmega16 ATmega32

    DDRB|=(1<<PB3);

    }

    ISR(TIMER0_OVF_vect)

    {

    OCR0 = wave[sample];

    sample++;

    if( sample >= 255 )

    sample = 0;

    }
 

H-Bridge Circuit

  • H-Bridge Circuit is acting as the main core of Pure sine Wave Inverter.
  • H-bridge circuit is basically enables a voltage to be applied across a load in either direction.
  • In inverters, it is used to amplify the input square wave coming from the micro-controller.
  • We are giving modulated square wave at the input of the H-bridge because if we give sine wave to the MOSFET or any other switching device like the BJT or IGBT, very high switching losses occur. This is because when we give sinusoidal waveform to any of these devices, they start operating in the linear region, and power loss occurs in devices operating in linear region.
  • When we give a square waveform to them, they operate on either saturation or cut-off regions thus having minimum power loss.
  • We used IRF5305 and IRFP150 MOSFETs. These are high power MOSFETs with maximum current rating of 31 Amp and 42 Amp respectively.
  • IFR5305 is a Pchannel MOSFET whereas IRFP150 is an N-channel MOSFET.
  • The circuit configuration of H-bridge is given below:
FIGURE 2 : H-Bridge Circuit
Working
  • Working of an H-bridge for pure sine wave inverter can be divided into two modes.
  • In Mode1, the input signal at the gate of M1 is high and at the gate of M4 it is low.This causes conduction from M1-M4 and we achieve a +12V signal at the output.
  • In Mode2, the input signal at the gate of M3 is high and at the gate of M2 it is low.This causes conduction from M3-M2 and we achieve a -12V signal at the output.
  • And thus we obtain a 24Vpeak-peak signal at the output.
  • The working of H-Bridge in both conduction modes can be easily understood by the following figure:
FIGURE 3 : H-Bridge Conduction Modes (A) FIGURE 3 : H-Bridge Conduction Modes (B)  
  • Due to the conduction of half part of the bridge at +ve half cycle and the other half part of the bridge at –ve half cycle, we obtain a square waveform of 24 Vpeak-peak at the output.
  • In figure below is the Proteus simulation showing the waveform output of bridge circuit during each conduction cycle.
FIGURE 4 : Wave-forms of H-bridge conduction cycle
Observations
  • In the H-bridge circuit we have observed that input signal"s frequency does not change at the output that means the frequency remains un-altered.
  • Only the power of the signal increase in terms of current.
Problems
  • Initially we used all the MOSFETs of same type (i-e. n-channel MOSFETs). This caused the shorting of the MOSFETs during the conduction mode. This phenomenon is known as shooting over of the MOSFET.
  • Despite the duration of this shooting over was quite small, it caused loading on the MOSFETs.
  • The MOSFETs started heating up due to this, and eventually they burned out.
  • Another problem occurred while using the MOSFETs of same channel was that the upper MOSFETs (M1 and M3) did not turn on properly.
  • After studying, we learned that they required 18V to turn on thus; we needed a MOSFET driver that was IR2110.
  • We worked on it but it did not working properly too, because according to the formula for bootstrap capacitor given in datasheet, the driver must have given 18V output but it was not working so we had to search for an alternate.
  • Then after extended study we came to know that replacing the upper two n channel MOSFETs with p channel MOSFET is the solution. We applied this technique and it worked.
  • Using this technique also solved the problem of MOSFET shooting over by inducing a dead time/delay in the MOSFET switching.

LC Filter

  • We have determined inductance of the inductor using LC resonant band stop filter as LC meters were not available in the lab.
FIGURE 5 : LC filter
Working
  • Understanding the working of H-Bridge is very essential, if you want to work on Pure sine Wave Inverter.
  • The method to determine L or C is simple. Suppose we are required to determine the inductance, then by above circuit,
  • V1 signal from function generator is set to 1Vrms using multi-meter.
  • At resonance frequency the LC combination will have very low impedance so it will short out the signal and will drop across resistor R1 and prevents the signal to reach the load.
  • Using this principle we have varied signal frequency from function generator and we are detecting output voltage at load using multi-meter.
  • At resonance frequency multi-meter will show ideally zero volts.
  • So by using formula we have :
Problems
  • First we designed an RC circuit but we observed that the Resistance R in the circuit acts as a load and dissipates power.
  • After studying, we decided to use an LC filter.
  • The main problem with the LC filter was the designing of the inductor as the inductor of desired value was not available in the market, thus we had to make it by hand.
  • LC meter was not available also thus we had to repeatedly calculate the inductance value mathematically.

Working of Pure Sine Wave Inverter

  • Let's have a look at the working of Pure Sine Wave Inverter.
  • A 50Hz sin wave is generated with the help of a lookup table within the AVR microcontroller and is modulated over a switching frequency signal of 15KHz.
  • As this signal has very weak current, so it is amplified by a BC 547 transistor.
  • The amplified signal is given at the gates of M1 and M2 MOSFETs.
  • The output of the microcontroller is given to another BC 547 which is working as an inverting amplifier.
  • By this, the signal from the microcontroller gets inverted as well as amplified.
  • This signal is given at the gates of M3 and M4 MOSFETs.
  • Now what happens is that, when the input signal at the gate of M1 of the H-bridge is high and at the gate of M4 of the H-bridge is low, conduction from M1-M4 occurs and we achieve a +12V signal.
  • When the input signal at the gate of M3 goes high and at the gate of M2 goes low, conduction from M3-M2 occurs and we achieve a -12V signal.
  • Thus at the output we receive a waveform of 12Vpeak or 24Vpeak-peak.
  • The output of the H-bridge is then fed into a low pass LC filter which filters the high frequency components of 15 KHz and gives the 50 Hz sine output.
  • This output is then fed into a transformer which steps up this 12 Volts AC waveform into 220Volts AC.
So, that's all for today. I hope you guys have enjoyed this Pure Sine Wave Inverter Project. You should also look at Proteus simulation of Pure sine wave and Introduction to Multilevel Inverters, because simulations help a lot in designing hardware projects. So, take care and have fun !!! :)

Major Components of Inverters

No. Proteus Tutorials
Give Your Suggestions !!!
1. Basics of Inverters With Topology
2. Major Components of Inverter
3. Pure Sine Wave Inverter Design With Code
4. Modified Sine Wave Design With Code

Hello guys, in the last post I have explained the basics of inverters along with its types and also the inverters topology in other words working of inverters. Now in this post I am gonna explain the major components required for making an inverter. This post is not giving you any technical knowledge about inverter but to workout with inverters its necessary to go through its basic components.

I have divided this tutorial into four parts which are shown below. This is a step by step guide to design and build an inverter and I hope at the end of this tutorial you guys will be able to design your own inverter. I tried my best to keep it simple but still if you guys got stuck at any point ask in comments and I will remove your query.

Major components of an inverter

  • An inverter design and components vary with requirements but following components are most commonly used in designing an inverter.

Microcontroller

  • Microcontroller is the main and integral part of an inverter. The main working of microcontroller is to control the switching of signals according to the requirements.
  • A single microcontroller can perform multiple functions (e.g.) generating PWM for switching, controlling the protection systems etc.
  • There are various types and families of microcontrollers available in the market, for example :
  •   Depending on the design specifications, any microcontroller can be used.

Bipolar junction transistors (BJTs)

  • BJT or a bipolar junction transistor is a three layered device which is capable of controlling the current flow.
  • In a BJT, a small current at the input of the device can control larger currents at the output. Thus, BJTs can amplify currents.
  • They can be used as a relay driver, as a switch, as a constant current source, as an amplifier (etc.).
  • Circuit symbol of a BJT is given in figure below :
FIGURE 1 : BJT symbols
Types of BJTs
  • There are two types of transistors, NPN and PNP transistors
1. NPN Transistor :
  • NPN is one of the two types of bipolar transistors, in which the letters "N" and "P" refer to the majority charge carriers inside the different regions of the transistor.
  • In other terms, an NPN transistor is "on" when its base is pulled high relative to the emitter.
  • The arrow in the NPN transistor symbol is on the emitter leg and points in the direction of the conventional current flow when the device is in forward active mode.
FIGURE 2 : PNP Transistors 2. PNP transistor
  • PNP transistors have two layers of P-doped material and in between these two layers, there's a small layer of N-doped material.
  • A small current leaving the base in common-emitter mode is amplified in the collector output. In other terms, a PNP transistor is "on" when its base is pulled low relative to the emitter.
  • The arrow in the PNP transistor symbol is on the emitter leg and points in the direction of the conventional current flow when the device is in forward active mode.
  • Below figure shows both NPN and PNP transistors.
FIGURE 3 : PNP Transistors

H-Bridge

  • H –bridge is a topology in which four switching devices BJTs, MOSFETs or IGBTs are integrated together in a single circuit.
  • The name H-Bridge is given to it because of the typical arrangement of this circuit.
  • Mainly used switching devices in the H-bridge circuits are BJTs, MOSFETs or IGBTs.
Working
  • In an H-bridge, corresponding to the figure below when the switches S1 and S4 are closed, the switches S2 and S3 are open.
  • Thus a positive voltage issupplied across the motor or any other load attached to it instead of motor (e-g) transformer.
  • When S1 and S4 switches are opened, and S2 and S3 switches are closed, the voltage is reversed, supplying negative voltages to the load.
  • A problem with this is that the switches S1 and S2 should never be closed at the same time, as this causes a short circuit on the input voltage source.
  • The same thing applies on the switches S3 and S4. This condition is generally known as the shoot-through condition.
  • Following figure describes the above phenomena.
  FIGURE 4 : H-Bridge Working

MOSFETs

  • The Metal-Oxide-Semiconductor-Field-Effect-Transistor (MOSFET) is a voltage controlled device and requires a very small input current.
  • It is mainly used for switching of electronic signals as its switching speed is very high.
  • It is the most commonly used FET in low-power high-frequency circuits.
  • The MOSFET is composed of a channel of n-type or p-type semiconductor material, and is accordingly called an N-MOSFET or a P-MOSFET.
  • Circuit symbols of MOSFET are shown in the figure below :
FIGURE 5 : MOSFET Types and symbols
Types of MOSFETs
There are two main types of MOSFETs.
  • The Depletion-type MOSFET (DMOSFET)
  • Enhancement-type MOSFET (E-MOSFET)

Filters

  • At times it is desirable to have circuits capable of selectively filtering one frequency or range of frequencies out of a mix of different frequencies in a circuit.
  • A circuit designed to perform this frequency selection is called a filter circuit.
Low-Pass Filters
 
  • A low-pass filter is a circuit offering easy passage to low-frequency signals and difficult passage to high-frequency signals.
  • There are two basic kinds of circuits capable of accomplishing this objective, and many variations of each one.
LC Filters
  • An LC filter is a low-pass filter which consists of an inductor attached in parallel with the capacitor and the load.L and C connected together act asan electrical resonator.
LC Filter over RC Filter
  • RC filters have R thus they dissipate power. They have attenuation even in the pass band.
  • To achieve a narrow transition band, RC circuits have to be of higher orders.
  • Only certain types of filters can be implemented by an RC filter.
  • Whereas, LC filter does not dissipate power.
  • Better characteristics can be achieved by the LC filter than RC with a lower order.
  • Thus it is desirable to choose an LC over an RC in the case of an inverter.
Transformer
  • A transformer is used to step up or step down the electrical voltages.
FIGURE 6 : Ideal Transformer
Working of Transformer
  • A changing electric flux in the primary of the transformer creates a changing magnetic field which induces a changing voltage in the secondary.
  • By adding load, one can transfer energy from one part to another.
  • The secondary voltage Vs of an ideal transformer is scaled from the primary voltage Vpby a factor equal to the ratio of the number of turns of wire in their respective windings.
  • By appropriate selection of the numbers of turns, a transformer thus allows an alternating voltage to be stepped up by making Ns more than Np or stepped down,by making it less.
  • If the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit.
  • Ideally,
    • Pin = Pout
    • IpVp= IsVs
  • Where:
    • Pin = Input Power.
    • Pout = Output Power.
    • Ip = Primary Current.
    • Vp = Primary Voltage.
    • Is = Primary Current.
    • Ip = Primary Voltage

Basics of Inverters With Topology

No. Proteus Tutorials
Give Your Suggestions !!!
1. Basics of Inverter With Topology
2. Major Components of Inverters
3. Pure Sine Wave Inverter Design With Code
4. Modified Sine Wave Design With Code

Hello friends, hope you all are fine and enjoying good health. I have recently posted a project of my friend named as Design & Development of Hybrid Renewable Energy System, which is a pure electrical project.After that project, I thought of sharing some common electrical modules.

So first of all, I am gonna explain all about inverters. I have divided this tutorial into four parts which are shown in the table. This is a step by step guide to design and build an inverter and I hope at the end of this tutorial you guys will be able to design your own inverter. I tried my best to keep it simple but still if you guys got stuck at any point ask in comments and I will solve your query.

What is an Inverter

  • An Inverter is an important electrical instrument used to convert DC voltage into AC voltage, its quite easy to explain what is an inverter but its too way difficult to design an inverter.
  • In projects, mostly inverter is used to convert the 12V DC voltage into 220V AC voltage, obviously first it is converted to 12V AC and then stepped up to 220 volts (mainly) for the consumers.

Types of Inverters

There are various types of an inverters such as :
  • Pure Sine-wave inverters.
  • Modified sine wave inverters.
  • Square wave inverters.
  • Multi-level inverters.
  • Resonant inverters (etc.).
The main three of which are discussed below in detail.
Modified sine-wave inverters
  • The output of a modified square wave, quasi square, or modified sine wave inverter is similar to a square wave output except that the output goes to zero volts for a time before switching positive or negative.
  • It is quite simple to design and is compatible with almost every electrical equipment except for sensitive or specialized equipment,e.g. laser printers, audio equipments etc.
  • Most AC motors can run on this power source but with reduction in efficiency of approximately 20%.
Sine-wave inverters
  • A pure sine wave inverter is the best form of inverter as it produces perfect sine wave and the energy dissipation in it is minimal.
  • Pure sine wave inverter is compatible with all electrical devices.
  • Its designing is complicated as compared to all other inverters.
Square wave inverters
  • The square wave output has a high harmonic content, not suitable for certain AC loads such as motors or transformers.
  • Square wave units were the pioneers of inverter development.

Inverter topologies.

  • There are many different power circuit topologies and control strategies used in inverter designs.
  • Different design topologies address various issues that may be more or less important depending on the way that the inverter is intended to be used.
First Method
  • Inverters normally use H-bridge configuration.
  • However, the voltage level at which, the H-bridge is operated can be varied.
  • The normal inverters convert the DC into AC at 12 Volts.
  • After this inversion, this 12Volt AC is stepped up into 220 Volts AC by the means of a transformer.
  • The advantage of such an approach is that the bridge construction is easy, as it is not exposed to high voltages.
  • The disadvantages accompanying such an approach are :
    • The transformer steps up the harmonic content.
    • The size and weight of the transformer increases considerably, as the capacity of inverter is increased.
Second Method
  • To overcome such problems, we can use a topology of converting DC into AC at the output voltage of the inverter.
  • At first, boosting the battery voltages by the means of a DC-DC converter and then giving these voltages toa specially designed Hbridge.
  • This arrangement can overcome the previously mentioned disadvantages.
  • The main disadvantage of such an approach is that the bridge circuit becomes too complex.
So, that was the basics of Inverters, you should also have a look at Introduction to Multilevel Inverters. If you have any problem then as in comments.
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