Category: Electronics


Image 4


In these days of Virus spread , automatic hand sanitizer and auto water tap are the need of the hour.

This is a very simple and low cost effective circuit without a Microcontroller.

Water pump or Water Solenoid can be controlled for dispensing sanitizer or water automatically when hand is brought near the sensor.

Sensor used here is an IR MODULE.

Image 3


The IR sensor module is built on  IR Transmitter and Receiver, Opamp, Variable Resistor &  output LED indicator. IR LED Transmitter is white or transparent in colour,and emits infra red light invisible to human eye.IR Receiver is a photo diode black in color to absorb more light.

IR rays reflected from object is sensed by this receiver and current flow is proportional to the amount of Light. This property makes it useful for IR detection.

A LM358 or 386 comparator is on board and gives a LOW signal while detecting IR.

Normally Output pin is HIGH and becomes LOW on any intruder object.The blue trimpot can be adjusted for sensitivity.

The board operates on 5V DC , and we need a 7805 regulator to convert 12v to 5v.

Image 2


The main device in the circuit is the 4 leg IC OPTOCOUPLER PC817.

It is the cheapest IC available and price is less than a 555 IC.


It has inbuilt  Infrared Emitting Diode (IR LED) and a photo transistor . It is Enclosed in a 4 pin package.

The photo transistor’s base becomes activated when LED conducts and throws light on it. When the current flowing through the LED is interrupted, the infra-red emitted light is cut-off, causing the photo-transistor to cease conducting. The photo-transistor can be used to switch current in the output circuit.

The black DOT is pin 1 which is ANODE of Diode.


The output of OPTO drives a Transistor and in turn the solenoid.

The transistor we use is a NPN  BD139.


Image 7

  • Continuous Collector current (IC) is 1.5A
  • Collector-Emitter voltage (VCE) is 80 V
  • Collector-Base voltage (VCB) is 80V
  • Emitter Base Breakdown Voltage (VBE) is 5V
  • DC current gain (hfe) is 40 to 160

To the collector of BD139 is added the load (solenoid or water pump) through supply voltage.

When BD139 conducts , it switches ON the solenoid.

A diode 1n4007 is used across the coil of solenoid.

A    FLY BACK Diode is placed with reverse polarity from the power supply and in parallel to the relay’s inductance coil. The use of a diode in a relay circuit prevents huge voltage spikes from arising when the power supply is disconnected. A flyback diode is sometimes called flywheel diode, relay diode, or snubber diode as a flyback diode circuit is a type of snubber circuit.

The solenoid used for water tap is the one widely used in water coolers.

Normal working voltage is 24v DC , but it works fine on 12v.

Image 5


The valve features a solenoid, which is an electric coil with a movable ferromagnetic core (plunger) in its center. In the rest position, the plunger closes off a small passage. An electric current through the coil creates a magnetic field. The magnetic field exerts an upwards force on the plunger opening the passage.

This is the basic principle that is used to open and close solenoid valves.

The hole size of 1/4 , 1/2 inches available.

Smaller size ones used for sanitizer dispenser and the bigger ones for water tap.

Instead of solenoid you can replace with a pump motor also.

Image 6

This is a low cost, small size Submersible Pump Motor which can be operated from a 2.5 ~ 6V power supply. It can take up to 120 liters per hour with very low current consumption of 220mA. Just connect tube pipe to the motor outlet, submerge it in water and power it. Make sure that the water level is always higher than the motor. Dry run may damage the motor due to heating and it will also produce noise.

The final circuit requires a 12v supply .

The IR module used here is sensitive to Sun Light.So always cover the IR LEDs with a black sleeve or tape and adjust sensitivity by turning the blue trimpot.

When hand is brought near the IR circuit , it sends a LOW signal to OPTO coupler.

This conducts the BD139 and in turn operates the solenoid or pump.






Previous post Minipro 866 CS

In this post we shall review the second model of MINIPRO UNIVERSAL PROGRAMMER .This is same as the 866CS model but has the ability to program “IN CIRCUIT”. ICSP programming involves programming the chip leaving it on the existing board itself.This saves the hard work of removing the chip from board and again fixing it.

We shall see how to program PIC16F877A leaving the target IC on the demo board itself.The ZIF socket on programmer is not used & ICSP connector is used instead.

Open the MINIPRO IDE & select the target IC as PIC16F877A.


Instead of 40P Adapter selection (which is default) we’ll select the ICSP port seen under “Set Interface” & ensure that ICSP VCC is Enabled.If this is not enabled then a separate power source is needed for the target demo board.

Click on OK.


Now click on the INFORMATION button seen at the right top corner.

