Shop OBEX P1 Docs P2 Docs Learn Events
troubles with a BSII and the L293D motor driver — Parallax Forums

troubles with a BSII and the L293D motor driver

ArchiverArchiver Posts: 46,084
edited 2000-06-19 15:43 in General Discussion
Hi group-
I'm at the end of my frustration tolerance with this problem. My BSII is on a
carrier board, powered by a single 9V battery. Here's the situation:
- I have the Vs(Supply) and Vss(logic supply)pins of the L293D connected to the
right side Vdd(+5) pin on the carrier board. One GND pin on the L293D is
connected to the carrier board Vss pin.
- Enable 1 is connected to pin 7 on the stamp.
- Input 1 is connected to ground, Input 2 to +5.
- Output 1 and 2 are connected to wires on a DC motor.
- A 33K resistor goes from enable to ground.

The first problem I had was that the enable pin had to be connected to ground to
stop the motor; without it, the pin would float, and the motor would run
continuously. An EE I know suggested I connect a high value resistor to ground,
and that seems to work. When I connect a wire from +5V to the Enable 1 pin, the
motor turns, when I remove it, it shuts off, so I know that when voltage is
applied, the motor SHOULD turn. To test that my program is actually putting out
a high voltage, I tested it with a 470ohm resistor connected to a LED, connected
to ground, and it worked properly. The problem I am asking you all about
happens when I run this program:

debug "wassup", bell, cr
dirs = 0
pause 2000
low 7
debug "turned 7 low", cr
pause 2000
debug "will it turn on?", cr
high 7
pause 2000
debug "off now"
dirs = 0
end

When run, first a bell chimes and the prog spits out "wassup" on the debug
screen. It pauses, writes "turned 7 low", pauses, then says, "will it turn
on"... and immediately resets. I hear the bell, and the same stuff I just
mentioned. This process continues indefinitely. All the while, the motor never
turns on at all.
If I remove the pin7 connection from the EN 1 pin and run the program, no reset
occurs. When run with a led, it turns on after "will it turn on?" and seems to
run normally.
I've even replaced the chip with another one and the same thing happens.


Surely someone in this group has had some experience and success with getting
the L293D motor driver chip to work. I'd really appreciate any help I can get.

