Railway Track Crack Deduction

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 63

RAILWAY TRACK CRACK DEDUCTION

Description:
In this Project we us arduino uno Microcontroller based Projects with gsm modem Interface,
it is the project to detect railway track crack detection using LDR(Light Dependent
Resistor).If any Crack Detected in the railway track it will send message to the pre
programmed mobile Number through GSM Modem.

Working Principle:
In this Project we are using arduino uno Microcontroller.The IDE used in this project is
Energia easy to use like Arduino.The Microcontroller Programmed using Launchpad kit and
placed in General Purpose board.In this Project L293D driver i.c is used to drive the Two
D.C Motors directions like forward and stop, and One LDR is used to connect ADC channel
0.Before check ldr value using serial port to find the value without object then with object
note the value,the noted value is your software condtion cheking for Motor RUN or STOP.
Suppose for example (prototype model) no crack is detected the LDR value is 200 the vehicle
goes forward direction,otherwise the crack is detected LDR value of adc channel 0 is goes
greater than 250 the Motor will STOP then send the SMS(Stored Message) to
Preprogrammed Mobile Number.GSM modem is connected to arduino serial port P1.1 RXD
and P1.2 TXD.It’s the simplest project to try and apply your own concepts with some simple
modification in the code

Introduction

Arduino is an open-source platform used for building electronics projects.

Arduino consists of both a physical programmable circuit board (often referred

to as a microcontroller) and a piece of software, or IDE (Integrated

Development Environment) that runs on your computer, used to write and

upload computer code to the physical board.

The Arduino platform has become quite popular with people just starting out

with electronics, and for good reason. Unlike most previous programmable

circuit boards, the Arduino does not need a separate piece of hardware (called a

programmer) in order to load new code onto the board – you can simply use a
USB cable. Additionally, the Arduino IDE uses a simplified version of C++,

making it easier to learn to program. Finally, Arduino provides a standard form

factor that breaks out the functions of the micro-controller into a more

accessible package.

This is an Arduino Uno

The Uno is one of the more popular boards in the Arduino family and a great

choice for beginners. We’ll talk about what’s on it and what it can do later in

the tutorial.
This is a screenshot of the Arduino IDE.

Believe it or not, those 10 lines of code are all you need to blink the on-board

LED on your Arduino. The code might not make perfect sense right now, but,

after reading this tutorial and the many more Arduino tutorials waiting for you

on our site, we’ll get you up to speed in no time!

You Will Learn


In this tutorial, we’ll go over the following:

 What projects can be accomplished using an Arduino

 What is on the typical Arduino board and why

 The different varieties of Arduino boards

 Some useful widgets to use with your Arduino

Suggested Reading

Arduino is a great tool for people of all skill levels. However, you will have a

much better time learning along side your Arduino if you understand some basic

fundamental electronics beforehand. We recommend that you have at least a

decent understanding of these concepts before you dive in to the wonderful

world of Arduino.

 What is Electricity?

 Voltage, Current, Resistance, and Ohm’s Law

 What is a Circuit?

 Polarity

 Integrated Circuits (ICs)

 Logic Levels

 Digital Logic

 Analog vs. Digital


What Does it Do?

The Arduino hardware and software was designed for artists, designers,

hobbyists, hackers, newbies, and anyone interested in creating interactive

objects or environments. Arduino can interact with buttons, LEDs, motors,

speakers, GPS units, cameras, the internet, and even your smart-phone or your

TV! This flexibility combined with the fact that the Arduino software is free,

the hardware boards are pretty cheap, and both the software and hardware are

easy to learn has led to a large community of users who have contributed code

and released instructions for a huge variety of Arduino-based projects.

For everything from robots and a heating pad hand warming blanket to honest

fortune-telling machines, and even a Dungeons and Dragons dice-throwing

gauntlet, the Arduino can be used as the brains behind almost any electronics

project.

And that’s really just the tip of the iceberg – if you’re curious about where to

find more examples of Arduino projects in action, here are some good resources

for Arduino-based projects to get your creative juices flowing:

 Instructables

 Bildr

 Arduino Playground

 The ITP Physical Computing Wiki


 LadyAda

 Make: Projects

 and, of course, you can find plenty more Arduino tutorials here at

learn.sparkfun.com.

What's on the board?

There are many varieties of Arduino boards (explained on the next page) that

can be used for different purposes. Some boards look a bit different from the

one below, but most Arduinos have the majority of these components in

common:
Power (USB / Barrel Jack)

Every Arduino board needs a way to be connected to a power source. The

Arduino UNO can be powered from a USB cable coming from your computer

or a wall power supply (like this) that is terminated in a barrel jack. In the

picture above the USB connection is labeled (1) and the barrel jack is labeled

(2).
The USB connection is also how you will load code onto your Arduino board.

More on how to program with Arduino can be found in our Installing and

Programming Arduino tutorial.

NOTE: Do NOT use a power supply greater than 20 Volts as you will

overpower (and thereby destroy) your Arduino. The recommended voltage for

