Controlling 0-5.7v signal dc motor

Hi guys. I have a DC motor controller that uses a 5k pot to drive an 0-5.7v analogue signal to control the speed of the motor. I am wanting to convert this to digitally controlled and I have copied the following circuit successfully (V2 = arduino, R2 = 390ohm and X1 = 4N25).

Vin = 5.7v (from DC controller) Vout = .25-5.7v varying PWM signal from Arduino.

My questions are:

  1. When power on the pwm side is off, the output circuit is open (NO) and 5.7v is output but I would prefer to have the circuit default to off (0v). Is there a simple way to do this in this circuit?
  2. Why is the minimum voltage just greater than 0v? Is this due to the capacitor? Is the capacitor oversized?
  3. A small thing but the signal is inverted from the PWM side. Other than changing the logic in the code (255 = 0v and 0 = 5.7v) is there way to invert it back?

I did look at using digital pots as replacements but this was a much simpler design with only one signal/octocoupler required to drive it.



If reinventing the wheel is your goal, then this is a good attempt, but your primary goal is to control a PWM motor using a trim pot?
Why not use an h-bridge, put the pot on an analog pin and use its reading to dictate the PWM written to the enable on the h-bridge? The h-bridge only costs a dollar or two.

I agree but it's a 180v DC motor, 1.8A 250W. I couldn't find an H-bridge/driver to handle those values - I tried. So I decided to use the existing controller and drive it using it's analogue control signal.

I have 3 of them to control - all fed from 240AC. So reinventing the wheel is sometimes required.

Hi, @chris_a_v
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

So you want to control the CONTROL input of a motor controller.
The input is 0 to 5.7Vdc.

Tom.... :smiley: :+1: :australia:
PS, I'm off to bed, you should have some help from some other part of the world soon.

Here's one +600V

Your proposed fet solution runs into huge induction issues and if the motor is tweaked by hand huge generator issues as well.

Yes @TomGeorge. That would be the idea. And yes, I should have stated the entire system/project rather than part of it - apologies to all and sundry. First time jitters :grimacing:

In that spirit, here is the existing controller. I did try to find an alternate driver/module that I could replace it with but couldn't find anything - at least at a reasonable cost. So I figured I would try and replicate the current analogue pot - connected to the white 3 pin header. There is only ever 5.7v applied across it.

Thanks for the info @er_name_not_found. I will investigate but a couple of questions:

Why would there be huge induction issues and why would the motor be tweaked by hand?

Thanks for the info, does the controller have a part/model number?

Tom... :smiley: :+1: :coffee: :australia:
PS. In your circuit diagram, swap R1 and the output of the opto over, so R1 is in place of the opto output transistor, and the output transistor goes where R1 was.

No part number. I think they are custom made for the manufacturer of the end product. The product by the way is a 3 wheel, baseball pitching machine. The project is to computer control the pitch, angle and motor speeds from pitch to pitch. The servos, gearing etc. is done, just trying to control the DC motors.

Just so I am clear, connect Vin directly to pin 5 (collector) of the octocoupler and R1 is connected to pin 4 (emitter)?

Like this;

Tom... :smiley: :+1: :coffee: :australia:

Awesome. Thanks @TomGeorge. Works exactly as desired except for the loss of .15v at the top end. I assume that's the cost of doing business with the 4n25?


Yes that would be it.
If you like you could Google;

optocoupler mosfet output

They will have a lower ON voltage drop, compared to the BJT output type.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

That sounds like the Vsat of the transistor. You need a MOSFET if you want 0V minimum.

Ok - so I am stumped. This didn't work when connected to the controller?

I measure 12v across the two outside pins on the board (middle is wiper). But when I connect any cicruit to them the voltage drops significantly. Even just a 10uF capacitor drops the voltage to 7.5v and any more IC components and it continues to drop. I measured current at 1.5mA and the resistance was negligible.

The analogue 5k pot produces between 0 and 5.7v on the wiper and 5.7v across the terminals.

Can you post a diagram of how you connected to the motor controller?
Your circuit and another just the pot?

The picture of the board shows Max and Min pots, these will be in series with the positive DC voltage side and the low voltage side of the pot socket.
That way they control the pot output at Max and Min wiper travel.,

Can you please measure the voltages on the pot socket with the 5K pot in circuit.
Gnd I believe is not connected directly the socket but through the Min pot that is wired as a variable resistor.
Be careful, as you are probably aware your controller is at mains potential.
So Gnd may, and is probably not, at mains gnd.
I see AC spade terminals, but no Mains earth connection.

Tom... :smiley: :+1: :coffee: :australia:

I am aware that it has mains potential and I think you are correct, gnd may be at mains gnd. There is no earth to the individual controllers, just the metal enclosure.

If I understand you correctly, the 5k pot is just in series with the max and min pots. So what I thought I was measuring as gnd is not? Can I even do what I wanted to do - control this thing digitally?

When I connect the 5k (external pot), I measure 5.7v across the two outer terminals of the pot which are connected to the outer pins of the socket respectively. Without the 5k pot, I measure 12v. The wiper pin varies between 0 and 5.7v.

In terms of how I connected, I just connected the (measured) positive outer pin of the socket to Vin of my circuit and gnd of the circuit (what I had assumed was gnd) to the other. Vout was meant to drive/connect to the middle/wiper pin.

Motor controllers actively sense faults in the "throttle" pot - you have to connect 5k to the controller for it to arm the output. Normally you can fake the wiper potential (the controller puts a bias current on this terminal to detect open circuits, but so long as its connected to a voltage source in the range 0..5V it should be happy.

This protection stuff is essential to prevent runaway conditions if the wiring comes loose!

Thanks Mark. This was very helpful. So I have tested and you are right - it needs the 5k to "arm" the output. My issue now is how do I power the above circuit (the 4n25 side) from the controller board with the 5k in place and it still be able to provide 0-5v for the wiper?

Ok. So I have managed to get it to work using the circuit below (LM317 in place of LM78L05) . I have put 5k across the outer pins on the board. Vcc is from the +ve on the MAX POT and Gnd is connected to the -ve on the MIN POT.


My issue now is that when I disconnect the above and reconnected the analogue 5k pot to the controller, the dc output is going to 240v max when it was only going to just under 180v previously? What have I done?

With the pot connected, do you still have 0 and 7.5V on the outer pot terminals?
Have you completely disconnect all your circuit connections from the motor controller when you replace it with the 5K pot?

Tom... :smiley: :+1: :coffee: :australia: