About Me

Pilani, Rajasthan, India
I am an engineering student currently pursuing an undergraduate degree in Electronics & Instrumentation from BITS Pilani, Pilani campus. My hobbies are reading novels- fiction and non-fiction alike, playing and watching football, dabbling with new software and going through blogs. I love reading Electronics For You. It has helped me a lot in my college life. And sometimes, people around me.

Hope you find this blog useful. Thank you.

Tuesday, May 24, 2011

Driving Circuits for DC motors

For a first timer, the rotation of a motor’s shaft, at just a push of a button, is pure thrill! Especially,if he has designed the circuit himself. This post is dedicated to DC motors, their driving circuits and ends with a sample DIY (do it yourself) breadboard circuit.

DC motor

The typical DC motor used in robotics is a 2 wired object having a shaft at its end.  

Typical ratings of DC motors commonly used are given in terms of ‘maximum supply voltage’ for stable operation and no-load speed expressed in ‘rpm’ (revolutions per minute). These motors are generally internally geared to provide increased torque to carry the weight of the robot and the circuitry and the ‘payload’ if any. Another important property of DC motors is that they are current-intensive components. Hence, ‘turning a motor on’ draws a large amount of current  suddenly from the power source.

For more theory on DC motors and their functioning, this is a very good starting point. 

Reversing the polarity of input voltage reverses the direction of rotation of the shaft (WOAH!! REALLY ?!). Also, it is a good practice to be aware of the absolute maximum ratings of your DC motor before using it as they vary from motor to motor.

DC motor driving circuits

1) H bridge circuits: Directional control is achieved by a hardwired circuit with the help of switches. This type of circuit is an example of pure hardware based control. The following diagram illustrates the directional control of a single DC motor using such a circuit.

Disadvantage of such a circuit is that wiring becomes highly complicated by the addition of a single motor to an existing circuit. Also, the switches undergo a lot of wear and tear as the switching action brings about a large change in potential (~12 V) and current (~400-500 mA - varies from motor to motor).

2) IC based circuits : The IC very commonly used for motor control is L293D. All ICs are accompanied by a ‘datasheet’ which all the details that you need to know before using that IC. You can download the datasheet of the L293D IC manufactured by ST Microelectronics here. The most important parts of this datasheet for us would be the pinout diagram (Page 2), the absolute maximum (Page 2) and the typical characteristics (Page 3). Following is the pinout diagram (from the datasheet) of L293D.

The functions of the various pins in simple terms are:

EnableX (X = 1,2) enables that side of the IC. Driving the EnableX pin high (~5 V generally) allows us to use the corresponding side (left or right) of the IC.

InputX (X = 1,2,3,4) is the control input for the IC. Driving InputX high drives the OutputX pins to Vs volts and driving it low (~0 V) makes the OutputX pin go low.

Vs is the voltage you want to apply to the DC motor connected across the output pins.

GND is the common or the reference potential of the circuit.

Vss is the control input for the IC that determines the minimum voltage that can be applied across the motor i.e. the minimum value of Vs.

We can achieve bi-directional control of two motors safely using this IC. For unidirectional control (not generally the case), we can use a single IC for 4 motors, but this is generally not done as a lot of current flows through the IC as all motors run simultaneously (the worst case), which might smoke it up – smoking is injurious for humans and ICs both!

DIY Breadboard schematic

Following bread-board schematic made using Fritzing Alpha illustrates the typical connection. Open the image in a new tab/window and have a close look at the connections.

Please note, in the above circuit, I have used a 5 V regulator IC (7805 or TO-220) to obtain 5V from 9V. All you need to know right now is that, with the named part of the IC facing you, the left most pin is the Input pin (Pin 1), the centre pin is the Common or the Ground (Pin 2) and the last pin is the Output 5 V pin (Pin 3). For proper functioning of this IC, the input voltage should be at least 2 V greater than the regulated voltage (5 V in this case). This diagram should make the connections clearer.
Also, the connections to the input have not been shown. They have to be done using switches between 5 V and GND potentials. Try it out yourself!

Cost breakup

DC Motor – Rs. 150-200
L293D IC – Rs. 60-80 