most Arduino models is between 6 and 12 Volts.

Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF)

The pins on your Arduino are the places where you connect wires to construct a

circuit (probably in conjuction with a breadboard and some wire. They usually

have black plastic ‘headers’ that allow you to just plug a wire right into the

board. The Arduino has several different kinds of pins, each of which is labeled

on the board and used for different functions.

 GND (3): Short for ‘Ground’. There are several GND pins on the

Arduino, any of which can be used to ground your circuit.

 5V (4) & 3.3V (5): As you might guess, the 5V pin supplies 5 volts of

power, and the 3.3V pin supplies 3.3 volts of power. Most of the simple

components used with the Arduino run happily off of 5 or 3.3 volts.

 Analog (6): The area of pins under the ‘Analog In’ label (A0 through A5

on the UNO) are Analog In pins. These pins can read the signal from an
analog sensor (like a temperature sensor) and convert it into a digital

value that we can read.

 Digital (7): Across from the analog pins are the digital pins (0 through 13

on the UNO). These pins can be used for both digital input (like telling if

a button is pushed) and digital output (like powering an LED).

 PWM (8): You may have noticed the tilde (~) next to some of the digital

pins (3, 5, 6, 9, 10, and 11 on the UNO). These pins act as normal digital

pins, but can also be used for something called Pulse-Width Modulation

(PWM). We have a tutorial on PWM, but for now, think of these pins as

being able to simulate analog output (like fading an LED in and out).

 AREF (9): Stands for Analog Reference. Most of the time you can leave

this pin alone. It is sometimes used to set an external reference voltage

(between 0 and 5 Volts) as the upper limit for the analog input pins.

Reset Button

Just like the original Nintendo, the Arduino has a reset button (10). Pushing it

will temporarily connect the reset pin to ground and restart any code that is

loaded on the Arduino. This can be very useful if your code doesn’t repeat, but

you want to test it multiple times. Unlike the original Nintendo however,

blowing on the Arduino doesn’t usually fix any problems.

Power LED Indicator


Just beneath and to the right of the word “UNO” on your circuit board, there’s a

tiny LED next to the word ‘ON’ (11). This LED should light up whenever you

plug your Arduino into a power source. If this light doesn’t turn on, there’s a

good chance something is wrong. Time to re-check your circuit!

TX RX LEDs

TX is short for transmit, RX is short for receive. These markings appear quite a

bit in electronics to indicate the pins responsible for serial communication. In

our case, there are two places on the Arduino UNO where TX and RX appear –

once by digital pins 0 and 1, and a second time next to the TX and RX indicator

LEDs (12). These LEDs will give us some nice visual indications whenever our

Arduino is receiving or transmitting data (like when we’re loading a new

program onto the board).

Main IC

The black thing with all the metal legs is an IC, or Integrated Circuit (13). Think

of it as the brains of our Arduino. The main IC on the Arduino is slightly

different from board type to board type, but is usually from the ATmega line of

IC’s from the ATMEL company. This can be important, as you may need to

know the IC type (along with your board type) before loading up a new program

from the Arduino software. This information can usually be found in writing on
the top side of the IC. If you want to know more about the difference between

various IC’s, reading the datasheets is often a good idea.

Voltage Regulator

The voltage regulator (14) is not actually something you can (or should) interact

with on the Arduino. But it is potentially useful to know that it is there and what

it’s for. The voltage regulator does exactly what it says – it controls the amount

of voltage that is let into the Arduino board. Think of it as a kind of gatekeeper;

it will turn away an extra voltage that might harm the circuit. Of course, it has

its limits, so don’t hook up your Arduino to anything greater than 20 volts.
Main circuit diagram
L293D motor driver circuit
LDR circuit diagram
Project program

int firstSensor = 0;//arduino pins


const int Pin1 = 3;
const int Pin2 = 4;
const int Pin3 = 5;
const int Pin4 = 6;
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
pinMode(Pin1, OUTPUT); // digital sensor is on digital pin 2
pinMode(Pin2, OUTPUT); // digital sensor is on digital pin 2
pinMode(Pin3, OUTPUT); // digital sensor is on digital pin 2
pinMode(Pin4, OUTPUT); // digital sensor is on digital pin 2

void loop()
{
firstSensor = analogRead(A0);
Serial.print("ADC = " );
Serial.println(firstSensor);
delay(500);

if(firstSensor>250)
{
motorstop();
sendsms();
delay(2000);
forward();
delay(2000);
}
else
{
forward();
}
}
void forward()
{
digitalWrite(Pin4, HIGH); // set the LED on
digitalWrite(Pin3, LOW); // set the LED off
digitalWrite(Pin2, HIGH); // set the LED on
digitalWrite(Pin1, LOW); // set the LED off
}

void motorstop()
{
digitalWrite(Pin1, LOW); // set the LED on
digitalWrite(Pin2, LOW); // set the LED off
digitalWrite(Pin3, LOW); // set the LED on
digitalWrite(Pin4, LOW); // set the LED off
}

void sendsms()
{
Serial.println("AT+CNMI=1,2,0,0");
Serial.println("AT+CMGS=\"1234567890\""); //Enter Mobile Number between
double " " codes.
Serial.println("There is a Crack in the Railway Line"); //SMS to ur
Mobile Number
Serial.print(char(26));
delay(5000);
delay(5000);
}
GSM/GPRS Module
Table of Contents:

1. GSM/GPRS Module
2. Mobile Station
3. AT Commands
4. AT Commands' Syntax
5. AT Commands continued
6. Interfacing Modem

Written By: 

Nikhil Agnihotri
GSM/GPRS module is used to establish communication between a computer and a
GSM-GPRS system. Global System for Mobile communication (GSM) is an
architecture used for mobile communication in most of the countries. Global Packet
Radio Service (GPRS) is an extension of GSM that enables higher data
transmission rate. GSM/GPRS module consists of a GSM/GPRS modem
assembled together with power supply circuit and communication interfaces
(like RS-232, USB, etc) for computer. The MODEM is the soul of such modules.
 

 
 
Wireless MODEMs
Wireless MODEMs are the MODEM devices that generate, transmit or decode data
from a cellular network, for establishing communication between the cellular network
and the computer. These are manufactured for specific cellular network
(GSM/UMTS/CDMA) or specific cellular data standard
(GSM/UMTS/GPRS/EDGE/HSDPA) or technology (GPS/SIM). Wireless MODEMs
like other MODEM devices use serial communication to interface with and need
Hayes compatible AT commands for communication with the computer (any
microprocessor or microcontroller system).

 
 
 
GSM/GPRS MODEM
GSM/GPRS MODEM is a class of wireless MODEM devices that are designed for
communication of a computer with the GSM and GPRS network. It requires a SIM
(Subscriber Identity Module) card just like mobile phones to activate
communication with the network. Also they have IMEI (International Mobile
Equipment Identity) number similar to mobile phones for their identification. A
GSM/GPRS MODEM can perform the following operations:
 
1.      Receive, send or delete SMS messages in a SIM.
2.      Read, add, search phonebook entries of the SIM.
3.      Make, Receive, or reject a voice call.
 
The MODEM needs AT commands, for interacting with processor or controller,
which are communicated through serial communication. These commands are sent
by the controller/processor. The MODEM sends back a result after it receives a
command. Different AT commands supported by the MODEM can be sent by the
processor/controller/computer to interact with the GSM and GPRS cellular network.
 
 
GSM/GPRS Module
A GSM/GPRS module assembles a GSM/GPRS modem with standard
communication interfaces like RS-232 (Serial Port), USB etc., so that it can be easily
interfaced with a computer or a microprocessor / microcontroller based system. The
power supply circuit is also built in the module that can be activated by using a
suitable adaptor.

GSM/GPR
S Module, Modem

 
Mobile Station (Cell phones and SIM)
A mobile phone and Subscriber Identity Module (SIM) together form a mobile station.
It is the user equipment that communicates with the mobile network. A mobile phone
comprises of Mobile Termination, Terminal Equipment and Terminal Adapter.

How GSM/GPRS Works

 
Mobile Termination is interfaced with the GSM mobile network and is controlled by
a baseband processor. It handles access to SIM, speech encoding and decoding,
signaling and other network related tasks. The Terminal Equipment is an
application processor that deals with handling operations related to keypad, screen,
phone memory and other hardware and software services embedded into the
handset. The Terminal Adapter establishes communication between the Terminal
Equipment and the Mobile Termination using AT commands. The communication
with the network in a GSM/GPRS mobile is carried out by the baseband processor.
 
 
Difference between GSM mobile and GSM/GPRS module
A GSM mobile is a complete system in itself with embedded processors that are
dedicated to provide an interface between the user and the mobile network. The AT
commands are served between the processors of the mobile termination and the
terminal equipment. The mobile handset can also be equipped with a USB interface
to connect with a computer, but it may or may not support AT commands from the
computer or an external processor/controller.
 
The GSM/GPRS module, on the other hand, always needs a computer or external
processor/controller to receive AT commands from. GSM/GPRS module itself does
not provide any interface between the user and the network, but the computer to
which module is connected is the interface between user and network.
 
An advantage that GSM/GPRS modules offer is that they support concatenated SMS
which may not be supported in some GSM mobile handsets. Also some mobile
handsets can’t receive MMS when connected to a computer.
 
 
Applications of GSM/GPRS module
The GSM/GPRS module demonstrates the use of AT commands. They can feature
all the functionalities of a mobile phone through computer like making and receiving
calls, SMS, MMS etc. These are mainly employed for computer based SMS and
MMS services.

 
AT Commands
AT commands are used to control MODEMs. AT is the abbreviation for Attention.
These commands come from Hayes commands that were used by the Hayes smart
modems. The Hayes commands started with AT to indicate the attention from the
MODEM. The dial up and wireless MODEMs (devices that involve machine to
machine communication) need AT commands to interact with a computer. These
include the Hayes command set as a subset, along with other extended AT
commands.
 
AT commands with a GSM/GPRS MODEM or mobile phone can be used to access
following information and services:
1.      Information and configuration pertaining to mobile device or MODEM and SIM
card.
2.      SMS services.
3.      MMS services.
4.      Fax services.
5.      Data and Voice link over mobile network.
 
The Hayes subset commands are called the basic commands and the commands
specific to a GSM network are called extended AT commands.
 
 
Command, Information response and Result Codes:
The AT commands are sent by the computer to the MODEM/ mobile phone. The
MODEM sends back an Information Response i.e. the information requested by or
pertaining to the action initiated by the AT command. This is followed by a Result
Code. The result code tells about the successful execution of that command.

Exec
ution of AT Commands

 
There are also unsolicited Result Codes that are returned automatically by the
MODEM to notify the occurrence of an event. For example the reception of a SMS
will force MODEM to return an unsolicited result code.
AT commands' syntax
Case Sensitivity -
The AT commands are generally used in uppercase letters. However some
MODEMs and mobile phones allow both uppercase and small case letters.
 
Single Command -
The AT commands include a prefix AT which indicates the beginning of the
command to MODEM; and a carriage return which indicates the end of the
command.

Using a Single AT Command

 
However string ‘AT’ itself is not the part of the command. For example in ATD, D is
the command name not ATD.
The extended AT commands have a ‘+’ in the command name.
For example:   AT+CGMI<Carriage return>
 
Command Line -
Multiple AT commands can be sent to MODEM in a single command line. The
commands in a line are separated by a semi-colon (;).
 

For example:   AT+CGMI; +CBS<Carriage return>


 
String in Command Line -
Strings in a command line are enclosed in double quotes.
For example:   AT+CGML=”ALL”<Carriage return>
Information Response and Result Code –
The Information Response and Result Codes, returned by the MODEM, have a
carriage return and line feed in the beginning as well as at the end.

Information Response and Result Code

 
For example:
<Carriage return><Line feed>OK<Carriage return><Line feed>
<Carriage return><Line feed>ERROR<Carriage return><Line feed>
<Carriage return><Line feed>+CBC: 0, 60<Carriage return><Line feed> etc.
 
Sequence of Execution -
In the command line, the command appearing first is executed first. The execution
then follows for second appeared command and so on. The execution of commands
in a command line takes place in sequential manner.
 
If an error occurs in the execution of a command, an error result code is returned by
the MODEM and the execution of the command line is terminated irrespective of
presence of other commands next in the command line.
 
Types of commands:
There are four types of AT commands:
1)        Test commands
2)        Read commands
3)        Set commands
4)        Execution commands
For more details, see AT Commands.
 
 
Different Result Codes:
RESULT CODE DESCRIPTION
OK Successful Execution of a command
ERROR Execution of a command failed
+CMS ERROR Message service failure, is returned with an error code
 
