Page 1 of 1

### Voltage to Current board

Posted: Tue Jan 23, 2018 2:08 am
Hello
I am working with Raspberry PI 3, and I am using two DC motors. DC motors need to be run at a specific torque, and torque is proportional to current. I cannot send current to DC motors from Raspberry PI directly. I already have all equations of DC motors and how to convert torque to current. I need a board that is compatible with Raspberry PI to be able to send current to motors. Is there any board like this?

Thanks

### Re: Voltage to Current board

Posted: Tue Jan 23, 2018 4:35 am
Tue Jan 23, 2018 2:08 am
Hello
I am working with Raspberry PI 3, and I am using two DC motors. DC motors need to be run at a specific torque, and torque is proportional to current. I cannot send current to DC motors from Raspberry PI directly. I already have all equations of DC motors and how to convert torque to current. I need a board that is compatible with Raspberry PI to be able to send current to motors. Is there any board like this?

Thanks
And current is proportional to voltage and inversely proportional to resistance.
So when voltage is applied to the motor the motor takes the current it needs and provides torque which remains constant provided the resistance (and voltage) does not change.

Most use motor driver boards attached to the RPi and an external power supply. Motor direction can be controlled as well as speed by PWM.

Google [raspberry pi motor control] to find dozens of motor controllers and hundreds tutorials and examples.

### Re: Voltage to Current board

Posted: Tue Jan 23, 2018 11:08 am
klricks wrote:
Tue Jan 23, 2018 4:35 am
And current is proportional to voltage and inversely proportional to resistance.
So when voltage is applied to the motor the motor takes the current it needs and provides torque which remains constant provided the resistance (and voltage) does not change.
Aye. And there's the rub.*

A motor isn't just a resistance, it's also a generator.
If it's kept stationary, current will be proportional to voltage (neglecting the inductance of the windings) but as soon as it starts turning, it generates a voltage proportional to its speed.
So the voltage required to maintain constant current (and therefore constant torque) will vary depending on it's speed.

I've no idea where (or whether) you can buy the requisite driver board.
However, you have a couple of options.

One is to use a linear constant current source such as a LM134, or maybe a LM317 regulator connected as a linear constant current source.

Another is to put an ACS712 in series with the motor to measure the current and so control the voltage in a feedback loop (but be aware of the problems people seem to have with these! viewtopic.php?f=63&t=203012)

*Hamlet, misquoted.

### Re: Voltage to Current board

Posted: Tue Jan 23, 2018 12:27 pm
What kind of motors? AC/DC? Brushed/brushless? There are many to choose from https://en.wikipedia.org/wiki/Electric_motor

What power are we talking about? What voltage?

More details would make more concrete advice possible.

People don't generally control current or voltage to control motors. At least not directly. That is going to lead to an inefficient solution producing more heat than work.

Rather the voltage is kept constant and it is switched on and off rapidly. The more time it spends on the power power goes to the motor. This is Pulse Width Modulation, PWM.

For many small motors you could use an ElectroniC Speed Controller (ESC) as used in model cars and aircraft. https://en.wikipedia.org/wiki/Electronic_speed_control

There are many H-Bridge boards available as well. https://www.sparkfun.com/products/9670

Do you really need to control torque? Generally people control for speed or position.

### Re: Voltage to Current board

Posted: Tue Jan 23, 2018 7:46 pm
Thank you all for your responses.
I want to use DC motor. I want to balance a ball on a plate, and for that I need to control torque. You may say that a lot of people built that system and didn't need to control torque. My controller is different(It's a nonlinear controller). All those people used PID and I know how it works. It doesn't need torque.
In my controller I derive torque, then I send it to the motor. My motors are currently 12V DC(https://www.pololu.com/product/2826/faqs). I use PWM signal currently, but I don't know why it doesn't stabilize the ball. Ball goes from one side of the plate to another while it is supposed to be stabilized at the center. I spent so much time on it. It maid me to think about changing motors, or motor driver(https://www.pololu.com/product/1213), or even try finding a way to control current instead of voltage(PWM).
Somebody said voltage is proportional to current. It's true if you do simplification on the motor dynamic model.

Anyway, any help or idea greatly appreciated

### Re: Voltage to Current board

Posted: Tue Jan 23, 2018 8:55 pm
Seems to me that if you really want to measure the current then you can just do it in the standard way. Put a small value shunt resistance in series with the motor and measure the voltage developed across it. Ohm's law gives you the current. Something like 0.1 ohms between motor and ground should do. Make sure it's hefty enough not to warm up appreciably.

The inductance of the motor windings is going to act as a filter. You may need more filtering in the measurement circuit.

Now you can control the PWM to get you the current you want to command.

### Re: Voltage to Current board

Posted: Tue Jan 23, 2018 10:29 pm
You can make (or easier still buy) voltage controlled current source http://www.linear.com/solutions/4475 for example.
However, I'm not sure that it will solve the undelying problem of why the ball wont stay in the middle.
I would suggest that you:
A cheat (put a magnet under the plate)
B examine your feedback system and algorithm.
You may find that this is a case where the time delay through sensor->Pi->motor is a bit slow and cannot respond fast enough....

### Re: Voltage to Current board

Posted: Wed Jan 24, 2018 4:46 am
A linear current source is going to be inefficient and get rather warm. Controlling it is going to require a DAC.

I'd be interested to hear how the proposed control algorithm should work. In outline at least. It's not clear to me how measuring/controlling motor torque could help.

Presumably the motor torque could be inferred from the plate velocity/acceleration. That sounds rather hard.

Sounds like the difficulty in control lies with the "non-linear" part...