I just got back from vacation, and that left me with some tech-support catch up to do. I had a customer ask about some of our PID tuning software for the Motion Mind 3 motion control module which is pretty out of date.
The original software was written quite a few years ago in VB6.0. Rather than update it I decided to add some charting functions to some of our newer software. In this case our Motion Mind 3 ASCII test software. This software implements the ASCII protocol and as such is slower than the binary protocol. But it does give the user access to all of the product’s features and therefore was a good framework to start with.
PID tuning is complicated. How well you do it depends on your understanding of your mechanical system as well as the motor controller you’re working with. It’s really not possible to create a PID tuning piece of software without forcing the customer to develop a mathematical understanding of their system. And honestly, most of our customers don’t need that depth of understanding.
But a quick visual indicator of how their system is responding can be very useful, and allows the “trial-and-error” method of tuning to succeed.
For our ASCII test software we use a round-robin style of serial communication. The more registers you select the longer it takes for each register’s content to update. When using the new charting features you’ll get the fastest updates with the fewest number of registers selected. You can select individual registers you want to read be checking a check-box next to the register name (see example below). 6 of those registers (underlined in red) will chart their values if they are selected via the check box.
In the case of this example we are using analog closed-loop operating mode with the FUNCTION.ENCFBCK bit set. With these settings the controller will use an analog control signal to establish a desired position (control), and use an encoder attached to the module as the actual position (feedback).
Charting controls allow you to adjust the y axis maximum and minimum values. You can also clear the log of sample data, stop charting (which also stops recording samples), and save the logged data to a text file to open in another program (like Excel).
The chart above shows a sine wave control signal, with a 5V swing centered at 2.5V. The frequency is 300mHz and the motor I’m using has a 218.4:1 gear ratio and a 500CPR encoder.
Using the charting function of the test software you can see visual indicators like the overshoot shown in this attempt to follow a saw-tooth control signal (top chart). Enabling velocity control removes the overshoot and any associated ringing, and the result of velocity control is shown in the bottom chart.
Chart data is stored in an array and can be copied over to a text file by selecting the Stop Charting checkbox, and pressing the “Save Logged Values” button. You can then open the comma delimited file in programs like Excel for charting. An example is below.
The installation file for this modified software can be found at this web location…
The Visual Studio 2010 source code may be found here…