Unsolicited Result Codes
+CDS Notify receipt of SMS status report of a new message to
computer
+CDSI Notify receipt of SMS status report of a new message and its
location in memory to computer
+CMT Notify forwarding of a new SMS to computer
+CMTI Notify receipt of SMS status report of a new message and its
location in memory to computer

Interfacing MODEM/Mobile phone with Windows platform


The Windows (XP and lower versions) comes with an application called
HyperTerminal for data communication through serial port of the computer. The
interfacing of the GSM/GPRS module with the serial port of the computer involves
following steps:
 
1)             Connect RS-232 port of GSM module with the serial port of the computer. Insert a
SIM card in the module.
2)             Open HyperTerminal from Start -> All Programs -> Accessories -> Communications
-> HyperTerminal.
3)             Enter a name for the connection and press OK.
4)             Now select the communication port (COM) at which GSM module is connected.

5)             Create a new connection set on HyperTerminal. Set parameters, like baud
rate as 9600, handshaking mode as none, parity bit as none, stop bit as 1 and data
bit as 8.

What is a Light Dependent Resistor or a Photo Resistor?


A Light Dependent Resistor (LDR) or a photo resistor is a device whose resistivity is a
function of the incident electromagnetic radiation. Hence, they are light sensitive devices.
They are also called as photo conductors, photo conductive cells or simply photocells. They
are made up of semiconductor materials having high resistance. There are many different
symbols used to indicate a LDR, one of the most commonly used symbol is shown in the
figure below. The arrow indicates light falling on it.

