Saturday, May 31, 2008

Driving stepper motor using TIP122

If your stepper motor has a high current rating then its better to use TIP120/TIP121/TIP122 for driving your stepper motor. (TIP122 is most commonly available in Ritchie street).
The TIP122 is silicon epitaxial-Base NPN power transistor in monolithic Darlington configuration mounted in TO-220 plastic package. It intended for use in power linear and switching applications.

About Darlington pair:

Darlington transistors or Darlington pair is two transistors connected together so that the current amplified by the first is amplified further by the second transistor. The overall current gain is equal to the two individual gains multiplied together.
A darlington pair behaves like a single transistor with a very hihg current gain. It has three leads (B,C and E) which is equivalent to the leads of a standard individual transistor. To turn on there must be 0.7V across both the base-emitter junctions which are connected in series inside the Darlington pair, therefore it requires 1.4V to turn on.

Circuit Description :

The driver circuit must withstand the voltage and current required by the stepper motor. The stepper motor which i used required 12volts and 1.5A to provide good torque, so i selected using TIP122. Driver for each wire include a TIP122, a 1k ohm resistor and a diode. The resistors are used for limiting the current and the diodes are used to avoid back EMF. The circuit is shown below,

The common terminal of both the winding are shorted and connected to motor supply. When logic 0 input is provided to the base of TIP122, the corresponding motor will remain floating as the impedance between collector and emitter of TIP122 is very high. So no current flows through that motor winding. When logic 1 input is provided to the base of the TIP122, its collector and emitter get shorted as a result the motor wire will be grounded resulting in current flow through the corresponding coil.

I used the PCB displayed above to drive two stepper motors. While driving the stepper motor having high current rating, large amount of heat will be generated hence to dissipate the generated heat you must use an Heat sink. Only by providing heat sink the TIP can drive maximum current.

Thursday, May 29, 2008

Driving stepper motor using ULN2003

The simplest way to drive stepper motor having lower current rating is using ULN2003. The ULN2003 contains seven darlington transistors. The ULN2003 can pass upto 500mA per channel and has an internal voltage drop of about 1V when on. It also contains internal clamp diodes to dissipate voltage spikes when driving inductive loads. The circuit for driving stepper motor using ULN2003 is shown below.

For higher current torque motors, you can use TIP120. The advantage is that the TIP120 can pass more current along with heat sink. The disadvantages are that the more wiring is required and four TIP120 is used to control the motor.

Wednesday, May 28, 2008

IC's and transistors used for driving stepper motor

The IC's and transistors which are used for driving stepper motor is as follows, the selection of the IC's or transistors is based on the current requirement of the stepper motor. For the stepper motor which requires low current less than 500mA ULN2003 could be used. For the stepper motor which requires high current greater than 500mA transistors like TIP120, TIP 121 and TIP122 can be used.
  • ULN2003 - used to drive stepper motor which has current rating less than 500mA. current rating can be improved by piggybacking two ULN2003.
  • TIP120, TIP121, TIP 122 - used to drive stepper motor which has higher current rating greater than 500mA. Diodes must be used to avoid back emf from affecting the control circuit. Heat sink is required for obtaining the maximum current. More economic and easy to use for driving stepper motors.
  • SLA7032M, SLA7033M - two phase stepper motor unipolar driver IC's which provides output current of about 1.5A and 3A.
  • SLA7070M, SLA7071M, SLA7072M and SLA7073M - motor driver IC's for unipolar devices which provides output current of 1A, 1.5A, 2A and 3A.
  • L297/A/D - stepper motor controller IC generates four phase drive signals for two phase bipolar and four phase unipolar stepper motors in microcomputer-controlled applications. The motor can be driven in Half step, normal and wave drive modes. The direction of rotation can also be switched.
  • SLA7024M, SLA7026M and SMA7029M - High-current PWM, Unipolar stepper motor controllers/drivers. They provide an output current of about 1.5A, 3.0A and 1.5A.
  • You can even use mosfet transistors and some other power transistors for driving the stepper motor.
  • Mostly i prefer using ULN2003 and TIP122 for driving the stepper motors because they are easily available in Ritchie street.

Sunday, May 25, 2008

Identifying the leads of Unipolar stepper motor

