Sunday, August 31, 2008

Introduction to OptoCoupler

What is an OptoCoupler?
A device that uses a short optical transmission path to transfer a signal between elements of a circuit, typically a transmitter and a receiver, while keeping them electrically isolated is said to be an optically coupled device or an opto coupler.

Why to use an OptoCoupler?
There are many situations where signals and data need to be transferred from one subsystem to another within a piece of electronics equipment, or from one piece of equipment to another, without making a direct ‘ohmic’ electrical connection. Often this is because the source and destination are (or may be at times) at very different voltage levels, like a microprocessor which is operating from 5V DC but being used to control a triac which is switching 240V AC. In such situations the link between the two must be an isolated one, to protect the microprocessor from over voltage damage.

Problem with Relays
Relays can of course provide this kind of isolation, but even small relays tend to be compared with ICs and many of today’s other miniature circuit components. Because they’re electro-mechanical, relays are also fairly bulkynot as reliable and only capable of relatively low speed operation. Where small size, higher speed and greater reliability are important, a much better alternative is to use an optocoupler. These use a beam of light to transmit the signals or data across an electrical barrier, and achieve excellent isolation.

Light Emitting Diode

Hi let us see the operation of Light Emitting Diode (LED). The internal structure of an LED is shown above for clear understanding.

A light-emitting diode, usually called an LED, is a semiconductor diode that emits incoherenet beam of spectrum when biased in the forward direction of the p-n junction. This effect is a form of electroluminescence. A LED is usually a small area light source, often with extra optics added to the chip that shapes its radiation pattern. LEDs are often used as small indicator lights on electronic devices and increasingly in higher power applications such as flashlights and area lighting. The color of the emitted light depends on the composition and condition of the semiconducting material used, and can be infrared, visible, or ultraviolet.

When sufficient voltage is applied to the chip across the leads of the LED, electrons can move easily in only one direction across the junction between the p and n regions. In the p region there are many more positive than negative charges. In the n region the electrons are more numerous than the positive electric charges. When a voltage is applied and the current starts to flow, electrons in the n region have sufficient energy to move across the junction into the p region. Once in the p region the electrons are immediately attracted to the positive charges due to the mutual Coulomb forces of attraction between opposite electric charges. When an electron moves sufficiently close to a positive charge in the p region, the two charges "re-combine".

Each time an electron recombines with a positive charge, electric potential energy is converted into electromagnetic energy. For each recombination of a negative and a positive charge, a quantum of electromagnetic energy is emitted in the form of a photon of light with a frequency characteristic of the semi-conductor material (usually a combination of the chemical elements gallium, arsenic and phosphorus). Only photons in a very narrow frequency range can be emitted by any material. LED's that emit different colors are made of different semi-conductor materials, and require different energies to light them.

Automatic Meter Reading(AMR)

The automatic meter reading is one of the part of the project 'Embedded based power tampering detection and automatic meter reading using GSM'. Please refer to the previous post about tampering techniques and circuits used for detecting them.

What is the Drawbacks of manual reading?
The automatic metering system is designed to make the prevailing electricity billing system simpler and efficient. The conventional metering system is done manually. An employee of the Electricity Board will be coming to take the reading and enter in the card. There are more chances of manual error, delay in processing, tampering of the meter and misusage of the Electricity by other sources. It requires so many workers, one set of workers to note down the reading and other set to cut the power if the payment is not paid at the right time and we have very poor servicing.

How we can rectify it?
Instead of utilizing man power in billing system, we can automate the system and the man power can be utilized to provide quality service.

In the Automatic System designed, the units consumed are measured at the consumer side and is transmitted to the Electricity Board side where the amount equivalent is calculated and transmitted back to the consumer module. The monetary values are displayed both at the consumer module and electricity board side.

How does it work?
The project uses the ATMEL AT89C51 microcontroller for communication with the GSM modem.The AMR system uses the electro optical interface for converting meter dials into digital form. The AMR system starts at the meter. Some means of translating readings from rotating meter dials, or cyclometer style meter dials, into digital form is necessary in order to send digital metering data from the customer site to a central point with the use of electro optical interface. The data from the meter is stored in the microcontroller and the each rotation of the disc is calculated with this optical interface method.