Working Principle of LDR


A light dependent resistor works on the principle of photo conductivity. Photo conductivity
is an optical phenomenon in which the materials conductivity (Hence resistivity) reduces
when light is absorbed by the material.

When light falls i.e. when the photons fall on the device, the electrons in the valence band of
the semiconductor material are excited to the conduction band. These photons in the incident
light should have energy greater than the band gap of the semiconductor material to make the
electrons jump from the valence band to the conduction band. Hence when light having
enough energy is incident on the device more & more electrons are excited to the conduction
band which results in large number of charge carriers. The result of this process is more and
more current starts flowing and hence it is said that the resistance of the device has
decreased.This is the most common working principle of LDR

Characteristics of LDR
LDR’s are light dependent devices whose resistance decreases when light falls on them and
increases in the dark. When a light dependent resistor is kept in dark, its resistance is very
high. This resistance is called as dark resistance. It can be as high as 1012 Ω. And if the
device is allowed to absorb light its resistance will decrease drastically. If a constant voltage
is applied to it and intensity of light is increased the current starts increasing. Figure below
shows resistance vs. illumination curve for a particular LDR.
Photocells or LDR’s are non linear devices. There sensitivity varies with the wavelength of
light incident on them. Some photocells might not at all response to a certain range of
wavelengths. Based on the material used different cells have different spectral response
curves.

