please rate
this thread
  •  
  • Subject
  • Author
  • Date
Posted by HC on March 4, 2010, 7:59 pm
 

I had posted recently about stepper motor control.  Since that post
and the replies I received I have come to the point of building the
actual motor controller.  Plenty of H-Bridges exist but I wanted to
use some components I had.  I posted this on my first posting but
received no replies; with all the spam I see show up in the group I
feared it might have gotten lost so I'm reposting as a new post.

Here's the post:

Hello, all.  Where I am now is I have learned a fair bit about
programming Micrchip PICs and think I've got that well enough to
finally implement a test design.  I'm taking the suggestion that I
start with rated voltages initially, so no need for current sensing
yet.

I started looking for an H Bridge circuit for my test motor because
running it bipolar yields higher holding torque than unipolar
operation.  I have a number of BUZ11 N-Channel MOSFETs that I wanted
to use and, I've read, they offer less resistance to the load so less
heat is generated when they are operating, particularly switching.
Plus, I don't think I have a P-Channel MOSFET in captivity and I live
in the sticks so I can't just run to the store and grab one.


So, after reading tons of stuff on H Bridges I kind of cobbled
together a piece that works and I wanted to fly it out there and see
if I've done any good or if I'm screwing up.  I have the schematic
done up and saved on Photo Bucket: (http://s938.photobucket.com/home/
nunyabusiness11).  I hope that link works.  If not you can hit the
site and search for my username listed at the end of that link.


I've wired it up and it works.  It is simply 1/4 of an H Bridge, one
of the upper legs supplying positive voltage to the motor.  Currently
I did not put in any clamping diodes around the motor because the
MOSFET has one and it'll work for just seeing if the circuit works.


Basically, I'm using 5Vdc from the PIC (simulating it now by just
touching the input to +5Vdc or Gnd) to activate a NPN
phototransistor.  That switches +12Vdc to ground via a 3k3 pull-up
resistor (it is located before the phototransistor).  That line
(before the phototransistor) is connected via a 10k resistor to the
base of a PNP 2N3906.  The collector is tied to +12Vdc via a 1k
resistor.  The emitter is connected to ground via a 2k2 pull-down
resistor.  The N Channel MOSFET gate is tied to the line after the
2N3906 but before the 2k2 pull-down resistor.  The N Channel MOSFET
is
tied to +12Vdc on the drain and the source ties to the motor which
itself is tied to ground.


I used the phototransistor (SFH615A) to isolate the 5Vdc circuit from
the 12Vdc circuit.  When the input to it gets +5Vdc it switches on
the
phototransistor which allows the base of the 2N3906 to go low
switching it on.  That switches voltage to the leg with the 2k2 pull-
down resistor and to the gate on the MOSFET.


I've tested it a few times, just powering the system up and touching
the input directly to +5Vdc or Gnd.  The motor holds securely when
the
input is energized and seems to freewheel correctly when the input is
grounded (after I changed the pulldown resistor on the MOSFET gate
from a 3k3 to a 2k2).


I'd appreciate input as to whether or not this is a good idea or if I
simply got lucky that nothing smoked.  I'm not an EE by any means and
this circuit could be the silicon equivalent to a crack-baby.


Thank you.


--HC


Posted by John Fields on March 5, 2010, 5:17 pm
 



---
Errors:

1. Q1 is wired backwards.

2. R4 won't be needed with Q1 wired right.

3. With Q2's source grounded,and its drain connected to +12V, what's
   likely to happen when its gate is driven high?

4. Even with the ground removed from Q2's source, since it's configured
   as a follower, it's gate will need to be driven substantially  more
positive than
   +12V in order to get 12V into the stepper winding.

5. There probably isn't enough current out of your ”C to drive the opto
   LED directly and get a snappy output from the optotransistor.


Plus, I'm pretty sure that in bipolar mode, in order to drive the
stepper backwards and forwards and maintain the high holding torque
you'll need _two_ full  bridges...


View in Courier:

            +12
             |
     +-------+------+
     |              |
   [Q1A]          [Q3A]
     |  +--------+  |
     +--|--[L1]--|--+
     |  |        |  |
   [Q2A]|        |[Q4A]
     |  |        |  |
GND--+  | MOTOR  |  +-GND
     |  |        |  |
   [Q2B]|        |[Q4B]
     |  |        |  |
     +--|--[L1]--|--+
     |  +--------+  |
   [Q1B]          [Q3B]
     |              |
     +------+-------+
            |
           +12

JF

Posted by HC on March 5, 2010, 10:50 pm
 


