Show Mobile Navigation

Featured post

Testing of DC Machines (DC Motor and DC Generator)

Select Topic

Youtube Channel

Latest Stories

How Multicolor (Red Green Yellow) LEDs Work?

A LED that emits one color when forward biased and another color when reverse biased is called a multicolor LED.

Related Article: Working of Light Emitting Diode (LED)

One commonly used schematic symbol for these LEDs is shown below.

Working of Multicolor LEDs

Multicolor LEDs actually contain two pn junctions that are connected in reverse-parallel i.e. they are in parallel with anode of one being connected to the cathode of the other.

If positive potential is applied to the to terminal as shown below, the pn junction on the left will light.
Note that the device current  passes through the left pn junction.

If the polarity of the voltage source is reversed as shown in figure below, the pn junction on the right will light.

Note that the direction of device current has  reversed and is now passing through the right pn junction.

How Colors are Formed?

Multicolour LEDs are typically red when biased in one direction and green when biased in the other. 

If a multicolour LED is switched fast enough between two polarities, the LED will produce a third colour. 

A red/green LED will produce a yellow light when rapidly switched back and forth between biasing polarities.

Working of Light Emitting Diode (LED)

A light-emitting diode (LED) is a diode that gives off visible light when forward biased.

Light-emitting diodes are not made from silicon or germanium but are made by using elements like gallium, phosphorus and arsenic. By varying the quantities of these elements, it is possible to produce light of different wavelengths with colours that include red, green, yellow and blue.

For example, when a LED is manufactured using gallium arsenide, it will produce a red light. If the LED is made with gallium phosphide, it will produce a green light.

Working Theory of LED

When light-emitting diode (LED) is forward biased as shown in figure below, the electrons
from the n-type material cross the pn junction and recombine with holes in the p-type material. 

We know that these free electrons are in the conduction band and at a higher energy level than the holes in the valence band. 

When recombination takes place, the recombining electrons release energy in the form of heat and light. In germanium and silicon diodes, almost the entire energy is given up in the form of heat and emitted light is insignificant. 

However, in materials like gallium arsenide, the number of photons of light energy is sufficient to produce quite intense visible light.

The schematic symbol for a LED is shown in the above figure. The arrows are shown as pointing away from the diode, indicating that light is being emitted by the device when forward biased. 

Although LEDs are available in several colours (red, green, yellow and orange are the most common), the schematic symbol is the same for all LEDs. There is nothing in the symbol to indicate the colour of a particular LED. 

This is a graph between radiated light and the forward current of the LED. It is clear from the graph that the intensity of radiated light is directly proportional to the forward current of LED.

LED Voltage and Current

The forward voltage ratings of most LEDs is from 1V to 3V and forward current ratings range from 20 mA to 100 mA. 

In order that current  through the LED does not exceed the safe value, a resistor Rs is connected in series with it. The input voltage is Vs and the voltage across LED is Vⅆ.

Core Type and Shell Type Transformers

Depending upon the type of construction used, the transformers are classified into two categories.
  1. Core type Transformer
  2. Shell type Transformer

Core Type Transformer

In core type construction, as shown in figure, the coils are wound around the two limbs of a rectangular magnetic core.

Each limb carries one half of the primary winding and one half of the secondary winding so as to reduce the leakage reactance to the minimum possible. 

The LV (low voltage) winding is wound on the inside nearer to the core while the HV (high  voltage) winding is wound over the LV winding away from the core in order to reduce the amount  of insulation materials required.
Small transformers may have cores of rectangular or square cross section with rectangular or circular coils but it is wasteful in case of large capacity transformers.

In case of large sized transformers stepped cruciform core with circular cylindrical coils is employed, as illustrated in figure below

Stepped cruciform core employs laminations of different sizes.

Though the cost of manufacturing of such a cruciform core is much greater, but the circular coils that are used are easier to wind and provide more mechanical strength, especially when short-circuit occurs.

Other advantages of using cruciform core are,high space factor and reduced mean length of turns resulting in reduced copper loss. 

Shell type Transformer

In shell type construction, the coils are wound on the central limb of a three limb core. The entire flux passes through the central limb and divides into two parts going to side limbs, as shown in figure.

Consequently, the x-sectional area (and hence width) of the central limb is twice of that of each of the side limbs. 

Sandwich type winding is used in such a construction. 

Comparison of Core & Shell Type Transformers

