0
\$\begingroup\$

I'm attempting to make a quadcopter using an Arduino board (Blend Micro). I've wired everything up as such: Wiring When I run the following code just to test if everything is working, the motors do not spin at the same rpm:

void setup(){
  pinMode(9, OUTPUT); 
  pinMode(5, OUTPUT); 
  pinMode(10, OUTPUT); 
  pinMode(11, OUTPUT); 

  analogWrite(9, 100); 
  analogWrite(5, 100); 
  analogWrite(10, 100); 
  analogWrite(11, 100); 
}

M1 will spin as expected, M2 and M3 will spin very slowly, and M4 will not spin at all.

The pins (D5, D9, D10, D11) on the Blend Micro supply 3.3V, 20mA max.

I have checked the wiring many times and there are no shorts/everything seems ok.

Extra:

  • The motors are rated at ~3.7v max (therefore I planned to not exceed 70% for PWM)
  • At 3.3v, the motors draw ~1A each (so I assume I need to change the 2N2222 transistors)
\$\endgroup\$
5
  • 2
    \$\begingroup\$ I don't know the specifics of arduino 'analogwrite()', but I do know DC motors. You need diodes to absorb flyback. Take a look at this article. Measure your PWM on each channel with an oscilloscope to make sure that you actually have the waveform that you think you have. \$\endgroup\$ Commented Mar 22, 2016 at 18:01
  • \$\begingroup\$ analogWrite("pin","duty cycle max 255") provides PWM at 960Hz. I'll add those diodes then. I wasn't sure exactly how important the diodes were so I neglected using them. \$\endgroup\$
    – SMD01
    Commented Mar 22, 2016 at 18:15
  • \$\begingroup\$ If the motors draw up to 1A at 3.3V, then your Transistors can already not be trusted any more. A 2N2222 is very weak in terms of modern transistors. \$\endgroup\$
    – Asmyldof
    Commented Mar 22, 2016 at 19:11
  • \$\begingroup\$ Try with beefier transistors. you are drawing close to their limit. \$\endgroup\$
    – Alex
    Commented Mar 22, 2016 at 20:29
  • 1
    \$\begingroup\$ It sounds like you have something seriously wrong (apart from the unwise use of BJT's) but even apart from that you should not expect motors to run the same speed open loop or even ones that did to make your quad flyable. Rather you need at minimum a control system which closes a loop for commanded angular rate against a multi axis gyro and also possibly a loop that controls commanded angle with respect to the horizon against a multi axis accelerometer. \$\endgroup\$ Commented Mar 23, 2016 at 3:43

1 Answer 1

4
\$\begingroup\$

If you are going to use BJTs for the PWM elements, you need to be aware that the base current should be (roughly) 1/10 the collector current. Your 220 ohm base resistors will only provide about 10 mA, assuming that Blend IOs can source that much. The ATMega data sheet suggests 4.2 volts min, so if you include the 0.7 volt base-emitter drop, you might get 17 mA. This, however, is greater than the 10 mA test condition which established the 4.2 volts, so it could be lower.

The reason your motors are spinning at different rates is twofold. First, your 2N2222s are simply not capable of putting out 1 amp (I see that you are aware of this, but the fact that you report your results using the 2N2222s suggest that you're not aware of how badly undersized they are.) Even if you get beefier transistors, you are not providing anything like adequate base drive.

Is there a solution? Yup. You already know you need to replace your transistors. What you need to replace them with is MOSFETs, and not just any MOSFET. You want logic-level units. Your gate voltage is marginal for more standard FETs. That is, if you go to something like the IRZ44N, for example, they may well work, but if they don't you have no complaint.

\$\endgroup\$
15
  • \$\begingroup\$ Excellent! I'll try this as soon as I can! Would you recommend anything else? Different resistors maybe? \$\endgroup\$
    – SMD01
    Commented Mar 22, 2016 at 19:45
  • \$\begingroup\$ @SMD01 - Go to digikey.com and search on discrete semiconductors, MOSFETs, and search for Vgs of 2 volts. The best candidate I see is PHP79NQ08LT, which will run you about 1 1/2 bucks each. And other than that, I don't see any problems with your circuit, except that you should put a flyback diode across each motor. A 1N4001 is probably adequate. \$\endgroup\$ Commented Mar 22, 2016 at 21:22
  • \$\begingroup\$ Rated 75 V and 73 A, the PHP79NQ08LT is overkill in every respect, why would you introduce it as the "best candidate"? The little quadcopter would have to lift 4 heavy TO-220 packages. A 1N4001 is not optimal either, as they are designed primarily for rectifying mains frequency AC and have a poor transient response and reverse recovery time as a result. \$\endgroup\$
    – jms
    Commented Mar 23, 2016 at 1:28
  • 3
    \$\begingroup\$ If soldering an sot23 mosfet is a dealbreaker, the project should probably be abandoned. Getting something to actually fly will be far, far more complicated than the poster imagines, especially on the software side. They'll probably need to spend some time with existing boards and source code first, and until a size class dangerously large for experiments, those are surface mount. \$\endgroup\$ Commented Mar 23, 2016 at 15:40
  • 1
    \$\begingroup\$ @SMD01 - Welcome to the world of real engineering. First rule is Murphy's Law: "Whatever can go wrong, will." Second rule: "It's never as easy as you thought it would be." Third rule is Finagle's Law: "The perversity of the universe tends towards a maximum." Good luck on your project. \$\endgroup\$ Commented Mar 30, 2016 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.