When light is incident on a photocell it usually takes about 8 to 12ms for the change in
resistance to take place, while it takes seconds for the resistance to rise back again to its
initial value after removal of light. This phenomenon is called as resistance recovery rate.
This property is used in audio compressors.
Also, LDR’s are less sensitive than photo diodes and photo transistor. (A photo diode and a
photocell (LDR) are not the same, a photo-diode is a p-n junction semiconductor device that
converts light to electricity, whereas a photocell is a passive device, there is no p-n junction
in this nor it “converts” light to electricity).

Types of Light Dependent Resistors:

Based on the materials used they are classified as:


i) Intrinsic photo resistors (Un doped semiconductor): These are pure semiconductor
materials such as silicon or germanium. Electrons get excited from valance band to
conduction band when photons of enough energy falls on it and number charge carriers
increases.

ii) Extrinsic photo resistors: These are semiconductor materials doped with impurities which
are called as dopants. Theses dopants create new energy bands above the valence band which
are filled with electrons. Hence this reduces the band gap and less energy is required in
exciting them. Extrinsic photo resistors are generally used for long wavelengths.

Construction of a Photocell
The structure of a light dependent resistor consists of a light sensitive material which is
deposited on an insulating substrate such as ceramic. The material is deposited in zigzag
pattern in order to obtain the desired resistance & power rating. This zigzag area separates the
metal deposited areas into two regions. Then the ohmic contacts are made on the either sides
of the area. The resistances of these contacts should be as less as possible to make sure that
the resistance mainly changes due to the effect of light only. Materials normally used are
cadmium sulphide, cadmium selenide, indium antimonide and cadmium sulphonide. The use
of lead and cadmium is avoided as they are harmful to the environment.

Applications of LDR
LDR’s have low cost and simple structure. They are often used as light sensors. They are
used when there is a need to detect absences or presences of light like in a camera light meter.
Used in street lamps, alarm clock, burglar alarm circuits, light intensity meters, for counting
the packages moving on a conveyor belt, etc.

LED Circuit Symbol

The circuit symbol of LED consists of two arrow marks which indicate the radiation emitted
by the diode.
LED Circuit Symbol

LED Characteristics

LED Characteristics

The forward bias Voltage-Current (V-I) curve and the output characteristics curve is shown
in the figure above. The V-I curve is practically applicable in burglar alarms. Forward bias
of approximately 1 volt is needed to give significant forward current. The second figure is
used to represent a radiant power-forward current curve. The output power produced is very
small and thus the efficiency in electrical-to-radiant energy conversion is very less.

The figure below shows a series resistor Rseries connected to the LED. Once the forward bias
of the device exceeds, the current will increase at a greater rate in accordance to a small
increase in voltage. This shows that the forward resistance of the device is very low. This
shows the importance of using an external series current limiting resistor. Series resistance is
determined by the following equation.

Rseries = (Vsupply – V)/I

Vsupply – Supply Voltage

V – LED forward bias voltage

I – Current

LED Circuit

The commercially used LED’s have a typical voltage drop between 1.5 Volt to 2.5 Volt or
current between 10 to 50 milliamperes. The exact voltage drop depends on the LED current,
colour, tolerance, and so on.

LED as an Indicator
The circuit shown below is one of the main applications of LED. The circuit is designed by
wiring it in inverse parallel with a normal diode, to prevent the device from being reverse
biased. The value of the series resistance should be half, relative to that o f a DC circuit.

LED as an Indicator

LEDS displays are made to display numbers from segments. One such design is the seven-
segment display as shown below. Any desired numerals from 0-9 can be displayed by passing
current through the correct segments. To connect such segment a common anode or common
cathode cathode configuration can be used. Both the connections are shown below. The
LED’s are switched ON and OFF by using transistors.

Advantages of LED’s

 Very low voltage and current are enough to drive the LED.

 Voltage range – 1 to 2 volts.

 Current – 5 to 20 milliamperes.
 Total power output will be less than 150 milliwatts.

 The response time is very less – only about 10 nanoseconds.

 The device does not need any heating and warm up time.

 Miniature in size and hence light weight.

 Have a rugged construction and hence can withstand shock and vibrations.

 An LED has a life span of more than 20 years.

L293D Motor Driver IC


