I am a noob playing around with nodemcu and esp8266. I am trying to control a motor in an automated air freshener. I had been trying to power the motor with board supply but I gave that idea up when I was unable to manipulate the voltage and current. so now I am trying to just use an npn transistor to close the circuit already in place. There's only the battery and the motor in the circuit. How do I use the npn, considering I am using a nodemcu breakout board?

Also if someone has any idea how to power the motor directly, I am all ears;

Link to motor specs: http://szlh-motor.manufacturer.globalsources.com/si/6008851876220/pdtl/Micro-motor/1146386525/500TB-metal-brush-micro-motor.htm

Battery seems to be 2 AA 1.5v in series.

Apologies and regards in advance for the stupid question.

EDIT: Picture of the motor and battery assembly: https://ibb.co/fnMpic

I would rather not change the soldering of the assembly as I might want to put it back

  • \$\begingroup\$ Please add the image in-line in your post rather than a link. This will improve your post and it will still be relevant when the link dies. \$\endgroup\$
    – Transistor
    Commented Apr 29, 2018 at 15:20
  • \$\begingroup\$ Please see this answer for related information. \$\endgroup\$
    – bitsmack
    Commented Apr 29, 2018 at 15:45

1 Answer 1



simulate this circuit – Schematic created using CircuitLab

Figure 1. NPN motor control.

  • When the microcontroller output goes high a current will flow through R1 into the base of Q1.
  • The transistor will turn fully on and, effectively, connect the bottom of the motor to GND. (You could expect to see about 0.2 V drop across the transistor. The rest of the 3 V will be across the motor.)
  • When the micro output goes low the transistor will turn off.
  • D1 protects the transistor from any high-voltages generated by the inductance of the motor at the instant of turn off. It might not be essential with your low powered circuit but it is recommended.
  • \$\begingroup\$ I have updated the question. I tried to make the circuit you have given but the current that passed was too low, something like 1/5th of the needed. might be because of how the battery and motor are connected \$\endgroup\$ Commented Apr 29, 2018 at 15:13
  • \$\begingroup\$ Please explain how you know what current is needed and what current you got. The datasheet shows that the motor is rated for 1.5 V to 12 V. At 3 V you can expect 1/4 of rated speed at no load. That's 4000 / 4 = 1000 RPM. \$\endgroup\$
    – Transistor
    Commented Apr 29, 2018 at 15:23
  • \$\begingroup\$ I measured the current while directly connected and when connected through the npn. they differ significantly \$\endgroup\$ Commented Apr 30, 2018 at 16:10
  • \$\begingroup\$ Use numbers rather than adjectives. \$\endgroup\$
    – Transistor
    Commented Apr 30, 2018 at 18:06

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.