Hey, John, thank you for your reply.  First, you are correct (in my
understanding) that there will need to be two FULL bridges.  This part
of the circuit I'm floating out there is only one quadrant of one full
H Bridge.  The lower quadrants are easy, simply control two N-Channel
MOSFETs.  It's the upper quadrants that I'm not sure about and which I
have posted here (simply one, knowing I'll need one on each side of
the H).

Second, I realize in a point you made a mistake that I made.  In the
diagram where I show 'MOTOR HERE' what I meant to illustrate is that
the motor is actually there; the source of the MOSFET does *not* tie
directly to ground, it ties directly to the motor winding I'm testing
the circuit on which, in turn, is connected to ground.  When I was
using the diagramming software (my first time with it) I could not
find a motor symbol so I just used a wire and connected it in like a
label; I'm sorry, that was confusing and easily (and correctly) read
differently than I intended.

So, basically this is just one upper leg of an H and the motor winding
actually resides between the source of the MOSFET and ground.  In the
final design there will be two of these pieces for each of two H
bridges.  For testing there is simply the one.

I have built this circuit, but I'm not sure that it's right...it just
worked for the few minutes I played with it before seeking advice from
people who know more than I.  It might work for years in actual use or
it might fry after 10 minutes..but on the bench for about 2 minutes it
worked...I'm just not sure it's *right*.

That said:

1) Q1 is a 2N3906 PNP transistor so I have it in my mind that is
switching on and off current to the gate of the MOSFET which needs a
positive input to turn on.  Therefore it should be before the load I
thought.  The 1K above it is to limit current through it 'just in
case', and the 2K2 below it is to allow the gate of the MOSFET to go
HI when Q1 is on and to pull the gate of the MOSFET LO when Q1 is
turned off.  How should it be correctly wired (assuming the diagram/
circuit is viable at all)?

2) Okay

3) Poor diagram convention on my part

4) With the motor in place like I should have drawn it it should (and
has for brief tests) work.

5) I have not measured the current draw of the optoisolator.  That is
a good point and something I will need to do.  I could add *another* Q
to drive that load ... but that seems to be getting a lot of
components involved to avoid using one P-Channel MOSFET.  First I'll
see where the end of my current circuit design ends (either I scrap it
or it lives) and then I'll check that.  I'd still like to go forward
with my circuit for now if for no other reason that I'll learn more as
I go through it.

Okay, I looked at the diagram you posted.  That would be the complete
pseudo circuit for a bipolar reversing stepper motor driver.  With
that diagram as reference, the little circuit I have drawn (and am
trying to design/hammer out) would be in the positions of Q1A, Q3A,
Q1B, and Q3B, each one an instance of the circuit I have 'designed'
and am discussing here.

That image was a pill to get to (thank you for your efforts).  I tried
the link and I'm not happy with it.  Here's a tinyurl that may make it
easier to get there: http://tinyurl.com/yhv2onr

Thank you again for your time and help.

--HC

Posted by John Fields on March 6, 2010, 8:28 am
 




---
Responding to 1 and 5, View in Courier:


+12>----------------------------+-----------+-----+
                                |           |     |
                              [10K]         |     |
                    +-------+   |           E     |
+5>------[100]------|A     C|---+--[10K]--B PNP   |
                    | -->B  |               C     |
                 +--|K     E|               |     D
                 |  +-------+               +---G NCH
                 C                          |     S
”C I/O>--[1K]--B NPN                       [1K]   |                  
                 E                          |   [LOAD]
                 |                          |     |
GND>-------------+--------------------------+-----+

---


---
OK
---


---
No offense intended, but you miss the point.

The reason it seems to work is because it turns the motor, but An N
channel enhancement mode MOSFET requires that its gate be driven more
positive than its source in order for the channel to be fully enhanced,
and using it with the load in the source lead means that as voltage is
dropped across the load the source voltage "follows" that voltage, with
the result that gate voltage must be driven higher than that in order to
increase the current into/voltage across the load.

The TIP11 requires the gate to be some 4 volts more positive than the
source in order to drive Rds to its minimum, so if you've got a 12V
supply that you want to use to drive a 12V motor AT 12V, (minus the IČR
loss across the channel) you'll need to put >= 16V on the gate in order
to do that, like this:


+12v>------+        
           |
           D
+16V>----G
           S
           |
           +--~12v
           |
         [LOAD]  
           |
GND>-------+
---


---
That's the nature of the game, ;), but you're not adding another Q to
avoid using a P channel MOSFET, you're doing it to make sure you can get
enough drive out of the opto to saturate Q1 and drive the MOSFET
adequately.
---