Hope this post was useful. Trust me, you will find yourself using the same circuit in almost all your motor-driving endeavours.
See ya!

Saturday, May 21, 2011

A Basic Proximity Sensor

Robotics involves working on sensors at some point of time or other. Also, at college level, students generally make robots that involve some sort of obstacle avoidance or seeking or sometimes both. In any case, detecting an obstacle is the first step. If you are concerned only with the presence (or absence) of some solid material in front of your robot, it makes absolutely no sense to use a camera as it would be a total waste of resources, a needless addition to your costs and most importantly it will also affect the response time of your robot.

What you really need is a 'proximity sensor'. As the name suggests, proximity sensors sense the proximity of an obstacle. (Du-uh ?!)

The most common proximity sensors used are IR LED-Photodiode based. In alternative implementations, Photodiodes can be replaced by Phototransistors, IR LED can be replaced by a LASER source. But, in all these implementations, the principle is the same:

There is a transmitter and a receiver( also called photodetector). The transmitter transmits EM rays all the time...if the receiver receives any of these rays, it can mean two things - either you have an obstacle in front of you reflecting these rays or you have another source of the same type of rays. Thus, this technique may not be the best obstacle-detecting technique around...but yeah..we still use it.

The following schematic made in TinyCAD illustrates the connections for a proximity sensor using IR LED and a Photodiode. Please note, this is a very basic circuit. Generally, the output voltage is first converted to a digital signal for use ( more on this later :) )

Basic Functioning of the Circuit

The IR LED is connected in series with a 330 ohm resistor to provide the correct voltage drop across the LED.
The Photodiode that is used must be sensitive to only that range of frequencies that the IR LED emits, else the purpose is lost - it is like a Chinese man receiving a message in Tamil. A Photodiode is used because it has the property that when reverse biased, the current it allows to pass across itself is a function of the intensity of optical illumination. Hence, it is very important to have the Photodiode reverse-biased i.e. the longer leg should have a lower potential than the shorter leg. Only then, your circuit shall work as desired.
As the robot goes nearer to the obstacle, more the number of reflected rays, more the optical illumination, more the current across the Photodiode and the resistor, more the output voltage..SIMPLE EH ?

Approximate cost break up

IR LED - Rs. 5-7
Photodiode - Rs. 5-10
Resistors - nominal

Alternative implementations

1) In the above circuit you can replace the IR LED by a laser source, so you will have to change your receiver accordingly, since the frequency of the rays has changed.
2) Also, if you want to increase the sensitivity of your sensor, you can replace the Photodiode by a Phototransistor as it provides a reasonable change in current even for a very small change in illumination at the cost of a teeny-weeny change in the circuit.
3) Yet another implementation which is much less complex is that using a Photoresistor or Light Dependent Resistor (LDR). But this type of proximity sensor is not generally used because it provides an appreciable output only after going very close to the obstacle, which is undesirable. Also, owing to memory effect, the response of LDR to changing illumination is very very slow compared to IR LED-Photodiode pair.

Hope this post was useful.
See ya.

Thursday, May 19, 2011

Robotics - A beginner's kit

ROBOTS!!! 2 hands…2 legs… Camera vision…making that weird whirring recoiling sound with every footstep…that is how most of us think of robots…not that ‘they’ are not robots…they are just a class of robots.. rather attractive class called Humanoids. Not to get very technical, a robot is simply a human creation…made with the aim to satisfy his or her( ;) ) master’s needs by performing certain tasks, not necessarily mechanical. Any artificial thing that is capable of reproducing an acceptable performance irrespective of changing conditions can be loosely termed a robot. Anyway, enough of the definition.

College time is the best time to take up robotics as many of us already know or will know. Let us admit it - Robotics attracts a lot of attention mostly because it sounds cool. But with time you realise that this is one of those things in which you get to do and learn a lot of ‘cool’ stuff that you actually come across in real life…for instance, the mobile phone you use. Robotics is very much prevalent in colleges primarily because the components involved don’t cost you a fortune and secondly, because beginner-level robotics is not rocket science. Also, a lot of colleges organise technical festivals that have robotics-centric events which witness a lot of competition and in turn motivates students. Alright, I have blabbered enough.