The data from the microcontroller is fed to the GSM modem in a periodical basis say once in every week. The units transferred to the Electricity board are manipulated and the bill is sent to the customer site via the same GSM. Along with the bill, the due date for the payment of bill can also be transmitted.

Wednesday, August 27, 2008

Magnetic Tampering

Magnetic tampering technique is done by bringing a high powered magnet in close proximity of the domestic electricity meter. When this is done, the disc stops rotating. The circuit for the magnetic tampering detection circuit is as shown above.

The vital component used in the occurrence of the magnetic tampering technique in the domestic electricity meter is the Reed switch. The reed switch contains two magnetizable and electrically conductive reeds which have end portions separated by a small gap when the switch is open. The reeds are hermetically sealed in opposite ends of a tubular glass envelope.

In the magnetic tampering technique, a high power magnet is brought in contact with the electricity meter. When this happens, the rotor disc is exposed to a high magnetic field. Then the resultant opposing magnetic field to the rotor is highly increased leading to slowing down of rotor or perfect stopping of the disc rotation. The electricity meter is thus manipulated and ultimately power is consumed without being paid for.

Now when a reed switch is placed on the electricity meter and is connected to the micro controller, the magnetic tampering can be effectively identified. When a high power magnet is bought in proximity of the electricity meter in the presence of the Reed switch two leads come in contact with each other and result in the closed circuit thereby helping in detection of the signal by the micro controller. Thus the tampering is detected and the micro controller receives the information, which it passes on to the LCD unit and the GSM modem.

Current Reversal Tampering

The aluminium rotor disc present in the electricity meter runs in the clockwise direction as long as the neutral and phase connections are connected properly to it. But if these two wires are reversed, the meter starts to malfunction thereby rotating in the reverse direction ther by leading to reduction in meter reading. Hence to monitor the proper rotation of aluminium rotor disc and to avoid the current reversal tampering, a pair of LED and Photodiode duo ( LED 1 and LED 2 ) are placed above and below the aluminium rotor disc as shown in the figure above.

To let the light from LED fall on the photodiode, a slot is cut on the aluminium rotor disc. When the disc rotates in clockwise direction, light from LED1 falls first on the Photodiode 1 followed by the other, LED2 light falling on Photodiode 2. The output of the photodiodes are given to individual microcontroller ports with the help of a pull up circuit. As long as the sequence of LED1 and LED2 output enters the microcontroller, there is no tampering. If the order of photodiode output to the microcontroller is reversed, LED2 output reaching the microcontroller first followed by LED1 output, then there is the possibility of Current reversal tampering being attempted.

When the ports A and B respectively for Photodiode 1 and Photodiode 2 outputs are detected in order, two LEDs placed outside the electricity meter glow in order to indicate the perfect working of the electricity meter. When the ports are detected in reverse order, the LEDs glow in the reverse order as well, so as to indicate malfunctioning.

As the rotor disc rotates in the opposite direction, the tampering information is sent to the micro controller. When micro controller receives the signals, it transfers it to the LCD and the GSM modem. So an information about the tampering that has occurred is displayed in the LCD, as well as sent to the electricity board through the GSM modem.

Thus the tampering of the electricity meter using the current reversal technique is detected and intimated to the electricity board for further action.

Please see my previous post on the project 'Embedded Based Power Tampering Detection and Automatic Meter Reading System Using GSM' for more details.

Neutral Tampering

This tampering is done by disconnecting the neutral wire in the domestic electricity meter. The circuit designed for the detection of neutral tampering is shown above.

The component used for the neutral tampering detection circuit is an Optocoupler connected in parallel to the Voltage coil.

The circuit works as follows. As long as the neutral and the phase are connected to the voltage coil, the parallely connected Optocoupler LED produces a high output therby biasing the base of the photo transistor which produces an output at the emitter. This output is continuously monitored by the microcontroller.

When the neutral wire from the electricity meter is disconnected, the power supply to the LED is also disconnected and hence it does not glow. As soon as the LED fails to glow, the photodiode is unbiased and its output drops to low level or logic “0” signal and it sent to the micro controller. The microcontroller senses this change in optocoupler output and thus intimates the GSM modem to send a message to the Electricity board regarding the Neutral tampering.

