Variable voltage controller w current sensing

The animatronics project I am working on has several 12v 2a motors that need to be controlled from arduino.

I'm looking for someone to help to accomplish these.
The budget is not very high, but this project is paid.

  • I would like to avoid using PWM because it produces noise on the motors I have to drive.

  • 2 or 4 channel DC output approximately 2-24v up to 2amps each.

  • Ability to control voltage and polarity.

  • Each channel needs to have current sensing. Not just stall detection. I need to be able to control the speed of each motor depending on current load.

  • This circuit needs to work with 3v version of arduino.

Ideally, I would buy a ready made controller to accomplish this, I would pay for finding it.

Please message me with a rough quote.

Welcome to the forum.

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

Have you tried PWM?
Depending on the controller you are going to use, you can change the PWM frequency.

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

Tom, thanks for replying. Yes, I have PWM working, but the motor is on a gearbox and modulation is causing the whole thing to be jittery, noisy, not smooth. And it needs to rotate both ways. The same motor is quiet under a constant voltage.

Can you give a link to the motor spec please?

What is your strategy for determining the position of whatever the motors are moving?

Could you use a relay to reverse the motor connections?

I don't have specs for this motor. It's unbranded 12v cheap motor with a gearbox. The motor is whisper quiet when applied partial voltage from an analog power source.

There's no need to determine position, it's time based. I need to be able to fake acceleration, deceleration and direction in code. And be able to respond to a current spike - decelerate quickly, not just shut off. The whole thing need to be smooth.

I can use relays as long as they are not making clicking sound.

I think at this stage we need;

A circuit diagram, including power supplies.

Your code.

A picture of your motor-gearbox.

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

ARDUINO NANO 33 BLE connected to this controller:

const int IN1=5;
const int IN2=4;
const int ENA=6;

const int IN3=8;
const int IN4=7;
const int ENB=9;

const int ledPin = LED_BUILTIN; // pin to use for the LED

 float motorMin = 0;
 float motorMax = 0.3;
 float motorStep = 0.002;

  mbed::PwmOut pin( digitalPinToPinName( ENA ) );

void setup() {

  pin.period( 50 );  // <-- frequency as 1/freq.    60Hz is 1 / 0.01666666667
//  pin.write( 0.5 );

   pinMode(IN1, OUTPUT);
   pinMode(IN2, OUTPUT);
//   pinMode(ENA, OUTPUT);   
   pinMode(IN4, OUTPUT);
   pinMode(IN3, OUTPUT);
   pinMode(ENB, OUTPUT);
  // set LED pin to output mode
  pinMode(ledPin, OUTPUT);
  pinMode(12, OUTPUT);

int pass = 0;

void loop() {
    bool direction = ((pass++ % 2) == 0);    
    for(float speed = motorMin; speed < motorMax; speed += motorStep) {
      if (direction) {
       Serial.print("Forward speed: ");
      } else {
       Serial.print("Backward speed: ");

    Serial.print("loop pass--- ");

void Motor1_Forward(float speed) {
     //digitalWrite(ledPin, HIGH);
     analogWrite(ledPin, speed * 255);
     digitalWrite(12, LOW);
void Motor1_Backward(float speed) {    
     analogWrite(ledPin, speed * 255);
     digitalWrite(12, HIGH);

HAve you tried different pwm frequencies? At high f's the motor may act a bit like a speaker, and at low f's will vibrate. You should be able to find a frequency range where it is quiet. PWM is def the way to go for motor speed control unless you can measure the current, speed or position and use feedback as motor torque drops dramatically with applied voltage.

Also I dont believe your driver board supports variable voltage control

I think you're asking for something contradictory: speed control based on current. Current feedback is typically used to control torque not speed. That aside, it's going to have to be custom built: as you've probably found, the "hobbyist-friendly" off the shelf boards have current limiting, not current feedback control. So you need something that can read the current load and use that as a feedback element to vary ... what? The voltage/duty cycle input? That will result in torque control, not speed control.

FWIW, the lowest-cost computer-controllable motor drives that use current feedback that I can think of are made by amc (Advanced Motion Controls). They offer Modbus RTU or Modbus TCP (and maybe USB) interfaces. I did a project with one of them about 2 years ago and I may be able to find a part number if you're interested, but ISTR that a single axis will be around $500 and you'll need an appropriate motor. However, it will cost much less than having someone capable design a controller for you.

I am basically looking for a spike in current usage for a given speed - a stall or a near stall. And it can be a second delayed. I understand that making a motor move faster will require more current and reading current load will give different values depending on the speed. But I can compare current reading with an approximate normal reading inside Arduino code, I will have to have a set of values, specific to the motor. Any reading above these expected values (interpolated) is a stall. Will this not work?

Let's back out a bit and ask a more basic question. Are you trying to control motor speed or torque?

I think my problem is the code. It has delay(...) and it could be causing the jitter. I don't have the correct PWM code. I think I need to go back to code and remove the delay lines, and figure out how to up the frequency above the audible range. Thank you for pointing me in the right direction!

Have you written a simple and nasty PWM code, using to Arduino's PWM commands.
For just ONE motor.
Nothing flash just make the motors run, see if you then have noise.

And I mean a REALLY simple code...
Nothing else in it, just motor run code.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:
PS, Look at the data for your Nano 33 and see what pins have what default PWM frequency.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.