In this post, I will tell you what a beginner’s robotics kit should contain. These components are indispensable because however complicated your task at hand will be, you will need at least one of these around you. It would be good practice to get this kit up and ready ASAP if you are a robotics enthusiast and don’t have one such kit already. All of these are readily available at an electronics components shop near you or you can always order from Indian robotics e-shops like Robokits, Rhydolabz etc.

These are:


This is where you begin your circuit from scratch. Any circuit, however complicated, is almost always implemented on a breadboard. As to why it is called a ‘bread’board, a variety of explanations are available like this one. The following images show a normal breadboard and its internal connections. All points on a line are equipotential.
Cost – depends on the model – generally Rs. 50-75.

Single strand copper wires/jumpers

Breadboard connections are done using these wires as they make life easier than those multi-stranded thin wires that connect the switches to the fans at our homes. But please note, single stranded wires can’t substitute these wires as they have a very low current rating. Jumpers are simple single stranded copper wires with pointed ends to make life even easier.
CostRs. 8-10 per metre.

12 V AC-DC adapter

It is a good substitute for a battery if you are working near a AC supply point. Batteries generally discharge very fast and hence not viable to use them. Also, it is very convenient to draw power from this adapter – a simple loop of two wires gets you a positive and negative terminal.
Cost – varies – a simple 12V/500 mA adapter will cost anywhere between Rs. 80-100.

Wire cutter

If you are not too fond of using your teeth to remove insulation from wires, use this. Besides, it also proves useful for a number of other purposes like cutting a Printed Circuit Board or simply PCB, pulling out components from a soldered circuit etc.
Cost – Rs 40-50.

Solder gun and wire

Extremely important to have this around you all the time. Soldering is an extremely important skill to have because last minute changes are inevitable in any circuit. Also, it is desirable to have a few blank PCBs with you just in case there is an addition to your circuit and you don’t want to solder over an already packed PCB.
Cost – Rs. 80-90 for the solder gun, Rs. 30-40 for the solder wire.

Portable Digital Multimeter (DMM)

Multimeter is the most indispensable tool. Measuring potential, current, resistances, looking for shorts in soldering, checking an LEDs functionality….these are some of the major tasks for which you will use your DMM. You have to have it!
Cost – a decent DMM will cost you Rs. 125-150. Some models with more features cost around Rs. 300. Your choice!

Resistance/Capacitance box

It is always handy to have a box each of resistance and capacitance of assorted standard values. Several robotics components require you to have a particular capacitance in parallel (Crystal clocks) or a resistance of a particular value in series (Normal LEDs) so as to prevent damage, enhance efficiency or remove noise etc.
Cost – Rs 40 maximum for each, depends on the number of values and number of items of each value.

Also, it is desirable that you have a few LEDs with you…LEDs are a good substitute for a variety of things like a motor or a relay or checking if a particular pin in your controller (more on this later :) ) is working as desired.

There you go…you have a beginner’s kit ready!
This kit shall be the basic requirement of almost every circuit to be discussed in this space.
See ya!

Tuesday, May 17, 2011

The Pilot

Hello all. Welcome to my blog.

This space will be all about what I have learnt and/or done at my hostel room, the various laboratories in college or at my home sweet home. The content shall be mostly stuff that the curriculum doesn't cover.
I will try to present the content in an informal manner directly from my experience. References shall be quoted wherever I feel that my post is not enough to understand the topic well.

Please note, I may not have practically done 'each and every thing' that I write about in this space, but I can say with a fair amount of confidence that even if I discuss something that I have not yet undertaken myself, utmost care shall be taken to ensure that the topic is researched to the best of my ability and shall be of help to the reader in his/her endeavors.

Lastly, I do not claim that what I write is the absolute truth and the best content available. I am just a student trying to provide the content - that a beginner to the world of robotics, microcontrollers and virtual instrumentation needs - all at one place. For advanced topics and detailed helps, refer to the references and most importantly - Google!

Also, please feel free to comment, ask questions, answer questions, offer constructive suggestions to make this blog a better effort.