I'm building a rheometer to measure the viscosity of liquids. I'm using a 4.5-10v DC motor which needs to be accurately controlled by a Raspberry Pi (the speed and torque must scale, so PWM is out).

The circuit

I have been trying to control the motor with a 10k digital pot (MCP4131) in a voltage divider with a transistor to control the voltage through the motor.

In theory, the voltage should (as the pot sweeps through its range, 129 steps) vary between ~2.6v and ~10.5v.

In practice, the voltage only varies between ~7v to ~5v, reaching its minimum after only ~25 steps and then staying constant for the remaining 100 or so steps.

What is going wrong? Is there a better way of doing this?

This has been the bane of my life the last few weeks, any help would be greatly appreciated. If anything is unclear I will clarify as best I can.

EDIT: MCP3141 -> MCP4131

  • 1
    \$\begingroup\$ Voltage measured at what point? I suspect if you disconnect the transistor and measure the W pin in isolation you'll get what you want. The transistor side of the circuit is very badly designed for speed control, and I'm not convinced by your reasoning in ruling out PWM? \$\endgroup\$
    – pjc50
    Jan 25, 2017 at 17:06
  • 1
    \$\begingroup\$ What are the voltages at pins 5 and 7? Is W stepping properly from one of end to the other? I would diagnose the software/micro/pot and the motor drive output completely separately. \$\endgroup\$
    – user1844
    Jan 25, 2017 at 18:37
  • 1
    \$\begingroup\$ How much current can an MCP4131 supply? How much current do you need through the base of the transistor? Can the 12 V source supply enough current for the motor? \$\endgroup\$ Jan 25, 2017 at 18:57
  • 1
    \$\begingroup\$ A quick read of the digital pot data sheet suggests that +12v on "Pot A" pin is way outside acceptable range of zero-to-Vcc. In your case Vcc=3.3v. \$\endgroup\$
    – glen_geek
    Jan 25, 2017 at 21:09
  • 1
    \$\begingroup\$ Before even trying to fix the circuit, motor speed and torque definitely does not scale with applied voltage in a simple way and there are other variables involved (like the load). \$\endgroup\$
    – rioraxe
    Jan 25, 2017 at 21:15

1 Answer 1


The main problem is you are trying to control a voltage of up to 10.5V with a digital pot that can only handle 5.5V. The MCP4131 datasheet doesn't make it very clear, but the pot only works properly when its terminal voltages stay within the supply rails (Vss to Vdd). If they go outside this range then internal protection diodes will attempt to clamp the voltages to Vss or Vdd.

Another potential problem is that the pot's output voltage drops as more current is drawn from it. Pot resistance varies depending on where the wiper is, so the output will be nonlinear if significant current is drawn. Also as the motor draws more current the transistor will draw more Base current, which drops more voltage across its Base- Emitter junction as well as increasing voltage drop in the pot.

If you want to stick with this design idea then you need to either get a pot that can handle higher voltage, or reduce the pot voltage to 5V and amplify it with an op amp like this:-


simulate this circuit – Schematic created using CircuitLab

R3 and R4 produce a voltage gain of 2.1, which amplifies 5V to 10.5V. Q1 is included in the feedback loop to compensate for voltage drop across its Base-Emitter junction, ensuring that the motor voltage follows the input voltage linearly. The op amp's inputs draw virtually no current, so the pot's output voltage stays constant even when the motor is drawing high current. The AD820 can output up to 15mA which the BD243 would amplify by ~100, providing up to 1.5A to drive the motor.

  • \$\begingroup\$ Thank you for the answer! I don't have an AD820, but I have a couple LM358s. They can source 20mA, so they should work instead, right? \$\endgroup\$ Jan 26, 2017 at 18:03
  • \$\begingroup\$ Yes, an LM358 should work. \$\endgroup\$ Jan 26, 2017 at 21:19

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.