Submitted by RakeshRon on Fri, 08/16/2013 - 01:06

L293D Description
L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on
either direction. L293D is a 16-pin IC which can control a set of two DC motors
simultaneously in any direction. It means that you can control two DC motor with a single
L293D IC. Dual H-bridge Motor Driver integrated circuit (IC).

The l293d can drive small and quiet big motors as well, check the Voltage Specification at
the end of this page for more info.
You can Buy L293D IC in any electronic shop very easily and it costs around 70 Rupees
(INR) or around 1 $ Dollar (approx Cost) or even lesser cost. You can find the necessary pin
diagram, working, a circuit diagram, Logic description and Project as you read through.

Concept
It works on the concept of H-bridge. H-bridge is a circuit which allows the voltage to be
flown in either direction. As you know voltage need to change its direction for being able to
rotate the motor in clockwise or anticlockwise direction, Hence H-bridge IC are ideal for
driving a DC motor.

In a single l293d chip there two h-Bridge circuit inside the IC which can rotate two dc motor
independently. Due its size it is very much used in robotic application for controlling DC
motors. Given below is the pin diagram of a L293D motor controller.

There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive the motor, the pin
1 and 9 need to be high. For driving the motor with left H-bridge you need to enable pin 1 to
high. And for right H-Bridge you need to make the pin 9 to high. If anyone of the either pin1
or pin9 goes low then the motor in the corresponding section will suspend working. It’s like a
switch.

TIP: you can simply connect the pin16 VCC (5v) to pin 1 and pin 9 to make them high.

L293D Pin Diagram


 

 
 
 
 
 
 
 

Working of L293D
The there 4 input pins for this l293d, pin 2,7 on the left and pin 15 ,10 on the right as shown
on the pin diagram. Left input pins will regulate the rotation of motor connected across left
side and right input for motor on the right hand side. The motors are rotated on the basis of
the inputs provided across the input pins as LOGIC 0 or LOGIC 1.

In simple you need to provide Logic 0 or 1 across the input pins for rotating the motor.

L293D Logic Table.


Lets consider a Motor connected on left side output pins (pin 3,6). For rotating the motor in
clockwise direction the input pins has to be provided with Logic 1 and Logic 0.   

• Pin 2 = Logic 1 and Pin 7 = Logic 0 | Clockwise Direction


• Pin 2 = Logic 0 and Pin 7 = Logic 1 | Anticlockwise Direction
• Pin 2 = Logic 0 and Pin 7 = Logic 0 | Idle [No rotation] [Hi-Impedance state]
• Pin 2 = Logic 1 and Pin 7 = Logic 1 | Idle [No rotation]

In a very similar way the motor can also operated across input pin 15,10 for motor on the
right hand side.

Circuit Diagram For l293d motor driver IC controller.


 

 
 

Voltage Specification
VCC is the voltage that it needs for its own internal operation 5v; L293D will not use this
voltage for driving the motor. For driving the motors it has a separate provision to provide
motor supply VSS (V supply).  L293d will use this to drive the motor. It means if you want to
operate a motor at 9V then you need to provide a Supply of 9V across VSS Motor supply.

The maximum voltage for VSS motor supply is 36V. It can supply a max current of 600mA
per channel.Since it can drive motors Up to 36v hence you can drive pretty big motors with
this l293d.

VCC pin 16 is the voltage for its own internal Operation. The maximum voltage ranges from
5v and upto 36v.

TIP: Don’t Exceed the Vmax Voltage of 36 volts or it will cause damage.

DC Motor

 Electrical motors are everywhere

around us. Almost all the electro-mechanical movements we see around

us are caused either by an A.C. or a DC motor. Here we will be


exploring this kind of motors. This is a device that converts DC electrical

energy to a mechanical energy.

 Principle of DC Motor

 This DC or direct current motor works on the principal, when a current

carrying conductor is placed in a magnetic field, it experiences a torque

and has a tendency to move. This is known as motoring action. If the

direction of current in the wire is reversed, the direction of rotation also

reverses. When magnetic field and electric field interact they produce a

mechanical force, and based on that the working principle of dc motor


established. The direction of

rotation of a this motor is given by Fleming’s left hand rule, which states

that if the index finger, middle finger and thumb of your left hand are

extended mutually perpendicular to each other and if the index finger

represents the direction of magnetic field, middle finger indicates the

direction of current, then the thumb represents the direction in which

force is experienced by the shaft of the dc motor.

 Structurally and construction wise a direct current motor is exactly

similar to a DC generator, but electrically it is just the opposite. Here we

unlike a generator we supply electrical energy to the input port and derive

mechanical energy from the output port. We can represent it by the block

diagram shown below.



 Here in a DC motor, the supply voltage E and current I is given to the

electrical port or the input port and we derive the mechanical output i.e.

torque T and speed ω from the mechanical port or output port.

 The input and output port variables of the direct current motor are

related by the parameter K.


 So from the picture above we can well understand that motor is just the

opposite phenomena of a DC generator, and we can derive both motoring