This will display the ICSP connection details between the programmer & the target board.

As the readymade wire supplied with the programmer may not match with all target boards , it is better to use separate wires.Here our target board has male berg pins.So Female to Female Jumper wires are used for the connections.


No separate power source is required for the target demo board as we’ve selected ICSP_VCC Enable.


To load the HEX file on to the buffer click File à Open & browse to the HEX file location.



Confirm that INTEL HEX is selected under File Format of File load Options & All Memory selected under To Region


Now click OK to see the HEX file loaded to the buffer .



  Click the P button on top to initiate Programming


Finally click on the Program button.


You can see the Programming Progressive bar.


Finally PROGRAMMING SUCCESSFUL message appears.



For Programming ATMEL 89Sxx ICs the procedure is same as above.The ICSP connections are known by clicking the INFORMATION button .


Once the connections are done as per the diagram , the HEX file developed using KEIL can be loaded on the buffer.Then Program can be done.

For AVR ICs following is the ICSP connection detail



MINIPRO 866A is a must have tool for all Embedded enthusiasts and Lap Top service Engineers.

The huge support of IC list and ICSP functionality makes it the most value for money product.Note that other manufacturers offer these support for a cost of around Rs.25000/- while the cost of MINIPRO 866A is around 5500/- & if you do not need ICSP ,it is only Rs.4500/- (866CS model).

Watch this support video :

All these days I’ve been using the classic Windows Movie Maker for producing tutorial videos.Recently I purchased this CYBERLINK POWER DIRECTOR 13 for creating videos.This is the first video created using power director.You can leave the comments on the video.



For availability contact :

cooltext753793315 cooltext753790696

In a previous post we’ve seen a Universal Programmer TOPWIN which is capable of programming 8051,PIC,AVR,EEPROM ,EPROM,etc.. But the main problem with TOPWIN is its incompatibility with 64 bit Operating System & Windows 8 .

In this post we shall review an excellent Universal programmer MINIPRO 866 from AUTOELECTRIC Co. that works on all platforms including 32/64 bit Windows 8 .



Two models are available MINIPRO 866 CS & MINIPRO 866 A.

The 866 A has an additional advantage of ICSP – In Circuit Serial Programming – a real awesome support for ON board programming of SMD chips.

ICSP now supports ATMEL89S51,52, ATMEGA- AVR whole series and MICROCHIP PIC10F, 12F, 16F, 18F whole series,SYNCMOS SM59Dxx / SM59Rxx full range.

Minipro programmer delivers outstanding performance in supporting nearly 13k + devices that other similar products like Topwin are not capable.


Download the IDE version 6.10 from :

Always download the latest version as the list of support ICs is updated frequently.

Start the installation file by double clicking MiniProV610setup.exe application.

You can leave it to default location or browse to a preferred one.





Click on INSTALL to confirm USB Driver installation.



Click “Install this driver software anyway “ to bypass Windows verification.


Click FINISH to complete the installation.



Now connect the Hardware unit to the USB port .Under Device Manager you can see the device name as “MiniIProWdf” if the installation went through smoothly.


You’re all set to start the Programming.Open the IDE & if you get Reflash Firmware window , just click on Tools à Reflash Firmware from the IDE to install the latest updates

Obviously you should connect the hardware to the USB & your internet connection should be ON for this process.If there is no access to internet the Reflash Firmware window appears again.




Once the Reflash is successful , click on the “Cancel” button. (Yes it is not OK button ,it is Cancel button) !!

We shall see how to program PIC 16F877A IC .

Under Select IC à click Search and Select IC.


Under Type select MCU/MPU & start typing “PIC16F” inside the ‘ search device’ space bar.All the related PIC ICs will be displayed on the right pane.Select the target IC as , PIC16F877A.

Click on Select.


Ensure that 40 pin adapter is selected on top .Later we’ll see how to work with ICSP.


Click on “Information” button at the right top corner to learn how to place the chip on the ZIF socket.According to the diagram place the IC on the socket , pin 1 is always near the handle.


Lock the handle by pressing it down.

By clicking under DEVICE ,you can perform initial check for the IC .Blank check can be done & if you want to erase the chip , click ERASE


Following is the screenshot of Chip Erase function :


To load the HEX file on to the buffer click File à Open & browse to the location where you’ve stored the HEX file that is to be fused on to the target chip.


Select the HEX file & click Open.


The File Load Options should be in the File format “INTEL HEX” .The Binary option is to load a “bin” file.Here confirm INTEL HEX is selected.


Under DEVICE click on PROGRAM to start fusing the HEX file.


On the next Chip Program window click “Program”.




