Problems interfacing Arduino with two motor controllers

Thread Starter

arlinjv

Joined Jan 19, 2019
3
I have two brushless motor controllers (Kelly KLS-N line) that I want to control with a single input. This can be done easily with a dual pot, keeping the two controllers completely isolated. However, I would like to be able to use a microcontroller to interface with the controllers and for that purpose I am using a MCP4251 dual digital potentiometer to interface with the controller throttle input. (The throttle input is designed to be interfaced with a potentiometer wired to provide a voltage between 0 and 5 volts.) The Arduino is a 5V Pro Micro and powers the MCP4251.

I initially built a circuit with the three systems completely isolated (Arduino, controller A, and Controller B) naively thinking that the digital pots were isolated (I now know better). The result was the MCP4251 put out a intermediate value regardless of input and got quite hot.

Now I have provided a common ground for the Arduino and the controllers. The MCP4251 no longer gets hot, but only one of the outputs works at one time: both pots get 5V from their respective controllers but only one pot puts out the expected voltage, the other pot stays at 0v.

Another thing I noticed is that though the pots work fine (provide the same resistance) before the motor controllers are connected, once I connect the unpowered controllers to the circuit the output resistance drops significantly. (It's as if the 5kOhm output becomes a 3.5 kOhm output.) Once I power the controllers the above described problem kicks in.

Thoughts?
Is there a way to make this work or am I simply on the wrong track trying to use a digital pot for this purpose?
 

MrChips

Joined Oct 2, 2009
26,145
That's a lot of words to describe something that would be better described in a schematic.
Circuit schematics is the language of electronics.
Please post a circuit schematic.
 

Thread Starter

arlinjv

Joined Jan 19, 2019
3
Here is the relevant part of the schematic. At this stage all the Arduino does is mirror the potentiometer output value onto the digital pots. As mentioned above the circuit works fine on its own. It is when I connect to both motor controllers that the problems arise. 'kls connections.png' shows the wiring coming out of the Kelly controller. I also attached the whole schematic but it's pretty cluttered.

Arduino and MCP.png
 

Attachments

Sensacell

Joined Jun 19, 2012
3,001
I would not bother with the digital pots.

Use PWM direct from the micro, filter and buffer it to a 0-5V DC level for the speed controller.
Connect the grounds together- DO NOT connect the 5V from the controllers- leave that alone.

The problem now perhaps is that the +5V from the controllers are different slightly, causing the unwanted current flow in the digital pots.
It might help to connect the pot pins 7 and 8 to Vcc, eliminate the external 5V connections
 
Last edited:

Thread Starter

arlinjv

Joined Jan 19, 2019
3
Awesome. That gives me a lot to work with.

I think you're right about the +5V differing slightly. Vcc out of the Arduino is a bit under 5V. I'll try switching the 5V connections to Vcc as a quick fix but dropping the digital pots is appealing - they are definitely not as simple as I thought they were!

If I go with buffered PWM, can I get away with a simple op amp follower? And does it matter whether I power it from the Arduino or the controllers?

I would not bother with the digital pots.

Use PWM direct from the micro, filter and buffer it to a 0-5V DC level for the speed controller.
Connect the grounds together- DO NOT connect the 5V from the controllers- leave that alone.

The problem now perhaps is that the +5V from the controllers are different slightly, causing the unwanted current flow in the digital pots.
It might help to connect the pot pins 7 and 8 to Vcc, eliminate the external 5V connections
 

RPLaJeunesse

Joined Jul 29, 2018
213
If you want/need to buffer the filtered PWM with an op-amp follower you will need to use a part that has both input and output rated for "rail-to-rail" use. The Microchip MCP6021/6022 is such a part (but it is fast, use a 0.1uF ceramic VCC-GND bypass cap tight to the part). Be aware that due to (stray) capacitive loading any buffer amp may not like driving direct into a wire much over 6 inches long. If possible use at least 100 Ohms between buffer output and any noticeable wire off to the next stage. I would power the buffer from the Arduino 5V supply. But be careful to not drive the PWM above zero (0) if the downstream device is turned off. That means monitoring the throttle 5V supplies with the Arduino and combining them logically. Do not connect the throttle supplies direct to the Arduino digital input pins, instead use maybe 10K Ohm resistors in series at the Arduino.

You should also use a maximized PWM frequency (See https://arduinoinfo.mywikis.net/wiki/Arduino-PWM-Frequency) so that your filter RC circuit doesn't need really large values with a corresponding slow response. As a rough rule of thumb: for an N-bit PWM the filter corner frequency (Fc=1/(2*pi*RC) ) should be no higher than the PWM frequency / 2^N. For example an 8 bit PWM at 32Khz should have a filter corner at 125Hz, or roughly 13K Ohms and 0.1uF.
 
Top