Unipolar stepper motors have four coils and either five, six or eight wires. No matter how many wires, unipolar stepper motors are interfaced in the same way. Five wires will go to the controller circuit. Four wires will be excited by pulses from the control circuit and the remaining wire(common) is given to the power supply. To identify the wires, you need a resistance meter.

First, identify the common lead. For the six and eight wire versions, some wires are twisted together to form the common lead and reduce the lead count to five. The common lead is connected to the positive of your battery or power supply.

  • Eight wire motors: Find the four pair of coils. These will be the wire pairs that have the coil resistance between them. There will be infinite resistance between pairs. One wire from each pair will be all joined together to form the common lead. Without a wiring diagram, you will have to do a lot of experimentation to determine which lead of the pair is for the common.
  • Six wire motors: Find the two wires whose resistance to two other wires reads the lowest of the measured resistances between wire pairs. Join these two wires together to form the common.
  • Five wire motors:Measure the resistance between all pairs of wires. One wire will read about one half the resistance to all other wires when compared to the resistance between other pairs. This wire is the common wire. No wires are joined in this case.

Now, proceed to identify individual coils in order of sequence.
  • Connect the common lead to the positive of your battery or power supply.
  • Connect any one of the other four leads to ground. This will be coil 4.
  • With coil4 still grounded, connect another lead to ground. If the shaft does not move, you have coil2. If the shaft rotates clockwise, you have coil3. If the shaft rotates counter-clockwise, you have coil1.
  • Repeat until you have identified all four coils.

Thursday, May 22, 2008

Identifying stepper motors

While buying a stepper motor you must note the following aspects

First, check for the number of wires coming out. If 5 or 6 or 8, that's good because you have a unipolar stepper. If 4, that's bad beacuse you have a bipolar stepper which requires two phase to drive. Confirm you have a stepper motor by turning the shaft. You should feel the little detents indicating each step. Most probably in ritchie street you will get unipolar motors with 5 or 6 wires.

Second, check the label on the side. The label will have the voltage and step size printed. Look for 12V steppers. If you have a 5V stepper, and it is large, the currents required will be large. Small 5V steppers are no problem to drive. If your stepper motor is new then it will have their voltage rating marked by its side, the problem arises when you are buying stepper motor in second sales. New stepper motor will cost about Rs.1500(for 1.8deg) whereas the second sales stepper motor with the same step angle would be just Rs.250.

Third, get out your digital ohmmeter (probably your multimeter) and start measuring the resistances between the leads. you will get different values depending on which pair of leads you measure. The lowest resistance you find is the coil resistance. Use I=V/R to compute the coil current. If 250mA or less, you are in good shape. Most stepper motors in Ritche street will have very low coil resistance and requires current above 1A.

Fourth, look at the output shaft and determine if it is something you can handle. Check whether the shaft has suitable height so you can use it. Common steppers have plain shafts with 0.125, 0.196 or 0.250 diameter. Gears press fit onto the shaft may be useful to you or can be removed. Don't try to remove the gears by yourself, you will damage the shaft if you try to remove it by yourself. Lathe with chuck must be used to remove the gears to avoid damage to the shaft.

very large or very heavy steppers will mostly require more current than you can control.

Tuesday, May 20, 2008

Where to find stepper motors

Stepper motors can be found in almost any piece of electro-mechanical equipment. It can be pulled from old electronic equipment such as floppy drives, dot-matrix printers. Most of the stepper motors in Ritchie street is pulled from printers and the most common step angle you could find is 1.8deg and 7.5deg which is of permanent magnet type. Look for "unipolar" or "4-coil" or "4-phase" motor (they all mean the same thing) with 5 or 6 or 8 wires. Avoid "bipolar" motors because they require an entirely different control scheme. The require two phases to control them and have four wires.

Operating voltage of 12V is convenient for robotics projects. Look for motors with a coil current of 250mA or less (coil resistance of 48ohms or more for a 12V motor <-> V=IR). Higher currents do give higher torque, but will also drain your battery faster. Another key specification is the holding torque which is how much torque the motor can resist when energized.

Sunday, May 18, 2008

stepper motor - introduction