You can see PROGRAM SUCCESSFUL if the fusing is finished.

To make a copy of a chip say, EPROM 27C256 following is the method :

Select Device as 27c256 using Search Device bar.



Click on the Information button & place the Master IC on to the ZIF socket as per the diagram.


Ensure that the VPP Voltage at the bottom of the screen is selected according to programming voltage of the chip (mostly it is 13.5 or 12v)



Click the “R “ button to READ the chip to the buffer.



Now remove the MASTER chip from the ZIF socket & place the SLAVE IC .This IC should be a fresh blank one or erased one under UV light.

Click on the “P” button on the top to start copying the data on the buffer to the chip.


Same way you can make copy of PIC ,AVR or 8051 Microcontrollers.Remember that , if the source IC is previously LOCKED ,you can’t make a copy.

To program SMD ICs & other QUAD package ICs you can buy Converters on which this IC is mounted.


In the next post we shall review the ICSP model of MINIPRO 866.

Watch this demo video :


Universal Programmer MINIPRO 866CS for all PIC,AVR,8051,EPROM,….


For availabilty of this programmer contact :

cooltext753793315    cooltext753790696

Many of you may wonder how to draw an electronic circuit or schematic on your PC.In this post I will demonstrate 2 excellent programs  to draw circuits.

Image 7

1) ExpressPCB

The ExpressPCBSetup program includes both ExpressSCH for drawing schematics and ExpressPCB for circuit board layout . Express PCB is a well known PCB manufacturing Company offering this  layout software  completely free, for business promotion.


EAGLE software is the best selling CAD tool in Europe.We are going to use only the limited free version , as our aim is to create circuits.

The name EAGLE is an acronym, which stands for Easily Applicable Graphical Layout Editor.

Download the Windows version (35Mb download) of Eagle software from

New and improved EAGLE part libraries make your circuit creation a breeze.

Double click the downloaded  eagle-win-5.11.0.exe file to start the Setup

Image 4

During setup select “Run as Freeware” option before clicking Finish.

Image 5

After successful installation you can start the program to see the welcome screen :

Image 9

Click File –> New –> Schematic  to start up drawing your circuit

Image 10

For demo purpose I am going to show how to draw the following circuit in EAGLE

(circuit courtesy )


Note down the parts list in the circuit.The above one consists 3 transistors, 7 Resistors,3 electrolytic capacitors, 1 mic ,etc.,

To add these components click  Edit – > Add

Image 14

ADD window pops up showing the vast list of component library from where you select the parts.

Image 15

Scroll down the list to select Transistor or use the Search facility at the bottom to arrive at the required component.In the above circuit 3 nos. of BC548 transistors are used.As there is BC 547 in the list,select it and click ok. Later you can right click and change Value to Bc548 .

Now your cursor changes into a crosshair with the transistor symbol in the background.Clicking the mouse anywhere on the schematic window places the transistor symbol.Position according to the circuit and place all transistors by clicking the mouse.

After placing don’t forget to click the Red Stop button found on the top tool bar.This cancels further placing of  transistor symbol.

Again click Edit –> Add  . Now select Resistor .Under the list of resistors select the one that matches your requirement and click OK. Clicking the mouse on schematic window places the selected Resistor icon.After placing all the resistors click STOP red button to cancel further placements.

You can right click on any of the symbols placed to change the Name(T2,R1,..),Value (BC547,BC548,..), Rotate (place horizontal,vertical,..) and many more functions.

Before drawing wiring connections, place all components aligned according to the actual circuit.You can right click on any component ,select Move ,and place them anywhere you like.Always use STOP Red button on top to cancel further action.

Click  Draw –> Wire

A new tool bar appears below the main tool bar showing different options for Wire Bends, S bend, L bend, freehand wire bend,etc., Select any one of the Wire Bends or you can draw only straight lines by selecting Draw –> wire.

For e.g to place a wire from the Resistor R2 to base of Transistor Q1 ,

Click Draw –> Wire .Now place the cross wire cursor on the one end of Resistor R2 and click once the mouse.Dragging the mouse will draw a Green line.Drag it to base of Transistor T1 and click once.Click STOP Red button on top to complete this wiring.Repeat this process for all wiring. Note that while you move the cursor towards STOP button, the green line follows the cursor.Once you click the Stop button, the line between two clicks only remain.

After finishing all wiring you can save by clicking File –> Save .But the file is saved as .sch extension.

Instead you can File –>  Print –> Select Print to file (pdf) to save as a PDF file.

or File –> Export – > Image   and then provide a filename and browse to a location to store the file as .png,.tiff or .bmp image files.

Gas Sensors