and generating operation from the same machine by simply reversing the

ports.

 Detailed Description of a DC Motor

 To understand the DC motor in details lets consider the diagram below,


 The direct current motor is represented by the circle in the center, on

which is mounted the brushes, where we connect the external terminals,

from where supply voltage is given. On the mechanical terminal we have

a shaft coming out of the Motor, and connected to the armature, and the

armature-shaft is coupled to the mechanical load. On the supply terminals

we represent the armature resistance Ra in series. Now, let the input

voltage E, is applied across the brushes. Electric current which flows

through the rotor armature via brushes, in presence of the magnetic field,

produces a torque Tg . Due to this torque Tg the dc motor armature rotates.

As the armature conductors are carrying currents and the armature rotates

inside the stator magnetic field, it also produces an emf Eb in the manner

very similar to that of a generator. The generated Emf E b is directed

opposite to the supplied voltage and is known as the back Emf, as it

counters the forward voltage.

The back emf like in case of a generator is represented by

 Where, P = no of poles
 φ = flux per pole

 Z= No. of conductors

 A = No. of parallel paths

 and N is the speed of the DC Motor.

 So from the above equation we can see E b is proportional to speed ‘N’.

That is whenever a direct current motor rotates, it results in the generation

of back Emf. Now lets represent the rotor speed by ω in rad/sec. So E b is

proportional to ω.

 So when the speed of the motor is reduced by the application of load, Eb

decreases. Thus the voltage difference between supply voltage and back

emf increases that means E − Eb increases. Due to this increased voltage

difference, armature current will increase and therefore torque and hence
speed increases. Thus a DC Motor is capable of maintaining the same

speed under variable load.

 Now armature current Ia is represented by

 Now at starting,speed ω = 0 so at starting Eb = 0.

 Now since the armature winding electrical resistance Ra is small, this

motor has a very high starting current in the absence of back Emf. As a

result we need to use a starter for starting a DC Motor.

 Now as the motor continues to rotate, the back Emf starts being generated

and gradually the current decreases as the motor picks up spee


Dc power supply

 The most common and inexpensive plugpack power supply type you'll see is the chunky
transformer based plug. Whenever you buy some consumer electronics you'll be getting one
of these:

 These guys are everywhere - all sorts of voltage and current ratings. They're available
for sale at any store just about, but there are some big things to watch out for! One is
that the output voltage is not going to be 9V (for example) out of the box, that voltage
rating is just the minimum output for the current rating (200mA for example). And
also, the output is going to have a lot of ripple on it!
 Before we talk precisely about these guys, lets go back in time to when engineers had
to build their power supplies with their bare hands!

 The good old days!


 Back a couple decades ago, the only way to build a power supply was to start a big chunky
120VAC/12VAC transformer. The transformer was used to bring the high voltage from the
wall down to a less dangerous level. Then diodes and capacitors were used to turn the AC
into DC.

 Transformers


 We aren't going to get into the heavy detail of the electromagnetic theory behind
transformers except to say that they are made of two coils of wire around a chunk of iron. If
the number of coils are the same on both sides then the AC voltage is the same on both
sides. If one side has twice the coils, it has twice the voltage. They can be used 'backwards'
or 'forwards'! For more detailed information, be sure to check out the wikipedia page.

 To use it, one half would get wired up to the wall (the 'primary' 'high side')

 and the other half would output 12V AC (the 'secondary' 'low side'). The transformer
functioned in two ways: one it took the dangerous high voltage and transformed it to
a much safer low voltage, second itisolated the two sides. That made it even safer
because there was no way for the hot line to show up in your electronics and possibly
electrocute you.
 We'll use a schematic symbol to indicate a transformer, its two coils inside which are
drawn out, the schematic symbol will have the same number of coils on either side so
use common sense and any schematic indicators to help you out in figuring which is
primary and which is secondary!

 Half wave rectification


 Now that the voltage is at a non-electrocutey level of around 12VAC it can be converted into
DC. The easiest and cheapest way to convert (also called rectify) AC to DC is to use a single
diode. A diode is a simple electronic 'valve' - it only lets current flow one way. Since AC
voltage cycles from positive to negative and we only want positive, we can connect it up so
that the circuit only receives the positive halfof the AC cycle.

 You'll want to use a power diode such as a 1N4001 , they're extremely common and can put
up with a lot of abuse. The side with the silver stripe matches the schematic symbol side that
the 'arrow' in the diode symbol is pointing to. That's the only direction that current can flow.
The output is then chopped in half so that the voltage only goes positive.

 This will convert


 into

 What we have now isnt really AC and isn't really DC, its this lumpy wave. The good
news is that it's only positive voltage'd now, which means its safe to put a capacitor on
it.

 This is a 2200 microFarad (0.0022 Farad) capacitor, one leg has (-) signs next to it,
this is the negative side. The other side is positive, and there should never be a voltage
across is so that the negative pin is 'higher' than the positive pin or it'll go POOF!

 A capacitor smooths the voltage out, taking out the lumps, sort of how spring shocks in car