A stepper motor is a electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. Stepper motors enable precise positioning without needing sensors to measure motor position.


  • The rotation angle of the motor is proportional to the input pulse.
  • The motor has full torque at standstill(if the winding are energized).
  • Precise positioning and repeatability of movement since good stepper motors have an accuracy of 3-5% of a step and this error is non cumulative from one step to the next.
  • Excellent response to starting/stopping/reversing.
  • Very reliable since there are no contact brushes in the motor. Therefore the life of the motor is simply dependent on the life of the bearing.
  • The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control.
  • It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft.
  • A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input pulses.


  • Resonances can occur if not properly controlled.
  • Not easy to operate at extremely high speeds.
  • More complex to control than DC motors.
  • Consume precious battery current even when not moving.

Tuesday, May 13, 2008

Shops in ritchie street

Hi guys new to Ritchie street ?
don't worry i will guide you to some shops in Ritchie street

--> Modi Electronics - #6, Ritchie street, 1st floor, chennai - 600 002.
Ph - 91-44-2841 4140.
Best shop to buy DC gear motors, stepper motors and LEGO kits, they also sell many projects which you must assemble yourself.
--> Shri Gemini Kits and Spares - #22, Athipattan st, Mount Road,
ch - 600 002. Ph - 2841 8592.
Here you can get projects which is already assembled. It will be like a project center, their is a person named Rajamanikam who will guide you there, he will also give good ideas, classes are also conducted here during weekends for programming AT89C51 using Embedded C (you have to pay for it).
--> Omega Electronics - Best place to buy the components for your project such as resistors, capacitors, PCB's, LED's, IC's, diodes, relays, switches, LDR's, transformers, soldering lead etc. ( there are two shops named omega, one near globe electronics in the main road and other inside the entrance of the building, the main shop will be crowded all the times so you can get your components in the second shop)
--> Texonic - Best place to buy PIC microcontrollers, if you are buying components in a large scale its the best place. PIC Programmer is sold here. Its like an wholesale shop. you can buy the components but the minimum amount for billing is Rs.50 and you should also buy the components in large scale you cannot buy one or two IC's here except PIC.
--> Kailash Electronics - similar to omega electronics where you can get all your electronic components.
-->Their is a shop near Shri gemini kits and spares where you can design your PCB i can't remember the shop name
--> Hertz systems (Allegro systems) - No:109/7, Vanavil apartments, East main road, anna nagar west extn, chennai-600 101. Ph - 43538861, 26150019. (Near SBIOA school)
PIC16F877A and PIC18F452 development board is sold here. Classes are taken for programming PIC with CCS C compiler for Rs.4000(when i attended, not sure about the amount now). The classes will be very much useful to you guys for doing you final year project. A person named Murali is incharge of Hertz systems, he will also give ideas for your project.
--> For those who are residing near tambaram you can get most of the electronic components in Mercy Electronics (near national theatre)

Friday, May 9, 2008

Features of PIC16F877A

I started with PIC16F877A demo board for my projects. let us now see the features of PIC16F877A, the following image shows my PIC16F877A demo board.

PIC16F877A demo board

Features of PIC16F877A
  • High-performance RISC CPU
    • Lead-free:RoHS-compliant
    • Operating speed:20Mhz, 200ns instruction cycle
    • Operating voltage:4.0-5.5volts
    • Industrial temperature range(-40 to +85 degrees)
    • 15 Interrupt sources
    • 35 single word instructions
    • All single-cycle instructions except for program branches
  • Special Microcontroller Features
    • Flash memory:14.3KB(8192 words)
    • Data SRAM:368 bytes
    • Data EEPROM:256 bytes
    • Self-reprogrammable under software control
    • In-circuit serial programming via two pins
    • Watchdog timer with on-chip RC oscillator
    • Programmable code protection
    • Power-saving code protection
    • Selectable oscillator options
    • In-circuit debug via two pins
  • Peripheral Features
    • 33 I/O pins : 5 I/O ports
    • Timer0:8-bit timer/counter with 8-bit prescaler
    • Timer1:16-bit timer/counter with prescaler
    • Timer2:8-bit timer/counter with 8-bit period register, prescaler and postscaler
    • Two capture, compare, PWM modules
    • Synchronous serial port with two modes
    • USART/SCI with 9-bit address detection
    • Parrallel slave port
    • Brown-out detection circuitry for brown-out reset
  • Analog Features
    • 10-bit, 8-channel A/D converter
    • Brown-out reset
    • Analog comparable module
whats the difference between PIC16F877 and PIC16F877A ?

