VB6 code for Maestro USB Servo Controller


I just bought a Maestro 18-Channel USB Servo Controller and I see that there is an SDK for use with C# and Visual Studio .NET. Do you have any SDK or any kind of code that uses Visual Basic 6.0?

I’ve been reading the forums and one person gave a link to some VB6 code that someone wrote:


But, the person who made that website says it is for the Polulu serial servo controller, which I guess is an older product and not as new as your Maestro USB series. Can this code still be used with Maestro or will Maestro reject it?

I see also in your current Maestro SDK that uses C#, you also include a “USB Wrapper for Windows” which is a .DLL file called UsbWrapper.dll. Can I use VB6 to directly call the functions in this library to control Maestro or does this require a .NET language (like C#) to call its functions?


You might be able to modify that code to work with the Maestro. The most important serial commands are described here; you will need to change the specific bytes that are being sent.

You might have better luck looking for code designed for the Mini-SSC - the Maestro supports its commands exactly, so that code would probably work without modification.

By the way, in either case don’t forget to select the right COM port for your Maestro.


And don’t forget to set your Maestro to USB Dual Port or USB Chained serial mode so that it accepts serial commands from the PC on the Command Port. --David Grayson

Hello there,

I’m working with a friend on a project of a servo controlled pano head for a dslr camera.

Now the camera is already controlled by a program wrote in visual basic inside a .hta that display the interface (written in html). The program doesn’t just release the shutter of the camera, it also control most of its aspects and is based on the WIA library from Microsoft for scanners and digital cameras.

We are now trying to add the servo code, hopefully still using visual basic.

Do you know if it is possible to actually control the servo from a .hta ?

Thanks a lot for your helping newbies =)


I do not really know much about Visual Basic and HTAs, but after doing a little reading on the web, it seems like they are two different things. HTAs support a language called VBScript, which is similar to but not the same as Visual Basic. Are you sure you know which language you need to use?

A Google search for “VBScript serial port” should give you a lot of pointers on how to open the serial port (and it does seem possible), but I would not expect that example VB6 code to work within an HTA.


Thanks paul,

Do you think it would be viable to command the servos from the .hta/vbscript by sending command lines to a separate software (I think I saw one provided in the pololu usb kit) ?


We do not provide any software that can be remotely controlled the way you are describing. Also, there is no reason to think that that would be easier than just sending commands to the serial port, right?

EDIT: I did not think of using a command line program when I read your question the first time. David’s suggestion below is a good one. A Google search for “vbscript execute command” returns some results.


Can .hta/vbscript run executables on the user’s computer? If so, you can use UscCmd, the commandline utility that comes with the Maestro software. If you ran the Maestro installer you should already have UscCmd.


Thanks guys, I’ll get going with that, thanks for the help !

It took me a while to find out how to drive the Maestro servo controller via USB from VB6 (Visual Basic 6.0). Here is what I finally did to get it to work…

  1. Connect your computer to the Pololu Maestro by USB cable.

  2. Find what port is being used:
    In WinXP - Click Windows Start, Control Panel, System, Hardware, Device Manager, Ports (COM & LPT)
    Look for (depending which Maestro you have) “Pololu Micro Maestro 6-Servo Controller Command Port (COM2)”

  3. NOTE that in VB6 valid port numbers are 0 to 16 only.
    If your Pololu Maestro installs with a port number higher than 16 then you need to reassign it to 16 or less.
    In WinXP - Reassign Pololu’s “Command Port” from Windows Start, Control Panel, System, Hardware, Device Manager,
    Ports (COM & LPT), right-click, Properties, Port Settings, Advanced, then select an available COM Port Number.

  4. Start a new VB6 project.

  5. Add a MSComm control as MSComm1.

  6. Coding…
    'a) To open Port 2…
    MSComm1.CommPort = 2
    MSComm1.Settings = "9600,N,8,1"
    MSComm1.PortOpen = True 'Open the port

    'b) To set Servo 5 speed to 20…
    MSComm1.Output = Chr(135) + Chr(5) + Chr(20 Mod 128) + Chr(20 \ 128)

    'c) To set Servo 5 acceleration to 8…
    MSComm1.Output = Chr(137) + Chr(5) + Chr(8 Mod 128) + Chr(8 \ 128)

    'd) To set Servo 5 target to 1500µs…
    a = 4 * 1500 'convert to quarter micro-secs
    MSComm1.Output = Chr(132) + Chr(5) + Chr(a Mod 128) + Chr(a \ 128)

    'e) To close the port…
    MSComm1.PortOpen = False

Cheers, Dave

Hello, Dave. Thanks for sharing that! You might want to add that the Maestro needs to be configured to be in USB Dual Port mode as well. --David

Delighted to find your code Dave as I wanted to control my servos from my VB6 program but despite setting the port correctly, copying your code, I cant get the servos to respond. Any ideas?


Are you able to successfully control your servos using the Maestro Control Center software? How are you powering them? Is your Maestro configured to be in USB Dual Port mode?


David - my servos are powered from 4 x AA cells connected to the micro maestro. The maestro is powered from the USB port. The servos do work from the maestro control panel and I have changed the serial mode to dual ports and saved the configuration. I’ve also downloaded the pololu serial sender and sent 4 byte code 132,5,112,46 and this moves the servo connected to channel 5. I’m running XP with service pack 3 and also Visual Basic 6 that I’ve used for years successfully for serial communication controlling display units in my work so I’m at a loss. The green light on the board flashes when I send the code from vb using the line “MSComm1.output = chr$(132) & chr$(5) & chr$(112) & chr$(46)” but nothing else happens.

EEEEEEEEK! it is working! I changed the port so this info might just be useful…

In DEVICE MANAGER there are two ports showing connected under PORTS (COM & LPT) as:
Pololu Micro Maestro 6-servo controller command port (COM 4)
Pololu Micro Maestro 6-servo controller TTL port (COM 5)

so the port that must be selected is the COMMAND PORT and NOT the TTL one.

silly me but I didn’t notice there were two ports open…


I get exactly the same. i have done all above but the servo does not respond? What must the MSComm1 control settings be?

Private Sub Form_Load()
MSComm1.CommPort = 11
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True 'Open the port
End Sub

Private Sub Command1_Click()
a = 4 * 1500 'convert to quarter micro-secs
MSComm1.Output = Chr(132) + Chr(1) + Chr(a Mod 128) + Chr(a \ 128)
End Sub


Your COM port settings look fine to me. However, from the information given I cannot verify that the port you are connecting to (COM11) is the right one.

In your earlier thread, you wrote:

Have you changed anything about your system since then? Are you able to control the servos using the sliders in the Maestro Control Center?