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

Pololu Forum

Controlling Maesto from Excel (VBA)

#1

Hello,

I am new to this matter of robotics and modern RC-controllers. I want to control a servo from Excel with VBA. But I did not find any example how to do. I think I need a USB-Serial-DLL. Or something other. And I need the VBA-commands to use it. My Maestro works under W10 with the included control-interface. Therefore its is all ok on the hardwareside. But the controlling from Excel is my problem. I have written Excel-scripts for reading digital-voltmeters years ago under WIN-XP. But this was on real RS232-COM with rsapi. Can anyone help me please. Please use simple english speeking that google translator will understand.

#2

Hello.

Why do you want to control your Maestro from Excel?

You probably would need to install some module that uses the Windows API to communicate with the Maestro’s Command Port. If you are building a user form, you could try using the Microsoft Communication Control component to add serial port control. Once you implement serial support in Excel, you should be able to send commands from your macro(s) to the Maestro. If you do not already know, you can find all the serial commands available for the Maestro under the “Serial Servo Commands” section and “Serial Script Commands” section in the Maestro’s user’s guide.

- Amanda

#3

Hello,

I know, that I need a “modul” for serial USB-communkation. But I don’t know what to take for a USB-Connection. Therefore my special question.

The commands are not the problem. I hoped, that anybody has a little EXCEL-example how to do.
I found a lot of examples in different programming languages. But not for VBA

#4

I am sorry, but we do not have any VBA code examples showing how to interface with the Maestro, and we have not heard of others trying to use Excel to control the Maestro. Since it sounds like you are asking how to set up serial port communication in Excel, you should probably post your question on the Excel Forum (if you have not already), as it has a much larger community that focuses specifically on VBA programming for Excel.

- Amanda

#5

Hello,

I know how to do serial communication from Excel. This is not my first project. I hoped for working solutions for the Maestro. Now I am working on my own solution. I can connect to Maestro and send commands with MSCOMM to my servo now. But there are still a lot of problems I have to fix. For example when sending of 2 “targets” to fast the servo runs away. Or MSCOMM hangs and blocks Excel.

Ok - I will spend a lot of more time to do testing and trying :frowning:

Thanks for “help” :slight_smile:

#6

I’m glad you have something working in Excel to interface with the Maestro.

Regarding your “running away” issue, if you are sending multiple Set Target commands to one servo channel and want to make sure the servo responds to each command, you should consider using the Get Moving State command or Get Position command to help determine when your servo has reached the expected target position before sending the next Set Target command. You can find more details about those commands under the “Serial Servo Commands” section of the Maestro’s user’s guide.

- Amanda

#7

Hello, the problem “running away” was electrically caused. I soldered a “fat” condenser direct to the servojumper powerpins on the bottomside of the maestro.

One new problem: I have often occurringErrors (Red LED) even when I do nothing! Script stopped and port closed. My USB-Tester shows sporadic bytes coming from Windows (?) even if the port is closed by my script.

#8

With the Maestro’s red LED on, can you run the Maestro Control Center and post a screenshot of the Errors tab showing all the errors the Maestro is reporting? Why do you think you are getting sporadic bytes and that they are coming from Windows? What bytes are you seeing? Can you provide more details about your “USB-Tester” (e.g is it a device or program and how does it work)? It would be helpful if you can provide as much relevant detail as possible about the issue and your setup (e.g. pictures and script).

- Amanda

#9

Hello, this is always error 0x0010. This erros occur even when I do not use the Maestro. It is connected and connected to powerer. But not in use

Windows or a driver/programm etc. periodically sends commands on all available ports. This behavior is known since Windows exist. With WIN 95/98/XP, WIN 7 and WIN 10 on many differnet computers and laptops.

I had a lot to do with serial communication and measurement equipment in my job. And we had a lot problems with measurmentmachines and euipment because of these “phantomdata”

In my new Excelmacro für controlling the Maestro I clear the errorstatus before each normal command. And I clear it after each command. The errors are not caused by my macro!

Some minutes after the last command the red led stays off. And suddenly without using my programm it goes to red error. The green data-led flickers sometimes.

My serial tester (hardware) show the sporadic datas on the TX-Line too when I replace the maestro with the tester.

Windows or the driver does not activate the serial-statuslines! Only sends pulses on TX. I think the behavior occurs because windows or a driver is checking if new hardware is available.

And the maestro accepts and receives these pulses even when the statuslines are in off state. And these pulses brings the comm-error

#10

The 0x0010 error you are seeing in the Maestro’s software indicates a “Serial protocol error”. We have never noticed Windows sending “phantom data” to serial devices, but if you are convinced that it is the source of the problem then you might consider setting the “On startup or error” setting for all your channels to “Ignore”. That way whenever an error occurs, the Maestro will not change its current actions for those channels.

- Amanda

#11

Hello,

it is a fact, that windows sometimes sends pulses on TX and DTR even if no software using the port is running!

You can see it on every windows-machine with a simple LED-Tester.

It occurs on a normal “old” hardware-comm and even on “modern” USB-Serial-Ports!

I see in this moment on my tester: ( I made a video! )

1: sporadic pulsing DTR high and going low again

2: Rising DTR, sending some pulses on TX and afterwards DTR goes low again

3: Sporadic pulses on TX without rising any statuslines.

These effects make many trouble since I work with serial equipments. (more than 20 years)!

Case 1 normaly has no negative effect.

Case 3 normaly has no negative effect. Without DTR=high most intelligent instruments ignore TX-Datas. But simple 3-wire-connected (TX-RX-GND) devices may be disturbed!

And case 2 brings errors to nearly all devices! The device receives TX-datas and can not interpret or does not understand. -> Protocoll-Error!

This happens on my maestro. I close the connection after resetting errostatus. No RED-LED! In a time of 1 to 10 Minutes the green LED-flickers sometimes. In most cases the red error-LED goes on!

I have set alls ports to “ignore” and my equipment works. But this is a workaround.

If somebody is interessted in how I work with Excel, finding the COM-Port-Adress via VBA and controlling my maestro via Excel I can post information.