Maker Pro
Maker Pro

Help needed for simple robot control circuit

P

PeterMacKenzie

Jan 1, 1970
0
I'm working on the circutry for a fairly simple robot, and I think I've
figured out most of it, but there's one bit that I can't figure out how
to impliment. I've made a .gif of the circuit plan below with the area
I'm having problems with marked off (sorry for it being a bit crappy; I
was using openoffice draw, which isn't great for circuits).

http://i5.photobucket.com/albums/y165/PeterMackenzie/Robot0002.gif

The issue is that I need to (I think) be able to use a signal from an
OR gate to switch between ground and vcc to select between only NPN
transistors passing current and only PNP transistors passing current.
I'm stumped at how to impliment a 2-way switch without resorting to a
relay (I don't have a relay, it would consume more power than I'd be
happy with and I'm sure there's a solution without one).

Also, I'd be grateful if anyone could look over the circuit and point
out any other problems with it; I pretty much doubled my understanding
of transistors (and burned out a few LED's) while designing it (the
book said the base passed a *little* current, nothing about it only
doing that with a big resistor in the way) and I'm pretty fuzzy when it
comes to logic components, so there's probably something glaring wrong
with it that I haven't noticed. There's no resistors drawn in yet, but
there will be when it's finished, in case you're wondering if that's
one of the glaring errors.

--------------------------
Overview of robot:

The robot is to have 2 motors with wheels for locomotion and 2 feelers
which detect collisions with objects and either cut power to one motor
and reverse the other to turn the robot away from the object if only
one feeler is affected, or reverse both motors to back up the robot if
both feelers are affected together.

Overview of circuit:

The feelers are functionally push-to-make switches. They quickly
charge a capacitor when closed and send a signal to the motor-control
part of the
circuit. After the push-to-make switches open again,
the capacitor discharges, thus maintaining the signal for an arbitrary
duration (1-3 seconds probably would be most desirable).

In the motor-control section, this signal has three destinations. The
first is a transistor which opens the connection for the motor nearest
that feeler to vcc, turning it off.