---
Good idea. :-)
---


---
My pleasure. :-)

JF

Posted by HC on March 7, 2010, 1:38 pm
 


Hi, John, thank you for your reply.  I have posted a new diagram at
that link with the motor winding in proper place.  I did not make the
change to the transistor because I'm sure there will be more changes
yet; I just wanted to get the original idea documented correctly.
(edit, now I have added a new drawing with the PNP oriented correctly)

In the diagram you've sent the emitter from the optoisolator is not
connected; I assume that would still be connected to ground.

No offense taken, thank you for your help and there's lots I don't
understand...even some of the basics, see below.

An admission on my part; I didn't understand how the transistors
should be wired in (to my surprise).  I took quite a bit of time to go
and read and re-read about transistors, particularly PNP transistors
since your post and found my basic understanding was wrong.  First, I
didn't know that the emitter went to the +V.  It's frustrating when
schematic convention is to have +V at the top and -V or Gnd at the
bottom and the emitter is shown at the bottom of the schematic symbol
yet it is to be connected to +V at the top.  My datasheet on the
2N3906 did not have example or test circuit schematics in it for me to
use as a guideline so I just used my experience (+ up and - down) and
that's how I got it the way it was (wrong).  Since my reading I know
how to orient it correctly as you show.  Another frustrating thing is
that I found some circuits with the PNP before the load and some with
it after the load; I thought a transistor acted as a switch and either
switched the load to ground (NPN) or switched the positive to the load
(PNP).  But some schematics show the load before the PNP.  Having a
NPN before the load or having the load before a PNP would seem to make
biasing the transistor (getting the right amount of current to flow
through the base) difficult (since the base would need to be more
positive than the emitter on a NPN but with the emitter before the
load (the voltage drop) would be at V+ and vice versa for a PNP).

I don't know but it was a frustrating misunderstanding on my part.

Okay, so if I apply +V plus 4 to the gate I should get it fully
(enhanced?) switched on.  I'm confused reading the datasheet; it says
that the threshold voltage between the gate and source Vgs(th) is
between 2.1 and 4 volts.  I took that to mean that it began to switch
on at between 2.1 and 4 volts (variance by each part I presume) across
the gate-source junction.  I do not recognize a parameter in the list
that to me equates to the Vbe(sat) saturation voltage spec I find in
the 2N3906 datasheet.  That is, to my reading, a 'threshold voltage of
2.1 to 4 volts' is not synonymous with 'this device is fully enhanced
when 2.1 to 4 volts is placed across the gate-source pins.'  Should it
be?  Should I read 'threshold voltage of gate-source juncture' to be
'the device is fully switched on when the gate-source juncture has
between 2.1 and 4 volts'?

I understand the bit about the 16 volts; the source, connected to the
motor winding would be at +12V when energized (before the voltage drop
of the load) so 12+4, no sweat.  But in order to pull that off I need
three voltages for this circuit: 5V for the TTL/IC end, 12V for the
motor, and 16V for driving an N-Channel MOSFET in the positive
supply.  Since it uses very little current I could use two 8V regs
(78L08 I think is the part ID I'm referring to) with one floating on
the first (there's a PIC programmer called the PIC16PRO40 that uses a
similar setup for achieving 13Vdc with one 8V reg riding on the output
of a 5V reg (13Vdc output).

Okay, then I need another Q to switch the optoisolator.  I checked the
draw of my optoisolator and it's roughly 34mA.  Maximum source/sink
current on any IO, according to the datasheet on the PIC16F684 I'm
using, is 25mA.  Good call on the Q to switch that.  I've redrawn the
circuit now using your suggestions.  The PNP is correctly oriented, I
upped the pull-up from 3k3 to 10k, added the NPN for the optoisolator,
removed the unnecessary resistor on the PNP, tightened the drawing up
to make more room and then added a voltage supply that uses the two
78L08's I mentioned.  I left off any and all filter capacitors just to
keep the drawing tidy for now and because I may have to make numerous
changes yet and I don't want to have to shuffle filter caps around the
screen.  Suffice it to say, if I build this new circuit I will use
filter caps as per the datasheet for the 78L08's.  http://tinyurl.com/yhv2o=
nr

Oh, and when I said something about doing all this to avoid using a P-
Channel, what I meant was all this time and effort and the components
here exist because I don't want to use a P-Channel MOSFET to switch
the high-side of the H-Bridge.  I still want to use the all-N-Channel
solution and, if nothing else, I've learned a lot in the process.

Thanks again for your help and time.

--HC



  • Subject
  • Date