The micro controller is programmed using embedded C so as to intimate and transfer signals according to the signals received ( either “1” or “0”). When micro controller receives the signals, it transfers it to the LCD and the GSM modem. So an information about the tampering that has occurred is displayed in the LCD, as well as sent to the electricity board through the GSM modem.

Tuesday, August 26, 2008

Power Tampering Module

The block diagram of the complete power tampering module is shown above. please refer to the previous post to know about the project 'Embedded Based Power Tampering Detection and Automatic Meter Reading System Using GSM'. We will discuss the details of each and every module seperately.

When tampering is detected, the information of the detection is sent to the micro controller. A program to this effect is written using embedded C and it is stored inside the ATMEL AT895C1 micro controller. For example, when a magnet is bought in the proximity of the electricity meter, the reed switch is affected and thus magnetic tampering is identified. Once this is done, the micro controller makes sure that a message “ MAGNETIC TAMPERING “ is displayed on the LCD.

This message is then passed on to the electricity board by use of the GSM technology. The buffer is used for temporary storage of the data.

Tampering Techniques

The three significant and common techniques of tampering the electricity meter are discussed below.


As quoted, an electricity meter contains a voltage coil and a current coil. Both these coils should be properly energized for ensuring the rotation of disk. In this type of tampering, the neutral wire from the voltage coil is removed. When this is done, the rotation of the disk is hampered and it stops rotating, which in turn stops the rotation of the electricity meter. Hence irrespective of the amounts of power consumed, there is no account of the units consumed.


In this type of tampering, the polarities,neutral and phase are reversed. When this tampering is done, the rotor disk, instead of flowing in the forward direction tends to rotate in the reverse direction and hence, the units of power measured moves in the reverse direction. In other words, the readings decrease, rather than increasing. Hence the units are manipulated and they display erroneous meter reading or low meter reading, than the actual amount of power consumed.


When a magnet of sufficient strength is brought near the electricity meter, the field opposing the rotation of the aluminium rotor disc increases thus making the rotor disc run in slow pace or stop either. This type of approach to make the electricity meter malfunction by means of placing a magnet near the meter is Magnetic Tampering.

Sunday, August 24, 2008

Embedded Based Power Tampering Detection And Automatic Meter Reading Sytem Using GSM

Our country has been ranked high in the list of ‘countries with high power theft’. Power theft occurs in various areas such as Industrial, Commercial and Residential areas. The theft by residential customers are responsible for most of the power loss in the country. A significant amount of this power theft is done at domestic levels by the tampering of the electricity meter.

The scope of this project is to identify three of the most commonly adapted techniques of power tampering and in furtherance, intimate to the electricity board or the authority concerned about the occurrence of the theft. This module of the project makes sure that valuable amounts of power can be saved by taking immediate action against those involved in the practice of meter tampering.

The three common methods of power tampering are NEUTRAL TAMPERING, CURRENT REVERSAL TAMPERING AND MAGNETIC TAMPERING. In our project, we detect these tampering methods by means of respective sensors and intimate it to the Electricity Board via GSM.

Further, the project also aims to eliminate manual manipulation of readings by linemen. The project provides an enhanced power tariff and billing system by transmitting the units of power used and the appropriate bill amount to the user and the electricity board. The entire transmission and reception process is done in a wireless medium.

Thursday, August 21, 2008

Electricity Meter

Electricity meter is a device designed for accounting of electric power in single-phase and three-phase power consumer networks.

Parts of an Electricity Meter

1.Voltage Coil - many turns of fine wire encased in plastic and connected in parallel with load
2.Current coil - three turns of thick wire, connected in series with load
4.Aluminium Rotor Disc
5.Rotor Brake Magnets
6.Spindle with worm gear
7.Display dials

Working of Electricity meter