The second is an OR gate which is connected to both feeler units.
When either unit gives a signal, the gate switches between grounding
or supplying vcc (via a mechanism I haven't figured out yet) to an
array of 4 transistors, 2 being PNP, 2 being
NPN, the function of which is to reroute the direction of current in
the opposite direction through the motors. When vcc is connected, the
NPN transistors are active (and the PNP inactive) and current
direction is normal, but when ground is connected, the PNP transistors
are active (and NPN inactive) and the direction of current is
reversed.

The third destination is an AND gate, which is likewise connected to
both feeler units. If it's active, it overrides the transistor in the
first step by providing an alternative route through a secondary
transistor for each motor to keep them active (though also in reverse,
since the direction of current has been reversed in step 2).
 
D

Don Bruder

Jan 1, 1970
0
PeterMacKenzie said:
I'm working on the circutry for a fairly simple robot, and I think I've
figured out most of it, but there's one bit that I can't figure out how
to impliment. I've made a .gif of the circuit plan below with the area
I'm having problems with marked off (sorry for it being a bit crappy; I
was using openoffice draw, which isn't great for circuits).

http://i5.photobucket.com/albums/y165/PeterMackenzie/Robot0002.gif

The issue is that I need to (I think) be able to use a signal from an
OR gate to switch between ground and vcc to select between only NPN
transistors passing current and only PNP transistors passing current.
I'm stumped at how to impliment a 2-way switch without resorting to a
relay

<snip>

The "magic word" you're looking for is "H-Bridge".

I didn't get any further than this point before hitting "reply", but
with the context so far, I'm betting you're looking to have one or more
DC motors spinning one way when the output of the OR gate is true, and
"the other way" when the output is false?

<finishes reading>

Sure enough, that's EXACTLY what you're looking for - An H-Bridge
(Google for it) will do what you're needing.
 
R

Rich Webb

Jan 1, 1970
0
I'm working on the circutry for a fairly simple robot, and I think I've
figured out most of it, but there's one bit that I can't figure out how
to impliment. I've made a .gif of the circuit plan below with the area
I'm having problems with marked off (sorry for it being a bit crappy; I
was using openoffice draw, which isn't great for circuits).

Go get the gEDA package. The schematic capture app, gschem, works great.
http://www.geda.seul.org/


The easiest solution is probably to drop in a dedicated H-bridge chip,
unless you're really interested in doing a roll-yer-own effort.

http://www.mcmanis.com/chuck/robotics/tutorial/h-bridge/ has a good
tutorial on discrete BJT H-bridges, if you're going that way.

For off the shelf, look at http://www.allegromicro.com/ or perhaps the
SN754410 from TI http://www-s.ti.com/sc/psheets/slrs007b/slrs007b.pdf
 
B

Bob Monsen

Jan 1, 1970
0
On Sun, 04 Dec 2005 08:08:21 -0800, PeterMacKenzie wrote:
<robot woes>

There are specialized chips to deal with this problem. If you aren't
making robosaurus, a TI SN754410 is probably what you want. For bigger
projects, you can use discrete transistors; if you go this way, don't use
BJTs, use MOSFETS, since the drive required for motors will be easier to
deal with by logic gates.

If you look around at the various distributors, the prices for these
things vary wildly, so I'd shop around.

---
Regards,
Bob Monsen

God ever arithmetizes.
- Gustav Jacob Jacobi
 
P

PeterMacKenzie

Jan 1, 1970
0
Thanks for the replies, but they haven't really resolved the problem.
I hadn't heard of an H-bridge before, and I read through the tutorial
from http://www.mcmanis.com/chuck/robotics/tutorial/h-bridge/ that
Rich Webb linked to, but if you check the schematic in the .gif,
you'll see that I'd already designed a rudimentary H-bridge (it may
not look terribly familiar since it controls 2 motors instead of 1,
lacks protection diodes, has the motors external to the 4-transistor
ring and doesn't have any resistors drawn in, but it seems to me to be
the essence of what an H-bridge should be).

In the linked tutorial, the H-bridge is controlled by a Basic Stamp II
microcontroller and, according to the tutorial; "This works because
the processor pins become a connection to ground when they are
outputting a logic 0. ". With my circuit though, a logic component as
far as I know would never be able to supply a connection to ground as
logic 0, logic 0 would merely be an absence of current, an open
connection, not a path to ground. I'm fairly confident that I could
get my custom H-bridge to work, with some modifications (the linked
tutorial was very useful, and I was able to calculate that I'll need
at least 4 of my little TO-92, 200mW transistors in parallel for each
of the '4' transistors in the H-bridge to handle the 500mA or so that
each motor will draw (200/0.7=286mA per small 200mW transistor), but
I'd rather stick with BJT's for now, since I want to get a feel for
the lowest level logic involved, there's something more satisfying
about it to me and I have 200 of them to use up.

While I was typing this though, I think I figured out how to do what I
wanted. Using 2 NPNs, 1 PNP and a couple of high-value resistors, I
designed the switch I was after so that I could switch between +5Vcc
and ground rather than just +5Vcc and 0V. It's 04:28 here, so my
brain's kind of fried and I could just be imagining I've solved it by
now, but if it still makes sense to me in the morning, I'll make
another .gif of it and post it here. It looked pretty obvious once
I'd done it, so hopefully that's a good sign.

Thanks to Rich Webb again for the link to gEDA, the electronics design
package. Unfortunately I'm just learning to use linux at the moment,
and haven't yet figured out how to compile packages from source (which
I'd need to do since I run mandrake 10.0). I'll keep it in mind for
when know how to install it.
 
J

Jasen Betts

Jan 1, 1970
0
Also, I'd be grateful if anyone could look over the circuit and point
out any other problems with it; I pretty much doubled my understanding
of transistors (and burned out a few LED's) while designing it (the
book said the base passed a *little* current, nothing about it only
doing that with a big resistor in the way) and I'm pretty fuzzy when it
comes to logic components, so there's probably something glaring wrong
with it that I haven't noticed. There's no resistors drawn in yet, but
there will be when it's finished, in case you're wondering if that's
one of the glaring errors.

it's not immediately obvious which transistors are PNP and which NPN
(possibly due to the image resolution)

anyway it appears that you are switching the supply to the transistors that
switch the motors on or off.

this is most unusual - and I'm not sure that it will work.

google for "H-bridge" and use one to drive each motor.

I think the device your original question was searchiing for is an inverter,
(or "not" gate) these convert a "high" input to a "low" output and vice-versa.

Bye.
Jasen
 
J

Jasen Betts

Jan 1, 1970
0
Thanks for the replies, but they haven't really resolved the problem.
I hadn't heard of an H-bridge before, and I read through the tutorial
from http://www.mcmanis.com/chuck/robotics/tutorial/h-bridge/ that
Rich Webb linked to, but if you check the schematic in the .gif,
you'll see that I'd already designed a rudimentary H-bridge (it may
not look terribly familiar since it controls 2 motors instead of 1,
lacks protection diodes, has the motors external to the 4-transistor
ring and doesn't have any resistors drawn in, but it seems to me to be
the essence of what an H-bridge should be).

yeah, I noticed that...
In the linked tutorial, the H-bridge is controlled by a Basic Stamp II
microcontroller and, according to the tutorial; "This works because
the processor pins become a connection to ground when they are
outputting a logic 0. ". With my circuit though, a logic component as
far as I know would never be able to supply a connection to ground as
logic 0, logic 0 would merely be an absence of current, an open
connection, not a path to ground.

it depends on which logic family your and and or-gates are from,
most will pproduce a pertty good path to ground when in the low state
(the exception being PMOS which isn't real common)
I'm fairly confident that I could get my custom H-bridge to work,
with some modifications

you probably could, the bit with two transistors from the motor to the
h-bridge output looks unusual... but it may work...
(the linked
tutorial was very useful, and I was able to calculate that I'll need
at least 4 of my little TO-92, 200mW transistors in parallel for each
of the '4' transistors in the H-bridge to handle the 500mA or so that
each motor will draw (200/0.7=286mA per small 200mW transistor), but
I'd rather stick with BJT's for now, since I want to get a feel for
the lowest level logic involved, there's something more satisfying
about it to me and I have 200 of them to use up.

you should probably get some larger transistors instead of paralling them.
junction devices don't always balance well, and with your low voltage
supply adding series resistors to balance them could may wast too much of
the voltage.

also using 8 500Mw transistors you could build two h-bridges.
While I was typing this though, I think I figured out how to do what I
wanted. Using 2 NPNs, 1 PNP and a couple of high-value resistors, I
designed the switch I was after so that I could switch between +5Vcc
and ground rather than just +5Vcc and 0V.


oh... that's what you wanted, .


many chips come wired that way, it's called a totem-pole output


in TTL chips it's implemented something like this:

totem-pole output stage (from memory)

-----+---------+----- +5
| |
| 50R
5K |
| /
| |/
|------|
| |\|
in / ~\
|/ |
--| +----- out
|\| |
~\ |
| /
| |/
`------|
|\|
~\
|
---------------+------ 0V


Bye.
Jasen
 
P

PeterMacKenzie

Jan 1, 1970
0
Here's a .gif of the H-bridge that was embedded in my circuit; I
stripped off everything around it to simplify it and rearranged it a
bit to make it look more like a traditional H-bridge, plus enlarged it
so it's obvious which transistors are NPN and which are PNP.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/H-bridgesimplified.gif

I also drew the transistor swich I came up with, modified somewhat
since it's conception last night/this morning.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/Vcc_Groundswitch.gif

Jasen: "I think the device your original question was searchiing for is
an inverter,
(or "not" gate) these convert a "high" input to a "low" output and
vice-versa."

It took me a while, but I finally figured out how I could use
inverters. I'd been confused with combining inverters with an NPN/PNP
mix, but once I considered just inverters and NPNs the solution was
obvious, and is presented (in simplified form) in the next .gif. It's
simpler than the solution I developed for the NPN/PNP H-bridge, so I'll
be using the inverter solution instead, but it's nice I at least got a
+Vcc/ground switch out of my confusion.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/h-bridgesimplified_inverters.gif

Thanks to everyone for their help.
 
B

Bob Monsen

Jan 1, 1970
0
Here's a .gif of the H-bridge that was embedded in my circuit; I
stripped off everything around it to simplify it and rearranged it a
bit to make it look more like a traditional H-bridge, plus enlarged it
so it's obvious which transistors are NPN and which are PNP.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/H-bridgesimplified.gif

I also drew the transistor swich I came up with, modified somewhat
since it's conception last night/this morning.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/Vcc_Groundswitch.gif

Jasen: "I think the device your original question was searchiing for is
an inverter,
(or "not" gate) these convert a "high" input to a "low" output and
vice-versa."

It took me a while, but I finally figured out how I could use
inverters. I'd been confused with combining inverters with an NPN/PNP
mix, but once I considered just inverters and NPNs the solution was
obvious, and is presented (in simplified form) in the next .gif. It's
simpler than the solution I developed for the NPN/PNP H-bridge, so I'll
be using the inverter solution instead, but it's nice I at least got a
+Vcc/ground switch out of my confusion.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/h-bridgesimplified_inverters.gif

Thanks to everyone for their help.

There are various subtle issues with regards to H-Bridges. For example,
having a short delay between turning one side off and turning the other
side on is good, because otherwise you will have a huge current zoom
through the two momentarily connected transistors.

Also, it is often advantageous to run the motors at a higher voltage than
the logic drivers. Your circuit, while nice, won't allow this.

Finally, as you may know, when you reverse a motor (or even shut it off),
the inductance and mechanical inertia can cause a big voltage spike, which
is often deadly to controlling logic.

These problems are usually dealt with by using an integrated solution. The
H-Bridge I mentioned upthread deals with all of this (well, you will need
protection diodes of course), and allows up to an amp of drive current...
You can have split supplies, and run the motors at 12V, while running
the logic at 5V so you can use a microcontroller to drive it directly. It
has the 'inverter' logic built in, so when you turn on one side, it turns
off the other for you after a short delay.

Even if you don't buy it, I'd look up the datasheet and look at the
port schematics and protection schemes to get some ideas. Here is the TI
page: <http://tinyurl.com/8f7wn>.

--
Regards,
Bob Monsen

Man, as a social animal, can no more escape government than the
individual can escape bondage to his bowels."
 
J

Jasen Betts

Jan 1, 1970
0
Here's a .gif of the H-bridge that was embedded in my circuit; I
stripped off everything around it to simplify it and rearranged it a
bit to make it look more like a traditional H-bridge, plus enlarged it
so it's obvious which transistors are NPN and which are PNP.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/H-bridgesimplified.gif

the right side has a current path from the top transistors emitter to its base
then into the base of the bottom transistor... the transistorw will just
burn up.

Also pushing the base much past the collector voltage will destroy a
transistor. a resistor in series with the base will protect against this.

The left side is possibly workable, but the transistors might not turn all
the way on and in that state they are inefficient and heat up.
I also drew the transistor swich I came up with, modified somewhat
since it's conception last night/this morning.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/Vcc_Groundswitch.gif

you have the right hand transistor upside down.

your diagrams are hard to read, it's traditional to put the positive supply
At the top and ground below. input on the left and output on the right.

redrawing your circuit (and flipping the backwards transistor)

------------------------+---+-------- +5V
| |
| |
| |
/ |
| / |
|/ |
+--| |
| |\ 68K
| | \| |
| ~\ |
| | |
+------+---+--[500R]--- out
| |
/ |
in | / |
|/ |
--[68R]-+---| |
| |\ 1MK
iM | \| |
| ~\ |
| | |
----------+-------+------+-------------0V


that's not going to work. the top transistor will never turn on

Jasen: "I think the device your original question was searchiing for is
an inverter,
(or "not" gate) these convert a "high" input to a "low" output and
vice-versa."

It took me a while, but I finally figured out how I could use
inverters. I'd been confused with combining inverters with an NPN/PNP
mix, but once I considered just inverters and NPNs the solution was
obvious, and is presented (in simplified form) in the next .gif. It's
simpler than the solution I developed for the NPN/PNP H-bridge, so I'll
be using the inverter solution instead, but it's nice I at least got a
+Vcc/ground switch out of my confusion.

http://i5.photobucket.com/albums/y165/PeterMackenzie/Technical/h-bridgesimplified_inverters.gif

this one shows promise (but the transistors on the right are upside-
down again )

you'll need base resistors on the bottom transistors too,
and the top onse probably won't turn all the way on...

(if the diagram looks crooked paste it into notepad or configure your news
client to use a fixed-pitch font (eg courier))

------------+------------+-------- +5V
| |
+-------)------------)--[160R]--+
| | | |
+--)-------}--[160R]----)------+ |
| | | | | |
| | | | | |
| | / \ | |
| | |!/ \|| | |
| | |/~ ~\| | |
| +---| |--+ |
| |\ /| |
/ | \ / | \
| / \ / \ |
A |/ | + | \| B
--[2K2]-+---| +----(M)-----+ |---+-[2K2]--
| |\ | | /| |
| | \| / \ |/ | |
| ~\ | / \ | /~ |
| | |/ \| | |
+-[10K]-+------| |------+-[10K]-+
|\ /|
| \| |/ |
~\ /~
| |
------------+------------+-------- 0V


here there's two inputs A and B. putting either of them high will start the
motor (opposite directions each)
putting both high would turn all the transistors on and short
circuit the power supply. (so don't)

Bye.
Jasen
 
Top