All Gas Sensors have 6 pins ,whether it is MQ2  (smoke),  MQ3 (alcohol),  MQ6 (LPG) or MQ7 (carbon monoxide).So , the following details apply to all types of MQ sensors.


MQ-2 is a  Semiconductor Sensor for Combustible Gas and Smoke

This  sensor detects the concentrations of combustible gas in the air and output its reading as an analog voltage.

MQ-2 gas sensor has high sensitivity to LPG, Propane and Hydrogen, also could be used to Methane and other combustible gas.

Sensitive material of MQ-2 gas sensor is Tin Di-Oxide SnO2, which has lower conductivity in clean air. When the target combustible gas exist, MQ 2 senses and its  conductivity is more higher along with the gas concentration rising.

A simple electronic circuit is used to convert change of conductivity to corresponding  output signal of gas concentration.

MQ-2 has 6 pins, 4 of them are used to fetch signals, and other 2 are Heater coil used for providing heating current.


You can use 5v DC or AC across H – H pins. And as you can see one of H pins goes to the power and the other one is connected to the ground. The pin A (you can connect both pins A )is connected between the power and the ground.The pin B gets an analog voltage when the sensor is active. Also across the output, you need the resistor RL. Before you connect the resistor use a potentiometer to tune and get accurate values. Generally RL value is between 20k and 200k.


Connecting five volts (AC or DC) across the heating (H) pins keeps the sensor hot enough to function correctly. Connecting five volts at either the A or B pins causes the sensor to emit an analog voltage on the other pins. A resistive load between the output pins and ground sets the sensitivity of the detector.

Generally in the market you get these sensors fixed on a breakout board.

image        image

This breakout board is designed to work with any of the MQ-series gas sensors, simplifying the interface from 6 to 3 pins—ground, +5V VCC, and an analog voltage output.

Connect VCC to 5 V, GND to ground, and OUT to an analog-to-digital converter (ADC). The board has two pairs through-hole pins for the required sensitivity-selecting resistor RL across GND and OUT. The resistance of RL should be calculated using the datasheet for your particular gas sensor.

The MQ gas sensors have no polarity, so the gas sensor will work with the board all the ways it fits into the 6 pins (there are two possible orientations on each side of the board).


Most of your Engineering projects involve a Sensor.Depending on the output  signal from the sensor you can further build your project.

It is necessary to know the types of sensors and their functions.This post will help you decide on the sensor.


image     Flammable Gas & Smoke Sensor MQ-2

image Alcohol Gas Sensor MQ-3

image       Methane Gas Sensor MQ-4

image  LPG / Isobutane / Propane Gas Sensor MQ-6

image      Carbon Monoxide Gas Sensor MQ-7

image      Carbon Monoxide & Flammable Gas Sensor MQ-9



image       image PIR (Passive Infra Red) Sensor

image  GP2Y0A21 Sharp distance sensor

image Ultrasonic sensor module


image  Color Sensor TCS230-DB





image   LOAD CELL







imageimage  TSOP1738 INFRARED SENSOR


image  Zx Metal Detector



        10,EDAYAR STREET,COIMBATORE  91422 2398827

Stepper Motors vs Servo Motors




STEPPER MOTOR                                   SERVO MOTOR

How to identify whether a motor is Servo or Stepper ?

Simple. A servo motor has only 3 wires and generally in a plastic container.A stepper has more wires 4,6 or 8 and constructed in a metal body.

Both are technically called Permanent Magnet Synchronous Motors (PMSMs).

Stepper motors are Open Loop ,meaning, it cannot achieve desired location under load. This result in Poor position accuracy while micro stepping. Steppers have very poor torque characteristics at higher speeds.

In Stepper systems the controller only tells the motor ,how many steps to move & how fast to move.But there are no feedback sensors to know the exact position of motor.

Stepper motors are widely used in Printers & Plotters(Printer carriage drive,paper feed,ribbon wind,print head position matrix).In Industry it is used for x-y-z table positioning of Milling machines,Laser cutting machines & Lathes.


As Servos are Closed Loop they can achieve positional accuracy. The position of the motor is tracked by a feedback signal.

Servos can produce speeds & powers 2 to 4 times that of similarly sized steppers. This is achieved because of Closed Loop & constant position feedback. Any discrepancy between a desired & an actual position is corrected from the constant positional feedback. Also ‘stalling’ cannot occur because of closed loop, unless there is an immovable object in the path.Servo motor resolution depends upon the encoder used , encoders produce 2000 to 4000 pulses per revolution

Stepper motors are cheaper .Small applications are limited to steppers. It can operate with or without feedback (encoders), but the exact position will not be known by the controller.