Core Type Shell Type
Easy in design and construction. Comparatively complex
Has low mechanical strength due to non bracing of windings High mechanical strength.
Reduction of leakage reactance is not easily possible. Reduction of leakage reactance is highly possible
The assembly can be easily dismantled for repair work. It cannot be easily dismantled for repair work.
Better heat dissipation from windings. Heat is not easily dissipated from windings since it is surrounded by core.
Has longer mean length of core and shorter mean length of coil turn. Hence best suited for EHV (Extra High Voltage) requirements. It is not suitable for EHV (Extra High Voltage) requirements.

Application of Core & Shell Type Transformers

In shell type transformers advantage is gained through the core being used to protect the windings from mechanical damage. 

The shell type construction gives better support against electromagnetic forces between current carrying conductors. These forces are of considerable magnitude under short-circuit conditions. 

The shell type construction is commonly used for small transformers where a square or rectangular core cross-section is suitable for economic consideration. 

The shell type construction needs more specialized fabrication facilities than core type,while the latter offers an additional advantage of permitting visual inspection of coils in the-case of a fault and ease of repair it substation site. 

For these reasons, the present practice is to use core type transformers in large high voltage installations.

Why Core Type in HV and Shell Type in LV?

Core type transformers are popular in High voltage applications like Distribution transformers, Power transformers, and obviously auto transformers. 

Reasons are, High voltage corresponds to high flux. So, for keeping iron loss down we have to use thicker core. So core type is better choice. At high voltage we require heavy insulation. In core type winding, putting insulation is easier. In fact LV(low voltage) winding it self acts as an insulation between HV (high voltage) winding and core.

Where as, Shell type transformers are popular in Low voltage applications like transformers used in electronic circuits and power electronic converters etc. 

Reasons are, at low voltage, comparatively you require more volume for the copper wires than that of iron core. So the windows cut on the laminated sheets have to be of bigger proportion with respect to the whole size of the transformer. So, shell type is a better choice.

In shell type we don't care about the insulation much and insulation is thin and light. So we can put the winding anyway we want in the shell.

Low Voltage Switchgear

As per IEC 60947, switchgears with rated voltages up to 1000 V ac and 1500 V dc are termed as low voltage (LV) switchgear.

The term ‘switchgear’ is a generic term encompassing a wide range of products like circuit breakers, switches,  switch fuse units, off-load isolators, HRC fuses, contactors, earth leakage circuit breakers (ELCBS), miniature circuit breakers (MCBS), and moulded case circuit breakers (MCCBS), among others.

A commonly followed network combination in LV distribution boards in shown in the figure below.

It is a combination of power control centres and motor control centres or load distribution boards including lighting distribution boards.

The incomer/sub-incomer/ distribution network generally depends on the capacity of the source and the distribution of load centres.
Conventional Low Voltage Distribution Network
The characteristics and feature of load controlling and protecting devices vary on the basis of the locations. The system being most commonly followed currently is detailed below.

Conventional Incomer

The devices used in the incomer should be capable of:

1. Switching and carrying normal currents (generally above 1200 A);

2. Withstanding abnormal currents for a short duration in order to allow downstream devices  to operate;

3. Interrupting the maximum value of the fault current generated in the system;

4. Ensuring the safety to the operating personnel;

5. Inter-locking with downstream equipment; and

6. Facilitating easy maintenance.

ln the past, oil circuit breakers (OCBS), re-wireable fused isolators and air circuit breakers (ACBs) were the commonly used devices.

However, ACB has been acknowledged as an idea device for incomer in terms of the safety, reliability and maintenance needs of the system.

This is mainly due to its various characteristics like quick-make, quick-break stored energy type reliable mechanism, safety interlocks/ indications, ease of maintenance and its ability to withstand fault currents for a specified duration (1-3 secs) thereby allowing the feeder device to isolate the faulty branch of the network and ensuring reliable supply to healthy areas.

Conventional Sub-Incomer

The devices installed as parts of a sub-incomer should have the following characteristics:

  • Ability to achieve economy without sacrificing protection and safety
  • Capability to withstand abnormal currents; and
  • Need for relatively less number of inter-locking indicating accessories since it covers a limited area of network.

ACB’s and switch fuse units (SFUS) are, to a large extent, being used as sub-incomers along with modern devices like moulded case circuit breakers (MCCBs).

Conventional Feeder Protection

Feeder protection covers all load centres like motor control centres, lighting switchboards and industrial load centres. 

The choice of feeder protection device based on the different conventional feeder load centres are discussed below.

 1. Motor Control

