Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Mini Maestro 18 Channel and DC Motor Driver: PWM Scripting

I have a Mini Maestro 18 Servo Controller that I am trying to use in conjunction with a DC motor driver. This model in particular has 3 pin options for motor control: Forward, Reverse, and Speed (via PWM input). I connected forward and reverse into channels 0 and 1 on my Maestro, speed into channel 12, and placed all channels in output mode. I’m able to create a script in the Maestro Control Center using the sequence tab to make the motor move backward and forward without any issues. I was also able to modify the speed by checking “enable PWM on channel 12” and changing the on time and period values. What I can’t figure out is how to add these values to my script. I’ve read through the example scripts on your website, but still need help. Posted below is a simple test script that was copied from the sequence I am using, in which the motor is in standby for 3 seconds, rotates forward for 3 seconds, and then goes into standby for 3 seconds. Could you please show me how to assign a predefined on time and period value to this script, sent through channel 12? Thank you so much in advance!

# Sequence 0
  3000 3986 3986 0 0 0 0 
  0 0 0 0 0 0 
  3986 0 0 0 0 0 frame_0..17 # Frame 0
  3000 8000 frame_0 # Frame 1
  3000 3986 frame_0 # Frame 2

sub frame_0..17
  17 servo
  16 servo
  15 servo
  14 servo
  13 servo
  12 servo
  11 servo
  10 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo

sub frame_0
  0 servo

Hello, CS20.

You can use the PWM script command to control the PWM output on pin 12. As mentioned in the “Command Reference” section of the Maestro user’s guide, the period specified by the top element and the on time specified by the second element (both in units of 1/48 μs). For example, with the default period of 2.9 kHz (i.e. a period of 16320 units), the command 8160 16320 PWM will set the duty cycle to 50%.


Thank you so much BrandonM, this worked!

1 Like