Shop OBEX P1 Docs P2 Docs Learn Events
Need help with motor control circuit — Parallax Forums

Need help with motor control circuit

ObnepecObnepec Posts: 20
edited 2011-01-25 07:17 in BASIC Stamp
Hello all,

I am trying to get a basic stamp project working to control the speed of a DC motor. Ultimately I need to control the speed of this motor: FAL3F05LH which is rated at 5vDC .57A.


From the Process Control book page 168 I set up the schematic as shown just without the ADC part of the circuit. I then tested it using the board of education board and the supplied fan which is rated at 12vDC .11A. I was able to get my program working very nicely and control the speed of the fan. This was using a 9vDC 1.6A. I initially started working on this with a 9vDC 300mA supply and the

So looking into this circuit a bit closer I see that the 2N3904 is only rated for 200mA continuous current. So I pulled this out and replaced it with a MPS2222 which is rated for 600mA continuous.

Secondly it has a voltage divider on the non-inverting input such that you double the voltage in vs out. So I pulled the voltage divider out and put a wire between the fan + connection and the inverting input (pin 6). So that as my pwm value goes from 0-5vDC the fan voltage goes from 0-5vDC.

So I tried this circuit and the MPS2222 gets very hot very fast. I called and talked to Parallax technical support and the advice was that maybe there was still something wrong with my power supply. So this morning I bought a brand new switching 12vDC power supply rated up to 2A. Still have the problem with the MPS2222 getting hot. I even tried putting 2 of the MPS2222's in parallel and they both got hot.

One thing I did notice from looking at the 2 fans is that the fan that came with the process control kit reads 1.2MOhm across the fan. The final fan only reads 314KOhm. So maybe I need to add more resistance in series with the fan?