The motor feeder needs to be protected against the following eventualities in addition to normal switching control:

  • Short-circuit;
  • Over-currents up to locked rotor condition; and
  • Single-phasing.

Requirements for Motor Control

Switching normal currentsContactors
Single-phasing sensingBi-metallic Relay
Over—current (up to locked rotor condition) sensingBi-metallic Relay
Switching over-currents including single-phasing current as aboveContactors
Short-circuit currentMCCB/SFU
LogicTimers/Auxiliary ; Contactors and other Accessories

2. Other Industrial Load Control

Loads like oven, pre-treatment and electroplating baths fall under this category and the feeders need to be protected against faulty over-currents. 

Presently MCCBS and SFUS are being commonly used for this purpose.

3. Lighting/Domestic Load Control

The requirements of domestic load control are similar to those listed in other industrial load control with the addition of earth leakage current protection in order to reduce any damages to life and property that could be caused by harmful leakages of electric current and fire.

In a low voltage power distribution system, electrical appliances are protected against damages from over-loads or short-circuits by fuses or circuit breakers. 

However, the human operator is not adequately protected when a fault occurs within the appliance itself. Hence the need for fast acting ELCBS operating on low leakage currents arises.

The device, which detects leakage current as low as 100 mA and is capable of disconnecting
equipment in less than 100 msec is called an earth leakage circuit breaker (ELCB). 

The following two types of ELCBS are used depending upon the parameters to be detected:

1. Voltage-operated ELCB; and
2. Current-operated ELCB.

Arduino DC Digital Voltmeter

A voltmeter is an instrument used for measuring electrical potential difference between two points in an electric circuit. Analog voltmeters move a pointer across a scale in proportion to the voltage of the circuit; digital voltmeters give a numerical display of voltage by use of an analog to digital converter. 

We are using internal ADC of Arduino to make Digital Voltmeter capable to display 0 to 5V. You can increase its input voltage capacity by using voltage divider circuit.

What you will learn?

1. How to connect 7-Segment Display to Arduino?
2. How to read analog input?
3. Use of shift register to reduce IOs.
4. Measurement of DC voltage using Arduino.

Components Required

1. Arduino Uno
2. 4 digit 7-segment Display Common Cathode.
3. Variable Resistor.
4. 1K Resistors
5. 75HC595

Digital Voltmeter Circuit

Main components of object counter circuit are 
  • 4 digit 7 segment display, 
  • Arduino Uno, 
  • 74HC595.
Digital Voltmeter Circuit Diagram
4 digit 7 segment display

Digital Voltmeter Arduino Code

Program is constructed using “TimerOne” library. Program have different modules, Setup, Loop. 
In setup we initialize all the IO connections and Timer, Display.
In main loop we are taking Analog input and constantly updating display to show voltage value.

