help required in driving Bipolar stepper using uC in Proteus

Discussion in 'General Electronics Chat' started by shohaib111, Nov 22, 2010.

  1. shohaib111

    Thread Starter New Member

    Aug 4, 2010
    11
    0
    hi to all,
    help required in driving Bipolar stepper using uC in Proteus only,
    i am assigned to drive a bipolar stepper motor in proteus simulator,
    after reviewing much literature, i got to the point of designing, but still no success, as motor is not turning, the logic is working right,(as it is tested in many ways) but motor is not turning.
    i am using transistors 2n2222, as it is part of assignment. and 2 switches as input to select turning on one of the 2 sides.
    Now, please review the attached image and guide me, What i m doing wrong??
    waiting for replies, please reply..............
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    1) Q1, Q3, Q5, and Q7 need to be PNP transistors. 2N2907 are generally considered to be complementary to type 2N2222.

    2) You need current limiting resistors on each transistor's base, or you will burn up either the transistor(s) or the uC driving the transistor(s); the latter being much more likely.

    3) If the motors' supply voltage is not the same as the uC's supply voltage, you will need to figure out how to translate the voltage levels for Q1, Q3, Q5, and Q7, or it will not function properly.

    4) You need to use clamping diodes on each side of each H-bridge, or when the transistors turn off, the inductance of the motors' windings will blast the transistors with high voltage, destroying them. Alternatively, you could use back-to-back Zener diodes rated for the supply voltage (or slightly higher) across each motor winding.
     
  3. shohaib111

    Thread Starter New Member

    Aug 4, 2010
    11
    0
    understood Points:2,4 completely..........
    but what about point 3, u said: 3) If the motors' supply voltage is not the same as the uC's supply voltage, you will need to figure out how to translate the voltage levels for Q1, Q3, Q5, and Q7, or it will not function properly.
    this means that the output voltage at the used pin, or the overall biasing voltage of uC with respect to Motor??
    and
    Point 1 says:
    1) Q1, Q3, Q5, and Q7 need to be PNP transistors. 2N2907 are generally considered to be complementary to type 2N2222.
    means Q1, Q3, Q5, and Q7 = PNP
    and Q2, Q4, Q6,Q8 = NPN??????????
    please reply
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you are using 5v to supply the uC, and 5v to supply the H-bridge, and they share a common ground, then you will not need to perform a level translation.

    If the motor's voltage supply is higher than the uC's supply, then you will need to translate the logic level to the higher voltage; you will need some additional circuitry.
    Yes.

    You will need to supply the bases of the transistors with 1/10th of the desired collector current.
    You have not said anything about your motors' current requirement. However, with your existing configuration, you will need 240 Ohm resistors between each transistors' base and the uCs' I/O pins, so that will give you a maximum of ~200mA drive to the motors. 20mA is about the maximum for source/sink out of a uCs' I/O pin.

    If you need more current in the H-bridge, you will need to supply more current to the bases. You might use transistors in an emitter follower configuration to source more base current.
     
    Last edited: Nov 22, 2010
  5. shohaib111

    Thread Starter New Member

    Aug 4, 2010
    11
    0
    Oh thanks boss!!!!!!!!!!
    that really helped me out........
    and my motor is working now,
    i have put resistor of 1k and tried to run , as u explained and it is working now...........
    1 more question,
    what thing should i take care, if i want to do it in practical?
    my motor is rated at 5V, 1.8 degree,(a small floppy drive motor)??
    just guide me, I'll do the rest, and if there is any problem, i'll contact you.........
    thanks once again..........
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Good. :)

    That does not make sense.
    Do you mean that you used 1k resistors between each transistors' base and the I/O pins?
    You would need to find the datasheet for the motor, and find out what its' rated current is. You would then need to calculate how much base current you need, and what resistors to use.

    Logic-level MOSFETs would allow you to control more current with your uC's I/O pins.

    Since you have not posted an updated schematic, it's rather difficult to know if you have completely understood and implemented the changes that I have suggested.
     
  7. shohaib111

    Thread Starter New Member

    Aug 4, 2010
    11
    0
    i also changed the way of stepping, which was my mistake, so which i didn't mention...

    here is now ,the updated schematic..........
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Either you did not update the schematic, or you simply did not understand what I wrote previously.

    1) Q1, Q3, Q5, Q7 need to be 2N2907 transistors.
    2) Each transistor (Q1-Q8) needs a 240 Ohm resistor between the base and the uC's I/O pin.
    3) You need reverse-EMF protection diodes on each end of each motor winding to power and ground, or just a pair of back-to-back 5.1v Zener diodes across each winding.
     
  9. shohaib111

    Thread Starter New Member

    Aug 4, 2010
    11
    0
    Sorry, i mistakenly uploaded the wrong old file....
    Can you please explain the reason, why do we use the PNP's??
    Can i not use both NPN's??
     
  10. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Since you have 4 unused lines on PORT1, You might want to consider driving all 8 transistors with their own dedicated control line from the 8951. That will add some additional complexity to your software but you will gain the ability to sequence the transistors in a more efficient manner. At present the commoning of the bases means that you cannot avoid turning on two of the transistors in the h-bridge at the same time. By seperately driving the bases and sequencing your drives properly using software you will avoid be able to avoid have two transistors on at the same time.

    Also I recommend you heed Sgtwookie's advice. He is trying to help you wring the best performance possible from your circuit.

    hgmjr
     
Loading...