Thanks,
Brandon Heller
northstarb@a...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-06-19 05:46
    Brandon:

    I think you have 2 problems with your setup:

    1) Why do you set dirs=0? This sets all the Stamp pins to high impedance
    inputs, which leaves the enable pin floating until the LOW command sets pin
    7 to output. You could use dirs=$0080 to make the pin7 output and the
    remaining pins inputs. But just using dirs=$FFFF will work, and makes all
    pins outputs. You only need the statement once at the beginning of the
    program.

    2) Most motors cannot be run from a small 9V battery. The motor drain is
    probably sucking down the supply voltage, which resets the Stamp. Connect
    the L293 Vcc2 (pin 8) to an independent power supply. You can use "D"
    batteries in series, or a 6 volt lantern battery if you don't have a power
    supply. Don't forget to connect the external power supply negative to the
    ground on the Stamp board.

    Good luck,
    Ray McArthur

    > I'm at the end of my frustration tolerance with this problem. My BSII
    is on a carrier board, powered by a single 9V battery. Here's the
    situation:
    > - I have the Vs(Supply) and Vss(logic supply)pins of the L293D connected
    to the right side Vdd(+5) pin on the carrier board. One GND pin on the
    L293D is connected to the carrier board Vss pin.
    > - Enable 1 is connected to pin 7 on the stamp.
    > - Input 1 is connected to ground, Input 2 to +5.
    > - Output 1 and 2 are connected to wires on a DC motor.
    > - A 33K resistor goes from enable to ground.
    >
    > The first problem I had was that the enable pin had to be connected to
    ground to stop the motor; without it, the pin would float, and the motor
    would run continuously. An EE I know suggested I connect a high value
    resistor to ground, and that seems to work. When I connect a wire from +5V
    to the Enable 1 pin, the motor turns, when I remove it, it shuts off, so I
    know that when voltage is applied, the motor SHOULD turn. To test that my
    program is actually putting out a high voltage, I tested it with a 470ohm
    resistor connected to a LED, connected to ground, and it worked properly.
    The problem I am asking you all about happens when I run this program:
    >
    > debug "wassup", bell, cr
    > dirs = 0
    > pause 2000
    > low 7
    > debug "turned 7 low", cr
    > pause 2000
    > debug "will it turn on?", cr
    > high 7
    > pause 2000
    > debug "off now"
    > dirs = 0
    > end
    >
    > When run, first a bell chimes and the prog spits out "wassup" on the debug
    screen. It pauses, writes "turned 7 low", pauses, then says, "will it turn
    on"... and immediately resets. I hear the bell, and the same stuff I just
    mentioned. This process continues indefinitely. All the while, the motor
    never turns on at all.
    > If I remove the pin7 connection from the EN 1 pin and run the program, no
    reset occurs. When run with a led, it turns on after "will it turn on?" and
    seems to run normally.
    > I've even replaced the chip with another one and the same thing happens.
    >
    > Surely someone in this group has had some experience and success with
    getting the L293D motor driver chip to work. I'd really appreciate any help
    I can get.
    >
    > Thanks,
    > Brandon Heller
    > northstarb@a...
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-19 08:18
    Your results are typical.

    Use separate power supplies for the motor and the BSII. Couple the
    motor drive commands via a proper isolation like open collector
    transistor drive or opto isolators.

    Never power a motor from the same supply as the BSII derives power.
    The initial current load will drop out the BSII and reset it. The 9
    volt does not have the current capacity to drive a motor, period.

    Separate them and you should have better results.

    Remember you just found out what did not work. So try something
    different. If you have a scope you will be able to watch for the
    effects on the power supply.

    Ron

    Original Message
    From: <northstarb@a...>
    To: <basicstamps@egroups.com>
    Sent: Sunday, June 18, 2000 9:52 PM
    Subject: [noparse][[/noparse]basicstamps] troubles with a BSII and the L293D motor driver


    > Hi group-
    > I'm at the end of my frustration tolerance with this problem. My
    BSII is on a carrier board, powered by a single 9V battery. Here's
    the situation:
    > - I have the Vs(Supply) and Vss(logic supply)pins of the L293D
    connected to the right side Vdd(+5) pin on the carrier board. One GND
    pin on the L293D is connected to the carrier board Vss pin.
    > - Enable 1 is connected to pin 7 on the stamp.
    > - Input 1 is connected to ground, Input 2 to +5.
    > - Output 1 and 2 are connected to wires on a DC motor.
    > - A 33K resistor goes from enable to ground.
    >
    > The first problem I had was that the enable pin had to be connected
    to ground to stop the motor; without it, the pin would float, and the
    motor would run continuously. An EE I know suggested I connect a high
    value resistor to ground, and that seems to work. When I connect a
    wire from +5V to the Enable 1 pin, the motor turns, when I remove it,
    it shuts off, so I know that when voltage is applied, the motor SHOULD
    turn. To test that my program is actually putting out a high voltage,
    I tested it with a 470ohm resistor connected to a LED, connected to
    ground, and it worked properly. The problem I am asking you all about
    happens when I run this program:
    >
    > debug "wassup", bell, cr
    > dirs = 0
    > pause 2000
    > low 7
    > debug "turned 7 low", cr
    > pause 2000
    > debug "will it turn on?", cr
    > high 7
    > pause 2000
    > debug "off now"
    > dirs = 0
    > end
    >
    > When run, first a bell chimes and the prog spits out "wassup" on the
    debug screen. It pauses, writes "turned 7 low", pauses, then says,
    "will it turn on"... and immediately resets. I hear the bell, and the
    same stuff I just mentioned. This process continues indefinitely.
    All the while, the motor never turns on at all.
    > If I remove the pin7 connection from the EN 1 pin and run the
    program, no reset occurs. When run with a led, it turns on after
    "will it turn on?" and seems to run normally.
    > I've even replaced the chip with another one and the same thing
    happens.
    >
    > Surely someone in this group has had some experience and success
    with getting the L293D motor driver chip to work. I'd really
    appreciate any help I can get.
    >
    > Thanks,
    > Brandon Heller
    > northstarb@a...
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-06-19 15:43
    <snip>

    > When run, first a bell chimes and the prog spits out "wassup" on the debug
    > screen. It pauses, writes "turned 7 low", pauses, then says, "will it
    > turn on"... and immediately resets.

    <snip>

    I haven't closely inspected your code, but it would seem that your
    most pressing problem is that the BS2 is resetting. This is usually
    because you are drawing too much current and the Stamp's on-
    board brown-out detector is resetting.

    For starters, be sure you have nothing connected to the Stamp's
    regulator (Pin 21) -you should certainly not try to power the L293 or
    any motors with this supply. What is happenign is that when the
    motor goes to turn on, it draws so much current that the voltage
    briefly dips below the threshold of the Stamp's brown-out detector
    and the circuit resets and the motor shuts-off. If you can supply
    enough current, the voltage will not dip.

    Check the power supply that you're using. Is it rated for sufficient
    current for your project ? Have you got a decently-sized electrolytic
    cap on the output (say, 1000 uF, 15V) ? If you do, then you
    shouldn't be having any troubles.


    Mark Hillier, VE6HVW
    President, HVW Technologies Inc.
    Canadian Distributors of Parallax Products and other Neat Stuff
    Tel: +403-730-8603 Fax: +403-730-8903
    http://www.hvwtech.com
Sign In or Register to comment.