Need help with my PWM motor controller

Hello Arduino world,

I need some help on a PWM motor controller that I want to use for a project. Specifically it is the PWM Motor Controller 3A 12-55V from Superdroid Robots. I have the motor inputs figured out and I am testing with a 12 volt battery, using a 24v motor (it just runs slower).

In the testing phase, I hooked a potentiometer to run the motor one direction, varying the speed.

Hookup: Arduino:
Pot center Analog – 0
Pot lead (L) 5v
Pot lead (R) Ground

Motor driver board
Pin G Ground
Pin P (PWM) PWM – 3

Code:

int potpin = A0;
int val;

void setup() {}

void loop() {
val = analogRead(potpin);
val = map(val, 0, 1023, 0, 225);
analogWrite(3, val);
delay(15);
}

Everything worked great with no problems…but as I move forward I am having problems and my searches have me going in circles.

There are 4 IO pins on the motor controller board.
D-direction (0V and 5V will change the direction of the motor)
P-PWM (used in test)
B-brake (0V to the brake will turn the brake off, 5V will turn it on.)
G-Ground (used in test)

I was able to put 5v on the direction pin and the motor would change direction.
I was also able to put 5v on the brake pin and the motor would stop.

Easy enough to add some switches and use the brake and direction feature of the motor controller, but both the break and direction changes are to abrupt.

In a book I have it discuses; “Bi-directional Analog control: Uses a 0-5v analog (or PWM) signal to determine the speed and direction of a motor. In this mode, the center position of 2.5v is considered Neutral. Below 2.5v spins the motor proportionally in Reverse with a0v value yielding 100% Reverse. Above 2.5v spins the motor Forward with a 5v value yielding 100% Forward—this is called “Analog.” “

So I am looking for some help ---- use a potentiometer with my motor controller, for speed control and forward/reverse, as well as using the break input as a kill switch but have the motors slow down to 0,

Thanks
Chris

First, there's a big difference between "brake" and "break".

Lot's of ways of skinning this cat.
Take an analogue reading from your pot.
It will return a value in the range 0..1023.

Half this range is 0..511 and 512..1023, but you probably want a dead-band around the middle of the range, say from 500 to 520.
So, numbers below 500 sets REVERSE for the motor, and a count of zero sets a speed of 100% (the "map" function makes things easier here) and 499 sets a speed of 0%.
Numbers above 520 sets FORWARD, and 520 is a speed of 0% and 1023 is a speed of 100%.

100% is "analogWrite(speedPin, 255)"

OK, on the brake.
do you know if I will need to use the direction pin on the motor controller?

do you know if I will need to use the direction pin on the motor controller?

If you want to change the direction of rotation, yes, I think you probably do,

Thanks