0
\$\begingroup\$

I am using this circuit to control the speed of a small motor (12VDC, 0.3A). The arduino PWM output saturates a 2N2222 NPN transistor which saturates the mosfet gate.

My issue: when PWM is high (5V), the output is low at the mosfet (0V = motor stopped). So when my controller starts up, the motor is running until the code applies the max value to the PWM output to shutdown the motor.

What I want to achieve: PWM high (5V) results in output high. instead of "PWM high (5V) results in output low".

I could solve it using an opamp to invert the signal but there must be a simpler way?

enter image description here

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

when my controller starts up, the motor is running until the code applies the max value to the PWM output to shutdown the motor.

You can use a pull-up resistor with your existing circuit to ensure the load stays off until your code reaches the point of enabling its output pin.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
13
  • \$\begingroup\$ I already do it in software, the problem is the small time upon controller startup. I can only use DIP package... it's on stripboard. \$\endgroup\$
    – Vinlar
    May 6, 2019 at 21:27
  • \$\begingroup\$ @Vinlar, you could include a pull-up on the 2N2222 base to keep the motor off until your code gets to the point of enabling the output pin. \$\endgroup\$
    – The Photon
    May 6, 2019 at 21:29
  • \$\begingroup\$ do you mean a 1K pullup to the arduino 5V? in that case if PWM is 0V, I would have a voltage divider in place (2.5V?) \$\endgroup\$
    – Vinlar
    May 6, 2019 at 21:33
  • \$\begingroup\$ thanks, I will give a try tonight!! I suppose R2 is the optimal value to saturate the 2N2222 with 5V (1K is a little high), but how do you obtain the 22kOhm for R1? \$\endgroup\$
    – Vinlar
    May 6, 2019 at 21:43
  • \$\begingroup\$ @Vinlar, I changed my suggestion to avoid back-flowing current into the UC's output pin when the voltage is high. You want R1 as high as possible but still saturating Q1 when the UC output is disabled. Not knowing if you have a 3.3 V or 5 V micro, I have made guesses at the values --- you'll want to double check how they work. Using a logic-level MOSFET instead of a BJT for Q1 might simplify things. \$\endgroup\$
    – The Photon
    May 6, 2019 at 21:50

Your Answer

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

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