I got two answers for this question from my friends which i want to share with you
- The masking is different in both the microcontrollers
- While burning the code in PIC microcontroller their is an acknowledgement received for each code word written in PIC's memory. In case of PIC16F877 the code word is written one by one and hence their is an acknowledgement required for each code word written and hence the speed of writing is reduced. Whereas in case of PIC16F877A the code word is written in blocks and hence acknowledgement is required only for the block of code word and hence speed of writing is more when compared to that of PIC16F877A.

Monday, May 5, 2008

PIC microcontroller architecture

Let us see about the architecture categories in PIC microcontroller

Microchips 8 bit PIC microcontrollers fall into three product architecture categories providing a variety of option for any application requirement
  • Baseline 8 bit architecture - 12 bit program word
  • Midrange 8 bit architecture - 14 bit program word
  • High performance 8 bit architecture - 16 bit program word
  1. Baseline Architecture - The baseline architecture includes the PIC10F family and portion of the PIC12 and PIC16 families. These devices utilize 12 bit program word architecture with 6 to 28-pin package options. The concisely defined feature set of baseline architecture enables the most cost-effective product solutions. This architecture is ideal for battery operated applications. The PIC10F200 series provides another industry first, an inexpensive 8 bit flash microcontroller in a six pin package.
  2. Midrange Architecture - The midrange architecture includes members of the PIC12 and PIC16 framilies that feature 14-bit program word architecture. These families are available with 8 to 64 package options. The midrange PIC16 devices offer a wide range of package options, as well as low to high levels of peripheral integration. This PIC16 device features various serial, analog and digital peripherals, such as USB, SPI, I2C, USART, LCD and A/D converters. The mid-range PIC16 microcontrollers have interrupt handling capability with an 8 level hardware stack.
  3. Highperformance Architecture - The high performance architecture encompassed the PIC18 family of devices. These microcontrollers utilize 16 bit program word architecture with 18 to 100 pin package options. The PIC18 devices are high jperformance microcontrollers with integrated A/D converters. All PIC18 microcontrollers incorporate an advanced RISC architecture that supports flash devices. The PIC18 has enhanced core features, 32 level deep stack and multiple internal and external interrupts.

Thursday, May 1, 2008

Features of PIC microcontroller

New to PIC ??

Let us see the dynamic features of PIC which has made it a better choice than other microcontrollers

Features of PIC microcontroller

1.code efficiency - The PIC 8 bit microcontroller is based on Harvard architecture, which means there are separate internal buses for memory and data. The throughput rate is therefore increased due to simultaneous access to both data and program memory. It would be easier if you have known about von neumann architecture which has common bus for memory and data. - All the instructions fit into a 12 or 14 bit program memory word. There is no likelihood of software jumping onto the DATA section of a program and trying to execute DATA as instructions.
3.Instruction set - There are 33 instructions you have to learn in order to write software for the 16C5x family. The lesser number of instruction eases our job while writing program in assembly language.
4.Speed - The PIC has an internal divide by 4 connected between the oscillator and the internal clock bus(note : we know their is a divide by 2 in a 8085 microprocessor where we connect a 6Mhz clock inorder to operate the microprocessor at a speed of 3Mhz). The PIC is very fast to work with. The speed of PIC16F877A is 20Mhz but it can even operate at a speed of 30Mhz. some PIC in 18Fx family can be operated at 40Mhz.
5.Static Operation - The PIC is a fully static microcontroller, in other words, if you top the clock, all the register contents are maintained. In practise you would not actually do this, you would place the PIC into a Sleep mode-this stops the lock and sets up various flags within th ePIC to allow you to know what state it was in before the Sleep. In sleep, the PIC takes only its standby current which can be less than 1uA. The need for sleep mode can be easily understood by considering the Fire alarm circuit, since the circuit has to be activated only when their is a fire, the rest of the time the PIC can be made to be in its sleep mode and wake up when their is fire thus saving the power required for the operation of PIC.
6.Drive Capability - The PIC has a high output drive capability and can directly drive LEDs and TRIACs etc. Any I/O pin can sink 25mA or 100mA for the whole device.
7.Options - A range of speed, temperature, package, I/O lines, timer functions, serial communication, A/D and memory sizes is available from the PIC family to suit virtually all your requirements.

PIC microcontroller can be programmed using embedded C. some of the compilers which i have used are mikroC, CCS C compiler and Mplab. It is easier to program in embedded C rather than programming in assembly language. The demo version of these compilers can compile upto 2KB of program memory.