Applications requiring significant torque at higher speeds are generally best solved with servos. Servos will use only what current is needed to produce a required torque.

Steppers are driven in  constant current mode, creating heat in motor & the drive electronics. Stepper motors are less expensive. They are brushless & experience little or no wear.

Typically brushless servo motors have 2, 4, 6 & 8 magnetic poles on the rotor, whereas the most common motor design used in factory automation has 100 poles. So Steppers have higher torque capability but lower speed range.

What is a Torque ?

Torque is a force that tends to rotate or turn things .A good example is tightening the nuts on your car wheels by a wrench. When you use a wrench, you apply a force to the handle. This force creates a torque on the lug nut which tends to turn the nut. The SI unit (International system of units) for measuring torque is Newton-meter.

Torque is moment of force. To calculate torque you just have to multiply the force by the distance from the center.

Servo assembly & functioning

  A servo motor is an assembly of a DC motor, a gear reduction unit, a position sensing device (a potentiometer) & a control circuit.

The function of a servo is to receive a control signal that represents a desired output position of the servo shaft and apply power to its DC motor until its shaft turns to that position. The shaft does not rotate freely like a normal motor, but can turn only 200 degrees back & forth.

A Servo motor can be either DC or AC. AC servos can handle much higher current surges than a DC (as DC has brushes).Only entry level machines have DC servos , CNC machines use only AC servos. Brush type servo motors require change of brushes every 5000 hours. But brushless ones have no servicing requirements.

  Wiring Details


a) SERVO WIRING                         b) STEPPER WITH 6 LEADS



    c)   A UNI POLAR STEPPER                     d)  A BIPOLAR STEPPER


Servo has 3 wire connection – Power(Red) , Ground(Black)  and Control (Yellow).

The servo control signal  is a PWM (pulse width modulation). A Servo has its own internal drive electronics for running its built in motors.So as a control input ,a timing waveform is given.

Stepper assembly & functioning

Stepper motor wiring is complex.Inside a stepper motor there are 4 coils of wire located 90 deg, away from   each other & in the middle is the Rotor.The rotor has permanent magnets fitted around its circumference.Most steppers have 6 wires (there are also 4,5 or 8 wire motors).Each of the 4 coil is made up of one length of wire with 2 ends, a live & a common.In a 6 wire stepper ,as seen in fig.c above,there are 2 pairs of common wires joined together (wires 2 and 5).In a 8 wire stepper all  4 coils are separate and none of the 4 common wires are joined together.

General color coding for a 6 wire stepper is as follows .:  (see fig.c)

–1st winding end colors are Black-1/Brown-3  and Green-2 is center tap for this.

–2nd winding end colors are Yellow-4/Orange-6 and Red-5 is the center tap.

But this coding of color may vary from one make to other.Simply by measuring the impedence(resistance value) of coils by a multimeter reveals the coils .All coils have similar resistance.By making note of this we can easily sort out the coil connections.

Further, steppers are of 2 types, Unipolar  and Bipolar.

As seen in above fig.c  a unipolar stepper has 2 coils ,each has a center tap.

A bipolar stepper has 2 coils per phase (see fig.d above) .No center tap is used & it uses entire winding.But a unipolar stepper uses only half the winding at one time.A unipolar stepper can be used as a bipolar one by simply not using the center tap.

Drivers to control Servo

  A great advantage of servo motors is that they are very easy to control compared to other types of motors . The servo motor has all this control circuitry internally.hitec_servo_b

The power & ground wires are hooked directly up to power supply . The Signal wire will be hooked up to the microcontroller used to control the servo.The signal that we need to create in order to control the servos is called a Pulse With Modulation signal or PWM for short. The best part of the servo drive design is that it  only requires 1 pin from the microcontroller like PIC you are using to generate PWM signal.

 Drivers to control Stepper

Unlike servos , steppers do not have inbuilt control circuits.So the control driver circuit has to be assembled separately &  it is nearly 4 times costlier than the stepper motor itself. 

ICs L297 &L298    pair together perfectly for controlling a stepper motor

           The L297 has 4 inputs supplied by the user, a ground, step input (clock), direction and enable. From these inputs the L297 decides what outputs should be given to the L298 in order to control the stepper motor properly.
           The L298 will constantly be supplying current to the stepper motor unless you add additional sensing circuitry, so make sure you don’t forget the 10Ω resistors off of pins 1 & 15, the sense pins. This limits the current to 300mA and means out L298 won’t get heated up.


L298 IC                                                 DRIVE BOARD USING L297 &L298



For further details contact :

Saravana Electronics,  91422 2398827

10,Edayar Street,Coimbatore,TN