or mountain bike reduce the bumpiness of the road. Capacitors are great at this, but the big
capacitors that are good at this (electrolytic) can't stand negative voltages - they'll explode!

 Because the voltage is very uneven (big ripples), we need a really big electrolytic-type
capacitor. How big? Well, there's a lot of math behind it which you can read about but
the rough formula you'll want to keep in mind is:
 Ripple voltage = Current draw / ( (Ripple frequency) * (Capacitor size) )

 or written another way


 Capacitor size = Current draw / ( (Ripple frequency) * (Ripple Voltage) )

 For a half wave rectifier (single diode) the frequency is 60 Hz (or 50 Hz in europe).
The current draw is how much current your project is going to need, maximum. The
ripple voltage is how much rippling there will be in the output which you are willing
to live with and the capacitor size is in Farads.

 So lets say we have a current draw of 50 mA and a maximum ripple voltage of 10mV
we are willing to live with. For a half wave rectifier, the capacitor should be at least =
0.05 / (60 * 0.01) = 0.085 Farads = 85,000 uF! This is a massive and expensive
capacitor. For that reason, its rare to see ripple voltages as low as 10mV. Its more
common to see maybe 100mV of ripple and then some other technique to reduce the
ripple, such as a linear regulator chip.

 You don't have to memorize that formula, but you should keep the following in mind:
When the current goes up and the capacitor stays the same, the ripple goes up. If the
current goes up and you want the ripple the same, the capacitor must also increase.

 Full wave rectifiers


 One thing that can be done to reduce the ripple/capacitor size by half is to use a full wave
rectifier instead of a half wave. A full wave rectifier uses 4 diodes arranged in a peculiar way
so that it both lets the positive voltage through and manages to 'flip over' the negative
voltages into positive.

 So now we get:

 As you can see, there are twice as many humps - there isnt that "half the time, no voltage"
thing going on. This means we can divide the calculated capacitor size to half of what it was
in the previous.

 Basically, a full wave rectifier is way better than a half wave! So why even talk about half-
wave type rectifiers? Well, because they're useful for a few other purposes. In general,
you're unlikely to see an AC/DC converter that uses a half wave as the cost of the diodes
makes up for the saving in capacitor size and cost!

 The transformer AC/DC in practice



 OK now that we've reviewed transformers, diodes when used as rectifiers and big
capacitors, lets look at a chunky plugpack again. This time, we'll look inside by cutting it in
half! This power supply is rated at9VDC @ 200mA.

 We can pull it out completely to see the circuit board parts.

 Wow so this looks really familiar, right? From let to right, you can see the wires that
come into the transformer from the wall plug, the transformer output has two power
diodes on it and a big capacitor (2,200uF). You might be a little puzzled at
the two diodes - shouldn't there be four for a full-wave rectifier? It turns out that if
you have a special transformer made with a 'center tap' (a wire that goes to the center)
you can get away with using only two diodes . So it really is a full wave rectifier, just
one with a center-tap transformer.

 These transformer-based plug-packs are really cheap to make - like on the order of


under $1!

 Testing the 9V supply


 So now we will take a fresh power supply (don't use one you sawed in half, of course) and
measure the output voltage with a multimeter.


 Yow! 14V? That's not anything like the 9V on the package, is this a broken wall wart? No! Its
totally normal! Transformer-based wall adapters are not designed to have precision outputs.
For one thing, the transformer, if you remember, is made of coils of wire. The coils for the
most part act like inductors but they still have some small resistance. For example, if the coil
is 10 ohms of resistance, then 200 mA of current will cause V = I * R = (0.2 Amps) * (10
ohms) = 2 Volts to be lost just in the copper winding! Another thing that causes losses is the
metal core of the transformer becomes less efficient as the amount of current being
transformed increases. Altogether, there are many inefficiencies that will make the output
fluctuate. In general, the output can be as high as twice the 'rated' voltage when there is less
than 10mA of current being drawn.

 Let's look in detail


 Lets look on an oscilloscope, that way we can see in detail what is going on.

 With no current being drawn on the supply, the voltage output is about 14V

 When I connected a 100 ohm resistor (110 mA draw) from the positive pin to the negative
pin, it dropped to 11.2V

 Connecting a 60 ohm resistor (~160 mA draw), it goes down to 10.3V


The circuit uses a 0-14 volt 5 Ampere Step down transformer and a 10 Amps Bridge rectifier
module to convert AC to DC. Since pulsed DC is good for Lead Acid battery, a low value
smoothing capacitor is used as C1.To monitor the charging status, Ampere meter is provided
in the positive rail. LED act as the Charger on status.

Schematic of the Simple 12 Volt Battery Charger Circuit


car battery maintenance tips

When the output is connected to the battery terminals, the meter shows a higher reading
depending on the current flow into the battery. As the battery attains full charge, its terminal
voltage rises to 13.8 volts and current through the meter ceases. The meter reading then
returns to zero. This indicates the full charge state and the charging can be terminated.

You might also like