Prev: Be ready to be killed, or take action to stop the global suicide.Scandal at CERN.
Next: Choosing a PIC controller
From: HC on 4 Mar 2010 19:59 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
From: John Fields on 5 Mar 2010 17:17 On Thu, 4 Mar 2010 16:59:19 -0800 (PST), HC <hboothe(a)gte.net> wrote: >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. --- 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
From: John Fields on 7 Mar 2010 19:57 On Sun, 7 Mar 2010 10:38:12 -0800 (PST), HC <hboothe(a)gte.net> wrote: >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. --- For a real learning treat, if you don't already have LTspice, download it, free, from: http://www.linear.com/designtools/software/ JF
From: Jasen Betts on 13 Mar 2010 04:26 On 2010-03-08, John Fields <jfields(a)austininstruments.com> wrote: > Notice that, since ground is more negative than +V, we can also draw the > PNP switch this way if we're using it with a positive supply,: > > +V> ---------+ > | > E > GND>--[R]--B NPN > C > | > [LOAD] > | > GND>---------+ that transistor should be labeled PNP --- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: John Fields on 13 Mar 2010 13:15
On Fri, 12 Mar 2010 20:08:01 -0800 (PST), HC <hboothe(a)gte.net> wrote: > >Hey, John, sorry for the delay. I've been busy with a few other >projects and also kind of letting this cook in my mind. > >What you're calling a "common-emitter" layout is what I always thought >of as the "right way" to wire a transistor (not saying it *is* the >right way, just the way I always thought of it)...I just blew the >detail about PNP's connecting the emitter to +V. Anyway it's the >orientation that "clicks" with my mind. > >Silly basic (maybe) question: you say the base-emitter voltage would >need to be between 0.7 to 1.0 volts to fully saturate the transistor. >I see in the datasheet on the 2N3906 that the "Base-Emitter Saturation >Voltage" (Vbe) is between 0.85 and 0.95 volts for that particular >part. How do you calculate the necessary base resistor to do that? --- You don't, since the base-to-emitter junction is just a diode, and whatever current you put through it will result in one diode drop (Vbe) across the junction, just like in any other diode. What you do is select the base resistor depending on how much current you need to force into the base in order to get the collector current you want, and then live with the Vbe(sat) and Vce(sat) since they'll be whatever they'll be. Rule of thumb for switches is to force 10% of the collector current into the base (called: "forcing a beta of 10", since beta = Ic/Ib), and what the data sheet is telling you is that with the CE junction of the transistor fully saturated there'll be between 0.85 and 0.95 volts across the BE junction. Just for grins, let's assume we have something like this,: 12V Ic--> / V+>------------+ | [120R] R1 | +--0.3V | C Vin>---[R1]--B E | GND>-----------+ and that with the transistor fully saturated we have 0.3V across the CE junction. Then, with a 12V supply, we'll have a collector current of: (V+) - Vce 11.7V Ic = ------------ = ------- = 0.0975A = 97.5 mA 120R 120R If we force beta to 10, then, we'll need 9.75mA into the base to turn on the transistor. Also, let's say that Vin is coming from a logic supply and is either 5V or 0V. Then, to get the value of R1 with the transistor turned on, we say: Vin - Vbe 5V - 0.95V R1 = ----------- = ------------- = 415 ohms Ib 0.00975A If we did the math with Vbe equal to 0.85V, then R1 would be equal to about 426 ohms, and with the "natural" beta of the transistor being so much higher than 10, a standard 430 ohm 5% resistor would be fine, and it would dissipate: Pd = (Vin - Vbe) * Ib ~ 0.040 watts, so a 1/4 watt carbon film would be great. --- >If I knew what the V was and the Current I could calculate the R...I >know the V but not the R or the C...so I looked at the datasheet from >Discrete Power and Signal Technologies which I had and there's a graph >of base-emitter voltage vs. collector current for full saturation. I >can see from that figure that if you have 20 mA current through the >collector at 25 degrees C you'd need 0.7 volts across BE. Great, but >with neither of the other two values I don't know what to do. I found >a datasheet from On Semiconductor for the same part and they have a >figure (Figure 14, theirs are numbered) that shows the amount of base >current compared to the voltage across the collector-emitter junction >with the amount of current across the collector. So, if you will >carry Ic 1.0 mA your Vce will be 1.0 if you have a base current of >0.01 mA. The higher the base current, the lower the Vce and (I think) >the lower the power dissipation in the transistor. For 5V input, easy >calculation: R = V/I, R=5/0.00001 (0.01 mA), R=500,000 ohms. For a >100mA Ic it shows you'd need a 3.5 mA base current to achieve the 1.0 >Vce so for 5 volts input: R=5/0.0035, R=1429 ohms, nearest standard >value would be (I think) 1500 ohms. --- See above. :-) --- >Anyway.... > > Looking at figure 5 of the datasheet I see that the higher the drain >current, the higher the drain to source voltage needs to be to lower >the drain-source voltage (the lower the Vds the lower the power >dissipation I believe, which is good). --- Something's wrong there... The higher the drain current, the higher the gate-to-source voltage needs to be in order to lower the drain-to-source resistance, the Vds, and the dissipation. Good thing, unless you're building a temp-controlled heater of some kind... --- >There is a superimposed 75W Pd >I see...so that's the max Pd of the device I see...kind of a redline >on that graph. Okay, higher Vg = lower Vds = lower power >dissipation. So, what if I drive the BUZ11 with Vdrain +20V? So, for >switching +12V (drain) with the BUZ11 use +32V for the gate. --- Since you can fully enhance the channel with 10V Vgs and you want 12V into the load using a source follower, you should be able to do it like this: +12v>----------------+ | | D +22---[R]----+-----G NCH | S C | I/O>--[R]--B NPN [LOAD] E | | | GND>---------+-------+ Caveat here is that Vgs can only safely be +/- 20V. Run it in LTspice and see what happens... :-) --- >IIRC, HP >switch-mode power supplies for their printers (some of the bubble >jets) have both +16 and +32V outputs with beaucoup current. >Regardless, it's doable. > >Well, I wasn't sure how the 78L0x did it's job...it was a nice idea... ><GRIN> But if I have a higher voltage source it can scale it >down...so that would work. > >I think I'm happy now with the circuit design. I will draw it up once >more as a quarter of the final design with the new voltages and after >considering using a ULN2803 or similar as a buffer to the drive >circuitry instead of the opto isolator. A couple of more revisions >and some more time to think about it and I'll be ready to breadboard >another try. > >Thanks for the info on LTspice. That looks cool. Says it can do real- >time simulations of switch-mode power supplies...that's got to be some >intense work. I've started drawing up my circuit in it but I'll wait >until I'm a bit more solid on what the circuit will be finally. > >Thanks again. --- You're welcome again. :-) JF |