The domestic electricity meter basically consists of two important coils for its working.
  1. The voltage coil
  2. The current coil
  • The voltage coil is connected in parallel to the load and the current coil is connected in series to the load.
  • The load herein refers to the appliances that consume electricity.
  • When power passes through these coils, a magnetic field is produced which induces an electro magnetic field in the rotor disc.
  • As a result of this magnetic field, eddy currents are produced in the rotor disc.
  • An opposing magnetic field is produced by the permanent stator magnets, which results in rotation of the rotor disc.
  • The disc rotates according to the power consumed by the consumer unit.

Wednesday, August 20, 2008

code snippet for serial communication

Hi here is the code for serial communication using CCS C compiler


#include<16f877a.h> //HEADER FILE;
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7)//TRANSMITION THROUGH RS232 ;
#byte portc=0x07 // SPECIFY PORTC ADDRESS;

main( )

set_tris_c(0x80); //SET TX_PIN & CLEAR RC_PIN;


printf("welcome to"); // IF I=0 DISPLAY "welcome to";

printf("serial communication"); //IF I=1 DISPLAY "serial communication";



Tuesday, August 19, 2008

The three main sections of MAX232

Hi we have seen introduction about serial communication and about MAX232 chip in my previous post. Let us now see at the three main sections of MAX232

  • Dual charge pump voltage converter – this section uses two external capacitors. One is used to double the +5V input to +10V and the other is used to invert +10V to -10V.
  • Transmitter section – each of the two transmitters is a CMOS inverter powered by +10V internally generated supply. The input is TTL and CMOS compatible with a logic threshold of about 26% of VCC. The input of an unused transmitter section can be left unconnected. An internal 400k ohm pull up resistor connected between the transistor input and VCC will pull the input high forming the unused transistor output low.
  • Receiver section – the two receivers fully conform to RS232 specifications. Their input impedance is between 3k ohm either with or without 5V power applied and their switching threshold is within the +3V of RS232 specification. To ensure compatibility with either RS232 input or TTL/CMOS input, the MAX232 receivers have VIL of 0.8V and VIH of 2.4V.

Saturday, August 16, 2008


A standard serial interface for PC, RS232C, requires negative logic, i.e., logic 1 is -3V to -12V and logic 0 is +3V to +12V. To convert TTL logic, say, TxD and RxD pins of the microcontroller thus need a converter chip. A MAX232 chip has long been using in many microcontrollers boards. It is a dual RS232 receiver / transmitter that meets all RS232 specifications while using only +5V power supply. It has two onboard charge pump voltage converters which generate +10V to -10V power supplies from a single 5V supply. It has four level translators, two of which are RS232 transmitters that convert TTL/CMOS input levels into +9V RS232 outputs. The other two level translators are RS232 receivers that convert RS232 input to 5V. Typical MAX232 circuit is shown below.

RS232 module

The RS232 standard is one of the oldest physical communication standards in computer world. The standard defines low-cost serial communication in a robust way where bits are sent sequentially on a copper line. It was originally defined for connecting devices such as computers, terminals and printers to modems. This equipment is connected through their serial port. Nowadays, the computer to computer link with a so-called null modem cable is commonly used.
Communication as defined in the RS232 standard is an asynchronous serial communication method. The word serial means, that the information is sent one bit at a time. Asynchronous tells us that the information is mot sent in predefined time slots. Data transfer can start at any given time and it is the task of the receiver to detect when a message starts and ends.
With synchronous communication, a clock or trigger signal must be present which indicates the beginning of each transfer. The absence of a clock signal makes an asynchronous communication channel cheaper to operate. Fewer lines are necessary in the cable. A disadvantage is that the receiver can start at the wrong moment receiving the information. The RS232 standard specifies that the voltages on the wire for sending logic 0 are from +5V to +15 V. The voltages for sending logic 1 are from -5V to -15V. Most micro controllers are not capable of generating these voltages. So to connect microcontroller to a true RS232 device, you need to convert the TTL voltage of 0V to +5V into voltages between -10V and +10V.

Want to get IC samples

Hi guys are you having a passion towards electronics, you can give life to your ideas. However you need money to get all the microcontrollers, sensors and other stuffs. Here are some sites which will give you samples.
  • is the best place to get your PIC microcontrollers.
  • is the place where you can get some useful sensors but you cannot find out DIP packages.
  • Allegro Microsystems is the place where you can get Hall Effect sensors and switches.
  • Maxim offers you analog comparators and other similar stuffs.
  • National Semiconductors also gives you samples.