Please let me know if you can see what I am doing wrong with this circuit so that I can run the final fan.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-21 11:41
    This has been moved from the Projects forum since that forum isn't really for questions. It's for describing solutions, possibly in-process.

    I think the Process Control book circuit should work with the MPS2222. If the transistor is getting that hot that fast, it must not be switching on (saturating) completely. I would very very carefully check your wiring. Those resistance values are not reasonable for brush motors. Maybe you have brushless motors and I don't really have any experience with them and those values may be normal. Hopefully someone with more experience in this vein can chime in.
  • ObnepecObnepec Posts: 20
    edited 2011-01-21 12:05
    Mike,

    Thank you for replying. Well, for the FAL motor I just called their tech support and yes that is a brushless motor. I don't know what the motor they sent me with the process control kit (the 12vdc .11A listed above) but I am guessing that its a brushless motor as well. However, one thing I just noticed is that with both of these motors if I set my probes where red goes to motor red and black goes to motor black I get one resistance reading but if I switch the polarity of my meter to motor leads I get a different resistance reading. With the smaller motor that came with the process control kit I get 1.2MOhm and 389KOhm and for the larger motor I get 314K and 620K. I don't have alot of experience with motors so I don't know what this could mean.

    However, considering the resistance from the smaller to the bigger motor is half I could see where this could cause over current in the transistor, just not sure how to fix that.

    Any ideas would be greatly welcome!
  • PTaylorPTaylor Posts: 12
    edited 2011-01-21 12:05
    Not really a solution, but I've been using IGBTs for all my switching solutions to external devices. They work perfectly with microcontrollers. I don't have to worry about operating it in an in between state.
  • ObnepecObnepec Posts: 20
    edited 2011-01-21 12:07
    Well, this is not really so much of a switching problem but an analog problem as I am not just completely turning the transistor on or off but using it to modulate the speed of the fan as the PID block in my BS2PE commands. Ie I may want to run the fan at half speed so the pwm output is half duty cycle. Would an IGBT do this as well? (I have no clue what a IGBT is but will go poke around now)
  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-21 19:57
    PWM is a switching method (Pulse Width Modulation) where the power is supposed to be switched on and off completely (ideally) in pulses. The average pulse on time determines how fast the motor goes. The motor provides mechanical inertia which averages the amount of power available resulting in a speed proportional to the percent of on time of the pulse stream.

    When a switching transistor is turned on and off completely (ideally), there's no power wasted (or heat produced) in the transistor. In non-ideal transistors, there's a little bit of on resistance, thus a modest amount of heat produced. Obviously, in your case, the MPS2222 is not switching completely (saturating), so it gets really hot. Make sure you're not trying to apply a filtered PWM output to the MPS2222. The Stamp's output should be a digital signal which would be true if you've wired it up the way the tutorial shows.
  • Dave KollerDave Koller Posts: 8
    edited 2011-01-21 22:37
    An observation to consider is to double check the pinout of the MPS2222 as I ordered P2n2222A and found the layout from the flat side of TO-92 case style to be CBE - In all my years of using 2n2222's they were always EBC as is 2N3904 ! I just turned them in my circuit but it had me fooled for a bit....
  • ObnepecObnepec Posts: 20
    edited 2011-01-22 07:25
    Mike and Dave,

    Yes, I am pretty sure I did check the pin order when I put it in but I will double check. I have put parts in reversed before but I thought I had checked this. However, would it work at all in that configuration?

    Mike, actually I think what you brought up could be the problem. Its been awhile since my last circuits class but isn't the signal thats finally getting to the transistor a filtered signal? The RC network at the beginning is definately going to be a low pass filter (ie converting the pulse train into a charge on the capacitor and therefore a more or less stable voltage) and then the op amp, while initially used as a voltage multiplier won't it somewhat smooth the signal? I wonder what would happen if I A) try taking the op amp out and then B) try taking out the RC network. What would happen if I just put the output of the BS to the transistor? I believe that would convert it from an analog signal getting to the transistor from the BS to more towards the transistor being turned on and off rapidly. However, as I said its been awhile since my last circuits class. What do you guys think?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-22 07:45
    You're absolutely right. The filtering at the input of the LM358 transforms the PWM signal into an analog voltage (current actually) which the LM358 amplifies and presents to the MPS2222. I should have looked at more of the tutorial. Anyway, the transistor is operating as an analog amplifier and dissipating the excess power as heat.

    Assuming your motor draws on the order of 400mA to 500mA, at 2.5V across the motor, the transistor has to dissipate (5 - 2.5)*0.5 Watts = 1.25W. That's well beyond the capabilities of the MPS2222. You need some kind of power transistor with a heatsink.

    Try something like a TIP31 that you can get from RadioShack.
  • ObnepecObnepec Posts: 20
    edited 2011-01-23 09:06
    Mike, Ok, I just went to RS and bought one of the transistors, the nice finned Al heat sink for it and a tube of heat sink compound. Now I am going to have to read back through the text to see what I can do to unbuffer the input to the transistor. Ie if I should just have a wire from the output pin to the transistor or if I need a resistor in between the two. Thanks for your help and I will see how this works tomorrow morning.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-23 10:13
    It depends on what you want to do. If you want to use direct PWM to control the fan and eliminate the filter and the op-amp, you probably don't need the TIP31. The MPS2222(A) should work fine because it's either on or off and both states create little in the way of heat. If you want to keep the filter and the LM358, then you need the TIP31 and the heatsink because the transistor is acting as a variable resistor and dissipates some of the power going to the fan as heat in order to control the fan's speed.

    Look at the Nuts and Volts Column #6 for examples of how to use an external driver with the Stamps. You do need a base resistor or you may damage the Stamp.
  • Dave KollerDave Koller Posts: 8
    edited 2011-01-23 21:15
    Mike Green wrote: »
    It depends on what you want to do. If you want to use direct PWM to control the fan and eliminate the filter and the op-amp, you probably don't need the TIP31. The MPS2222(A) should work fine because it's either on or off and both states create little in the way of heat. If you want to keep the filter and the LM358, then you need the TIP31 and the heatsink because the transistor is acting as a variable resistor and dissipates some of the power going to the fan as heat in order to control the fan's speed.

    Look at the Nuts and Volts Column #6 for examples of how to use an external driver with the Stamps. You do need a base resistor or you may damage the Stamp.

    Took me awhile to download the 10 meg file ( I am in the woods on dialup ) to see what schematic you were talking about I agree with Mike do a direct PWM - skip the op-amp. I use power fets and opto-isolators with PWM in an H bridge for Robots.. Fan should be a piece of cake for you...

    Dave
  • ObnepecObnepec Posts: 20
    edited 2011-01-24 06:11
    Mike, well, what I really want to do is just control the speed of the fan. I always like going with a beefier control if I can and if my fan is going to pull up to a half amp and the MPS2222 is only rated for 600mA vs 3A for the one I just bought from RS I will go with the RS one with the heat sink.

    Dave, I did take a look at the column 6. What sub-category did you find the info in? I am planning on reading through all of these when I get time but want to find that schematic.

    Mike and Dave, whats the best way to find the value for the base resistor I need to use?
  • ObnepecObnepec Posts: 20
    edited 2011-01-24 09:56
    Ok, I found a website that suggested methods for calculating Rb resistance values. Using my output voltage of 5vdc my supply voltage of 12 volts and the Ic as .57A I came up with 17 ohms as my Rb. Does this seem like a good value?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-24 10:05
    No.

    A Stamp I/O pin can supply about 20mA at roughly 5V. The base to emitter diode of the transistor drops about 0.7V. That leaves 4.3V. At 20mA, you need a 220 Ohm resistor (R = Voltage / Current). This assumes that you're using the common-emitter switch circuit shown on the last page of the Nuts and Volts Column I mentioned.

    For the transistor to switch on completely, it needs a current gain of at least 30 (0.57A / 0.02A). At this current level, the TIP31 should be fine for that.
  • ObnepecObnepec Posts: 20
    edited 2011-01-24 10:11
    Mike,

    Actually I was not able to find the schematic you are talking about. I opened up column 6 you referenced above and downloaded all the columns and searched them for transistor, pwm etc and wasn't able to find anything. Exactly which subset are you talking about inside column 6?

    Ok, I will give it a go with a 220Ohm resistor between the BS and the base and once I find the schematic you are talking about I will try that out and see how it works.
  • Dave KollerDave Koller Posts: 8
    edited 2011-01-24 10:25
    I would be a bit cautious if driving direct from the Stamp. If you need that much drive I would buffer it. OOps I just noticed Mike might be answering the question...

    Dave
  • ObnepecObnepec Posts: 20
    edited 2011-01-24 16:01
    Mike,

    Still no luck finding the transistor circuit diagram you referenced in any of the sub columns in column 6. Can you please provide a better description of where this is located so I can make sure I match your circuit for testing tomorrow morning?
  • Dave KollerDave Koller Posts: 8
    edited 2011-01-24 20:19
    This what you were looking for?
    870 x 578 - 44K
  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-24 21:35
    The last page (here) of the column shows the circuit using a 2N2222. You may need the diode across the fan if it doesn't have one internally. Safest is to include it. A 1N4001 diode from RadioShack will do fine. Notice that the motor is in the collector circuit, not the emitter circuit as in the Process Control tutorial.
  • ObnepecObnepec Posts: 20
    edited 2011-01-25 07:17
    Mike and Dave,

    First off thank you both for all your help. I have the circuit running now at about half duty cycle and the blower (.57A) is blowing and the transistor with heatsink is not heating up at all to the touch!!

    Now, as a true engineer, since its working how can I improve it? The motion of the blower is still a bit choppy as its getting the pulse train. Would putting a capacitor across the fan help to smooth this out?

    Again, thank you very much for your help. Mike, once I get this project working would I put it in the projects section? What is the protocol for that?
Sign In or Register to comment.