#include <TimerOne.h>
//Define 74HC595 Connections with arduio
const int Data =7;
const int Clock=8;
const int Latch=6;
const int SEG0 =5;
const int SEG1 =4;
const int SEG2 =3;
const int SEG3 =2;
int cc =0;
char Value [4];
const char SegData []={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
// Setup
void setup () {
// initialize the digital pin as an output.
Serial . begin(9600);
pinMode ( Data , OUTPUT );
pinMode ( Clock, OUTPUT );
pinMode ( Latch, OUTPUT );
pinMode ( SEG0 , OUTPUT );
pinMode ( SEG1 , OUTPUT );
pinMode ( SEG2 , OUTPUT );
pinMode ( SEG3 , OUTPUT );
//Initialize Display Scanner
 cc =0;
Timer1 . initialize (10000); // set a timer of length 100000 microseconds (or 0.1 sec - or 10Hz
=> the led will blink 5 times, 5 cycles of on-and-off, per second)
Timer1 . attachInterrupt ( timerIsr ); // attach the service routine here
// Loop
void loop () {
char Volt [4];
int Voltage = analogRead ( A0 );
//To get fixed point decimal point we multiply it by 100
Voltage = (500/1024.0) * Voltage ; //Scaling of 0 to 5V i.e. 0 to 1023 to 0 to 10 (in 10 steps)
//Display Voltage on Segments
sprintf ( Volt ,"%04d", Voltage ); //We get ASCII array in Volt
Serial . println( Volt );
Value [0]= Volt [0] & 0x0F; //Anding with 0x0F to remove upper nibble
Value [1]= Volt [1] & 0x0F; //Ex. number 2 in ASCII is 0x32 we want only 2
Value [2]= Volt [2] & 0x0F;
Value [3]= Volt [3] & 0x0F;
// Generates Bargraph
void DisplayDigit (char d )
int i ;
for( i =0; i <8; i ++) //Shift bit by bit data in shift register
if(( d & 0x80)==0x80)
digitalWrite ( Data , HIGH );
digitalWrite ( Data , LOW );
d = d <<1;
 //Give Clock pulse
digitalWrite ( Clock, LOW );
digitalWrite ( Clock, HIGH );
//Latch the data
digitalWrite ( Latch, LOW );
digitalWrite ( Latch, HIGH );
void timerIsr ()
cc ++;
if( cc ==5) //We have only 4 digits
{ cc =1;}
Scanner ();
TCNT0 =0xCC;
void Scanner ()
switch ( cc ) //Depending on which digit is selcted give output
case 1:
digitalWrite ( SEG3 , HIGH );
DisplayDigit ( SegData [ Value [0]]);
digitalWrite ( SEG0 , LOW );
case 2:
digitalWrite ( SEG0 , HIGH );
DisplayDigit ( SegData [ Value [1]] | 0x80); //0x80 to turn on decimal point
digitalWrite ( SEG1 , LOW );
case 3:
digitalWrite ( SEG1 , HIGH );
DisplayDigit ( SegData [ Value [2]]);
digitalWrite ( SEG2 , LOW );
case 4:
 digitalWrite ( SEG2 , HIGH );
DisplayDigit ( SegData [ Value [3]]);
digitalWrite ( SEG3 , LOW );

What is a FUSE and How it Works?

A fuse protects an electrical circuit or device from excessive current when a metal element inside it melts to create an open circuit. With the excep­tion of resettable fuses, a fuse must be dis­carded and replaced after it has fulfilled its func­tion.

When high current melts a fuse, it is said to blow or trip the fuse. (In the case of a resettable fuse, only the word trip is used.) 

A fuse can work with either AC or DC voltage, and can be designed for almost any current. In residential and commercial buildings, circuit break­ers have become common, but a large cartridge fuse may still be used to protect the whole sys­tem from short-circuits or from overcurrent caused by lightning strikes on exposed power lines.

In electronic devices, the power supply is al­most always fused.

Schematic symbols for a fuse are shown in figure. Those at the right and second from right are most frequently used. The one in the center is approved by ANSI, IEC, and IEEE but is seldom seen. To the left of that is the fuse symbol understood by electrical contractors in architec­tural plans. The symbol at far left used to be com­mon but has fallen into disuse.

How a FUSE Works?

The element in a fuse is usually a wire or thin metal strip mounted between two terminals. In a cartridge fuse, it is enclosed in a glass or ceramic cylinder with a contact at each end, or in a small metallic can. (Old-style, large, high-amperage fuses may be packaged in a paper or cardboard tube.) The traditional glass cartridge allows vis­ual inspection to confirm that the fuse has blown.

A fuse responds only to current, not to voltage. When choosing a fuse that will be reliable in conditions of steady current consumption, a safe rule is to figure the maximum amperage when all components are functioning and add 50%. 

How­ever, if current surges or spikes are likely, their duration will be relevant. If I is the current surge in amps and t is its duration in seconds, the surge sensitivity of a fuse—which is often referred to verbally or in printed format as I2t—is given by the formula:

I2t = I² * t

Some semiconductors also have an I2t rating, and should be protected with a similarly rated fuse.

Any fuse will present some resistance to the cur­rent flowing through it. Otherwise, the current would not generate the heat that blows the fuse. Manufacturer datasheets list the voltage drop that the internal resistance of a fuse is likely to introduce into a circuit.

Types of Rechargeable Batteries

Rechargeable batteries are everywhere these days: cordless tools, laptop computers, cordless phones, and cell phones, just to name a few.

Rechargeable batteries for use with consumer electronic products are of four basic types: 

  1. Nickel cadmium (Ni-Cd), 
  2. Nickel metal hydride (Ni-MH) 
  3. Lithium ion (Li-Ion). 
  4. Lithium polymer (Li-Po)

Although these four types of batteries will not look much different from the outside, there are significant differences among them. We will explain a bit about each of them now.

Ni-Cd Batteries

Ni-Cd Batteries have been around the longest of these three types. There are many Ni-Cd batteries out there in use today. They have a good capacity and hold a very stable voltage between charges as they are being discharged.

The major Disadvantage of Ni-Cd batteries is the memory effect ( The decreasing useful time between charges for a rechargeable battery is due to what is called the memory effect )

Also, Ni-Cd batteries can only undergo a limited number of discharge-recharge cycles before they need to be replaced. They often last only one to two years.

Ni-MH (Nickel-metal hydride) Batteries

Ni-MH (Nickel-metal hydride) Batteries are a more recent development in rechargeable batteries.

They have many of the same advantages that the Ni-Cad batteries have. However they suffer much less from the memory effect than Ni-Cd batteries. There is some memory effect with Ni-MH batteries, but not nearly as much as with Ni-Cd. 

Also they can go through more discharge-recharge cycles than Ni-Cd batteries. Their typical useful life is more like 3 to 4 years. On the down side, Ni-MH batteries discharge more when not in use than Ni-Cds. 

After about a week of not being used, a fully charged Ni-MH battery will have lost about 20% of its charge. Also Ni-MH batteries cost more than Ni-Cd batteries, but their longer life tends to more than compensate for that.

Li-Ion (Lithium Ion) batteries

Li-Ion (Lithium Ion) batteries are the next newest type rechargeable battery to be commercially available.

They have all the advantages mentioned above for Ni-Cd and Ni-MH batteries and have a longer useful life than either of them. They do not suffer at all from the memory effect that is a problem for Ni-Cad and to a lesser extent for Ni-MH batteries. 

The main problem with Li-Ion batteries is that they lose about 10% of their useful capacity each year of use. This loss is due to chemical breakdown in the cells and currently there is no way to prevent or reverse this.

Li-Ion batteries typically last through about 300 to 500 discharge cycles, or about four to five years.

Li-Po (Lithium Polymer) Batteries

The next evolution of rechargeable battery technology is the Lithium Polymer Battery. 

Lithium Polymer or LiPo batteries are a great new way of storing energy for portable devices from cell phones, home electronics to RC hobby battery packs used in cars, boats and flight. 

They're great because they can store 350% (approximately) more energy than a typical NiCd/NiHm battery pack and weigh 10% - 20% less. They can also discharge much more current than a NiCd/NiHm battery and can be fully charged in about an hour. 

LiPo batteries also don't develop memory or voltage depression characteristics like NiCd/NiHm batteries, and do not need to be discharged before being charged.

But they're not without their downside. Mishandling of these batteries can lead to fire, explosions and toxic smoke inhalation.

Classification of Analog Instruments

An analog device is one in which the output or display is a continuous function of time and bears a constant relation to its input.

The analog instruments find extensive use in present day applications although digital instruments are increasing in number and applications. The areas of application which are common to both analog and digital instruments are fairly limited at present. 

Hence, it can safely be predicted that the analog instruments will remain in extensive use for a number of years and are not likely to be completely replaced by digital instruments for certain applications.

Classification of Analog Instruments

Broadly, the analog instruments (and for that matter digital instruments) may be classified according to the quantity they measure.  For example an instrument meant for measurement of current is classified as an Ammeter while an instrument that measures voltage is classified as a Voltmeter. Thus we have wattmeters, power factor meters, frequency meters etc...

Electrical instruments may also he classified according to the kind of current that can be measured by them. Electrical instruments may be classified as instruments for:

  1. Direct Current (DC)
  2. Alternating Current (AC)
  3. Direct and Alternating Curent (DC/AC)

Instruments depend for their operation on one of the many effects produced by current and voltage and thus can be classified according to which of the effects is used for their working.
The analog instruments are also classified as : 
  • (a) Indicating 
  • (b) Recording, 
  • (c) Integrating.

Indicating Instruments

Indicating Instruments are those instruments which indicate the magnitude of a quantity being measured. They generally make use of a dial and a pointer for this purpose. Ordinary voltmeters, ammeters and wattmeters belong to this category.

The analog indicating instruments may be divided into two groups :
  • (i) electromechanical instruments, 
  • (ii) electronic instruments. ‘
Electronic instruments are constructed by addition of electronic circuits to electromagnetic indicators in order to increase the sensitivity and input impedance.

Recording Instruments

Recording Instruments give a continuous record of the quantity being measured over a specified period. 

The variations of the quantity being measured are recorded by a pen (attached to the moving system of the instrument ; the moving system is operated by the quantity being measured) on a sheet of paper carried by it rotating drum. 

For example, we may have a recording voltmeter in a sub-station which keeps record of the variations of supply voltage during the day.

Integrating Instruments

Integrating Instruments totalize events over a specified period of time. The summation, which they give is the product of time and an electrical quantity. 

Ampere hour and watt hour (energy) meters are examples of this category. 

The integration (summation value) is generally given by a register consisting of a set of at pointers and dials.

The analog instruments may also be classified on the basis of method used for comparing the unknown quantity (measurand) with the unit of measurement. The two categories of instruments based upon this classification are:
  1. Direct Measuring Instruments
  2. Comparison Instruments

Direct Measuring Instruments

These instruments convert the energy of the measurand directly into energy that actuates the instrument and the value of the unknown quantity is measured or displayed or recorded directly. 

The examples of this class of instruments are ammeters, voltmeters, wattmeters and energy metres.

Comparison Instruments

These instruments measure the unknown quantity by comparison with a standard. 

Direct measuring instruments are the most commonly used in engineering practice because they are the most simple and inexpensive. Also their use makes the measurement possible in the shortest time

The examples of comparison type instruments are DC and AC bridges.
Comparison instruments are used in cases where a higher accuracy of measurement is required.

What is Ladder Diagram and How to Draw a Ladder Diagram?

This is a continuation of the previous article (Introduction to PLC Ladder Programming) in PLC Programming series. Please go through introduction to Ladder Programming before reading this post. In this post we will about the what is ladder diagram and how to draw a ladder diagram.

Ladder Diagram

A very commonly used method of programming PLCs is based on the use of ladder diagrams. 

Writing a program is then equivalent to drawing a switching circuit. The ladder diagram consists of two vertical lines representing the power rails. Circuits are connected as horizontal lines, i.e. the rungs of the ladder, between these two verticals.

How to Draw a Ladder Diagram?

In drawing a ladder diagram, certain conventions are adopted:
  • The vertical lines of the diagram represent the power rails between which circuits are connected. The power flow is taken to be from the left-hand vertical across a rung.
  • Each rung on the ladder defines one operation in the control process.
  • A ladder diagram is read from left to right and from top to bottom. Figure shows the scanning motion employed by the PLC. The top rung is read from left to right. Then the second rung down is read from left to right and so on. When the PLC is in its run mode, it goes through the entire ladder program to the end, the end rung of the program being clearly denoted, and then promptly resumes at the start. This procedure of going through all the rungs of the program is termed a cycle. The end rung might be indicated by a block with the word END or RET for return, since the program promptly returns to its beginning.

  • Each rung must start with an input or inputs and must end with at least one output. The term input is used for a control action, such as closing the contacts of a switch, used as an input to the PLC. The term output is used for a device connected to the output of a PLC, e.g. a motor.
  • Electrical devices are shown in their normal condition. Thus a switch which is normally open until some object closes it, is shown as open on the ladder diagram. A switch that is normally closed is shown closed.
  • A particular device can appear in more than one rung of a ladder. For example, we might have a relay which switches on one or more devices. The same letters and/or numbers are used to label the device in each situation.
  • The inputs and outputs are all identified by their addresses, the notation used depending on the PLC manufacturer. This is the address of the input or output in the memory of the PL.

Introduction to PLC Ladder Programming

Programs for microprocessor-based systems have to be loaded into them in Machine code, that is in a sequence of binary code numbers to represent the program instructions. We can also use assembly language based on the mnemonics, e.g. LD is used to indicate the operation required to load the data that follows the LD, and a computer program called an assembler is used to translate the mnemonics into machine code.

Programming can be made even easier by the use of the so-called high level languages, e.g. C, BASIC, PASCAL, FORTRAN, COBOL. These use pre-packaged functions, represented by simple words or symbols descriptive of the function concerned. For example, with C language the symbol & is used for the logic AND operation.

However, the use of these methods to write programs requires some skill in programming and PLCs are intended to be used by engineers without any great knowledge of programming. As a consequence, ladder programming was developed.

Ladder Programming is a means of writing programs which can then be converted into machine code by some software for use by the PLC microprocessor.

This method of writing programs became adopted by most PLC manufacturers, however each tended to have developed their own versions and so an international standard has been adopted for ladder programming and indeed all the methods used for programming PLCs.

Ladder diagrams

As an introduction to ladder diagrams, consider the simple wiring diagram of an electrical circuit shown below,

The diagram shows the circuit for switching on or off an electric motor. We can redraw this diagram in a different way, using two vertical lines to represent the input power rails and stringing the rest of the circuit between them. 

Both circuits have the switch in series with the motor and supplied with electrical power when the switch is closed. The circuit shown above is termed a ladder diagram.

In ladder diagram the power supply for the circuits is always shown as two vertical lines with the rest of the circuit as horizontal lines. 
  • The power lines, or rails as they are often termed, are like the vertical sides of a ladder with the horizontal circuit lines like the rungs of the ladder. 
  • The horizontal rungs show only the control portion of the circuit, in the case shown in the figures above, it is just the switch in series with the motor. 
  • Circuit diagram often show the relative physical location of the circuit components and how they are actually wired. 
  • With ladder diagrams no attempt is made to show the actual physical locations and the emphasis is on clearly showing how the control is exercised.

Ladder Diagram Example

This figure shows an example of a ladder diagram for a circuit that is used to start and stop a motor using push buttons. 
  • In the normal state, push button 1 is open and push button 2 closed. 
  • When button 1 is pressed, the motor circuit is completed and the motor starts. Also, the holding contacts wired in parallel with the motor close and remain closed as long as the motor is running. 
  • Thus when the push button 1 is released, the holding contacts maintain the circuit and hence the power to the motor.
  • To stop the motor, button 2 is pressed. This disconnects the power to the motor and the holding contacts open. 
  • Thus when push button 2 is released, there is still no power to the motor. 
Thus we have a motor which is started by pressing button 1 and stopped by pressing button 2.

Different Types of ROM | PROM, EPROM, EEPROM, Flash EPROM & Mask ROM

What is ROM?

ROM is a type of memory that does not lose its contents when the power is turned off. For this reason, ROM is also called non volatile memory.

Different Types of ROM

There are different types of read-only memory, such as 
  1. PROM (Programmable ROM)
  2. EPROM (Erasable Programmable ROM)
  3. EEPROM (electrically erasable programmable ROM)
  4. Flash EPROM
  5. Mask ROM

PROM (programmable ROM) and OTP

PROM refers to the kind of ROM that the user can burn information into. In other words, PROM is a user-programmable memory. 

For every bit of the PROM, there exists a fuse. PROM is programmed by blowing the fuses. If the information burned into PROM is wrong, that PROM must be discarded since its internal fuses are blown permanently. For this reason, PROM is also referred to as OTP (One Time Programmable).

Programming ROM, also called burning ROM, requires special equipment called a ROM burner or ROM programmer.

EPROM (erasable programmable ROM) and UV-EPROM

EPROM was invented to allow making changes in the contents of PROM after it is burned. 

In EPROM, one can program the memory chip and erase it thousands of times. This is especially necessary during development of the prototype of a microprocessor-based project. 

A widely used EPROM is called UV-EPROM, where UV stands for ultraviolet. The only problem with UV-EPROM is that erasing its contents can take up to 20 minutes. 

All UV-EPROM chips have a window through which the programmer can shine ultraviolet (UV) radiation to erase the chip’s contents. For this reason, EPROM is also referred to as UV-erasable EPROM or simply UV-EPROM. 

Programming a UV-EPROM

To program a UV-EPROM chip, the following steps must be taken:
  1. Its contents must be erased. To erase a chip, remove it from its socket on the system board and place it in EPROM erasure equipment to expose it to UV radiation for 5—20 minutes.
  2. Program the chip. To program a UV-EPROM chip, place it in the ROM burner (programmer). To burn code or data into EPROM, the ROM burner uses 12.5 volts or higher, depending on the EPROM type. This voltage is referred to as Vpp in the UV-EPROM data sheet.
  3. Place the chip back into its socket on the system board.
As can be seen from the above steps, not only is there an EPROM programmer (burner), but there is also separate EPROM erasure equipment. The main problem, and indeed the major disadvantage of UV-EPROM, is that it cannot be erased and programmed while it is in the system board. To provide a solution to this problem, EEPROM was invented.

EEPROM (electrically erasable programmable ROM)

EEPROM has several advantages over EPROM, such as the fact that its method of erasure is electrical and therefore instant. as opposed to the 20-minute erasure time required for UV-EPROM. 

In addition, in EEPROM one can select which byte to be erased, in contrast to UV-EPROM, in which the entire contents of ROM are erased. 

However, the main advantage of EEPROM is that one can program and erase its contents while it is still in the system board. it does not require physical removal of the memory chip from its socket. In other words, unlike UV-EPROM, EEPROM does not require an external erasure and programming device.

To utilize EEPROM fully, the designer must incorporate the circuitry to program the EEPROM into the system board. In general, the cost per bit for EEPROM is much higher than for UV-EPROM.

Flash memory EPROM

Since the early 1990s, Flash EPROM has become a popular user-programmable memory chip. and for good reasons. 
  • First, the erasure of the entire contents takes less than a second, or one might say in a flash, hence its name, Flash memory. 
  • In addition, the erasure method is electrical, and for this reason it is sometimes referred to as Flash EEPROM. To avoid confusion, it is commonly called Flash memory. 

The major difference between EEPROM and Flash memory is that when Flash memory's contents are erased, the entire device is erased, in contrast to EEPROM, where one can erase a desired byte. 

Although in many Flash memories recently made available the contents are divided into blocks and the erasure can be done block by block, unlike EEPROM, Flash memory has no byte erasure option.

Because Flash memory can be programmed while it is in its socket on the system board, it is widely used to upgrade the BIOS ROM of the PC. Some designers believe that Flash memory will replace the hard disk as a mass storage medium.

This would increase the performance of the computer tremendously, since Flash memory is semiconductor memory with access time in the range of 100 ns compared with disk access time in the range of tens of milliseconds. For this to happen, Flash memory's program/erase cycles must become infinite, just like hard disks. 

Program/erase cycle refers to the number of times that a chip can be erased and reprogrammed before it becomes unusable. At this time, the program/erase cycle is 100,000 for Flash and EEPROM, 1000 for UV-EPROM, and infinite for RAM and disks. 

Mask ROM

Mask ROM refers to a kind of ROM in which the contents are programmed by the IC manufacturer. In other words, it is not a user-programmable ROM. 

The term mask is used in IC fabrication. Since the process is costly, mask ROM is used when the needed volume is high (hundreds of thousands) and it is absolutely certain that the contents will not change. 

It is common practice to use UV-EPROM or Flash for the development phase of a project, and only afier the code/data have been finalized is the mask version of the product ordered. 

The main advantage of mask ROM is its cost, since it is significantly cheaper than other kinds of ROM, but if an error is found in the data/code, the entire batch must be thrown away. It must be noted that all ROM memories have 8 bits for data pins; therefore, the organization is x8.

Controlling a Servo Motor with Arduino

A servomotor is also defined as a rotary actuator that allows for very fine control of angular positions.

Many servos are widely available and quite cheap. Servos can drive a great amount of current. This means that you wouldn't be able to use more than one or two on your Arduino board without using an external source of power.

When do we need Servos?

Whenever we need a way to control a position related to a rotation angle, we can use servos.

Servos can not only be used to move small parts and make objects rotate, but can also be used to move the object including them. Robots work in this fashion, and there are many Arduino-related robot projects on the Web that are very interesting.

In the case of robots, the servo device case is fixed to a part of an arm, for instance, and the other part of the arm is fixed to the rotating part of the servo.

How to control servos with Arduino

There is a nice library that should be used at first, named Servo.

This library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega.

By using other Arduino boards over Mega, we can figure out some software limitations. For instance, pins 9 and 10 cannot be used for PWM's analogWrite() method (

Servos are provided in three-pin packages:
  • 5 V
  • Ground
  • Pulse; that is, control pin
Basically, the power supply can be easily provided by an external battery, and the pulse still remains the Arduino board.

Wiring Servo to Arduino

The following diagram is that of a servo wired to an Arduino for both power supply and control:

Firmware controlling one servo using the Servo library

Here is a firmware that provides a cyclic movement from 0 degrees to 180 degrees. 

Servo myServo; // instantiate the Servo object 
 int angle = 0; // store the current angle 

void setup() 

// pin 9 to Servo object myServo 

void loop() 

for(angle = 0; angle < 180; angle += 1) 


for(angle = 180; angle >= 1; angle -=1) 



We first include the Servo library header.

Then we instantiate a Servo object instance named myServo.

In the setup() block, we have to make something special. We attach pin 9 to the myServo object. This explicitly defines the pin as the control pin for the Servo instance myServo.

In the loop() block, we have two for() loops, and it looks like the previous example with the piezoelectric device. We define a cycle, progressively incrementing the angle variable from 0 to 180 and then decrementing it from 180 to 0, and each time we pause for 20 ms.

There is also a function not used here that I want to mention, This function reads the current angle of the servo (that is, the value passed to the lastcall to write()). This can be useful if we are making some dynamic stuff without storing it at each turn.
Editor's Choice