Please know about the packages while ordering samples because you can get one which you couldn't use for your circuits.

Saturday, August 9, 2008

Serial Port Communication

Serial port communication with DB9 and RS232 is the most famous interfacing in PIC microcontroller. Hope you would have heard about it. Please be patient to see my post on Serial port communication with PC using PIC microcontroller.

Friday, August 8, 2008

LCD interfacing in my demo board

We have already seen in my previous post regarding LCD interfacing. I have also provided the code snippet in CCS C compiler for LCD interfacing. However because of some problem with my demo board I was not able to post the picture of the interfacing, but now I have solved the problem with my demo board. The below picture shows the image of LCD interfacing for the code snippet, that I have provided earlier.

My experience at Flowgic India Pvt Ltd

Hi everyone, I recently attended an interview at Flowgic India Pvt Ltd. It is a vlsi design company and being a core company I was very much eager to get into it. The first round was written test, as the company was vlsi based they asked me to write some programs in verilog for the given conditions. The written test also included some puzzles and two comprehension passage. The duration was 3 hours for written test. Then after clearing the written test I attended the HR interview, mostly they asked me to write C programs. The questions where very much interesting and I liked a lot to answer them. Then the final round was again an HR round they asked me about working of capacitor and inductor, some puzzles, and asked me to draw the timing response curve for two circuits it was a tough one. I am now waiting for my results. Hope for a good outcome.

Written test at BHEL

BHEL is abbreviation of Bharat Heavy Electrical Limited. I recently attended the written test held for BHEL at SIET College, Teynampet. There were only 50 positions for electronics engineers and I was stunned to see hundreds of people coming to attend the written test. The written test is for totally 2 hours and 30 minutes and included two sections. You have totally 240 questions to answer within this short duration of time. The paper had two parts the first one was from electronics field covering all the basic concepts on electronics. The second part contained aptitude and English Grammar. For every question there are five choices and there were also negative markings (1/5 for each wrong answer). You must able to plan your time well to answer all the questions. Just skip of the questions that have very long sentences like a paragraph and concentrate on the smaller ones it will save you a lot of time. Please be well prepared about the modulation techniques, digital electronics, microprocessor basics and mathematics. Hope this information is useful to you.

Transistors Vs Vaccum Tubes

Hi we all would have heard about transistors and vaccum tubes. The vaccum tubes are the predecessors and let us see the advantages of transistors over the vaccum tubes.
  • small size and minimal weight, allowing the development of miniaturised electronic devices.
  • highly automated manufacturing process, resulting in low per-unit cost.
  • lower possible operating voltages, making transistors suitable for small, battery powered applications.
  • no warm-up period required after power application.
  • lower power dissipation and generally greater energy efficiency.
  • higher reliability and greater physical ruggedness.
  • extremely long life. some transistorised devices produces more than 30 years ago are still in service.
  • complementary devices available, facilitating the design of complementary-symmetry circuits-something not possible with vaccum tubes.
  • though in most transistors the junctions have different doping levels and geometry, some allow bidirectional current.
  • ability to control very large currents , as much as several hundred amperes.
  • insensitivity to mechanical shock and vibration, thus avoiding the problem of microphonics in audio applications.
  • more sensitive that hot and macroscopic tubes.

Friday, August 1, 2008

Use your keyboard keys to control the cursor

Sometimes your mouse may not respond properly and you cannot control your cursor movement. During such situation you can use your keyboard keys to control your cursor movement. You have to follow the simple steps below to do it.

First go to control panel and select the accessibility options. From the accessibility options window select the mouse tab as shown below.

Then check the use mouse keys option and click apply button as shown below. That’s it you can now control your cursor using the numeric keypad on your keyboard.

You can change your cursor’s top speed and acceleration from the settings for Mouse keys window as shown below. You can obtain this by clicking the settings button in the accessibility options window.

Some shortcut keys:

Alt+ left shift+ Num lock will open the accessibility window

After enabling the use mouse keys you can use ‘+’ to double click and ‘5’ to right click

Please share your review about this post by leaving a comment.