How To - Martinez Brushless Gimbal Controller Set-Up
|The V3 Martinez Board|
This article is an attempt to organize the information necessary to successfully set-up the Martinez Brushless Gimbal Controller.
The scope of this article covers basic set-up information gathered using Martinez V3 and RCTimer V1 gimbal controllers equipped with an FTDI driver chip and using a Win7 PC.
Information, Software and Files
Since the Martinez board is an open source development project there are often new Firmware (FW) updates available so you will want to be able to upgrade your board. Additionally, not all boards are shipped with current (or any) firmware so you may need to upload firmware upon receiving your board.
Please download the Martinez manual and read through it carefully before starting. While it is a bit dated, it does have some good information you may need.
You can also find information on these RC Groups forum threads:
There are many more places to get information but these have served me best.
This is a BGC1.0/2.0/2.1 copy of a SimpleBGC (BaseCam Electronics) design. From a component standpoint there is a difference in that this board uses a Silicone Labs (Silabs) CP2102 USB controller chip which means you must have the Pololu Silabs drivers to communicate. These boards are usually blue or black in color.
In the RCGroups forums this board has been the subject of many complaints because the sellers are calling it a Martinez V3 board and providing FTDI drivers to communicate and this simply does not work. Additionally, many of these boards are coming with a "Nulled" version of the SimpleBGC software in a "Locked" state so updates and in some cases PID tuning is impossible.
NOTE: If you have one of these boards, you cannot use the driver installation procedure shown on this page. Additionally, if the board has the "Nulled" (hacked) version of the Alexmos SimpleBGC firmare, the tunning guide also does not apply.
This is the RCTimer V1 board which has been available since March 2013. It shares the components of the Martinez V3 board including the FTDI USB controller chip. In most cases this board needs the FTDI 2.8.24 Windows driver (below) to communicate. It is a well designed copy of the original V3 board and comes completely pre-soldered with all the pin-outs needed. The board color is green.
This is the Martinez V3 board which is the board the open source Brushless Gimbal project is based on. Like the RCT board it is built with the FTDI USB controller chip. It too needs the 2.8.24 Windows driver and in some cases folks have posted they had to go to the 2.8.14 driver to successfully communicate. The board is distinctive with the "by Martinez" printed across one corner and "FPV Community" printed on one edge and generally do not have all the pin-outs soldered in. The color of these boards can be red, blue, black and gold.
Step One - Drivers
This How-To is assuming you have a Windows PC. To be successful your PC will need the correct FTDI driver installed. The driver which has worked best for my boards and set-ups is the FTDI COM driver 18.104.22.168. If you have 22.214.171.124 or higher these might not work.
If for some reason 126.96.36.199 still doesn't you might try 188.8.131.52 which some have reported success with. Here are the links for these driver files:
To load either of these older drivers follow these steps in order:
- 1. Disconnect your internet to prevent Windows from auto fetching the latest driver
- (Keep it disconnected from the internet until the board is working correctly)
- 2. Plug in your board
- 3. Go to device manager
- 4. Go to View and select "show all the hidden devices"
- 5. Expand "Universal Serial Bus Controllers" and "Ports (COM & LPT)"
- 6. Right click "USB Serial Converter" and select "Uninstall"
- a. IMPORTANT! Also check the box "Delete the Driver software for this device"
- 7. Right click "USB Serial Port (COMx)" and select "Uninstall"
- a. IMPORTANT! Also check the box "Delete the Driver software for this device"
- 8. Close all windows and re-start your system
- 9. Connect the board to USB and look for the warning that there is no driver for this device
- 10. In Device Manager, update with the driver that you have downloaded
- (On some computers you may need to reboot the system)
- 11. Plug in the board, go to Device Manager and check to see the correct driver has been installed and the COM port is a number below 9
Once you have the driver installed you are ready to begin upgrading and tuning.
Step Two - Software
You will need Arduino software to upload the FW to the board. Details on how to do this can be found on the Arduino site and many other forums. The following link will take you to the Arduino download site:
Download and unzip this into a directory on your desktop or other convenient location.
Now you will need the current FW to load to your board, it can be found at the link below. The files are contained in a single download:
Download and unzip this package into the same directory that you put Arduino in. Really it can go anywhere, this is just a convenient place.
To prepare for the Arduino firmware upload:
Key Arduino settings
- Board Type - Arduino Pro or Pro Mini (5V, 16 Mhz)w/ ATmega328
- Programer - USPasp
Battery power is not required if you follow these steps (in order)
- a. Disconnect the motors
- b. Connect to USB
- c. Start Arduino and select the COM port assigned to your board
Step Three - Tuning
I put this tuning guide together after much fiddling and even more forum reading and it will be updated anytime I feel there is improvement in these methods. This outlines how I get close to a final tuning solution. Note that there is generally more follow-up fine tuning needed for perfectly smooth video.
Important Things to Note:
- Gimbal Motion – It is critical that all movement of the gimbal components are completely unrestrained. That is, perfectly smooth with no resistance.
- Balance – Your gimbal, with camera installed and all cables connected must be balanced near perfectly. That is, without any power applied, if you move the camera to any position, it stays there and does not “fall over” (side to side or front to back). It may move slightly due to magnetic motor "cogging" and this is acceptable.
- Cable Routing – All motor, IMU and/or video cable routing must be free from applying any tension (pulling) on the gimbal across the full range of desired motion. It takes very little cable resistance to throw the gimbal balance off and cause bad behavior.
- IMU Mount Method – The mounting method of the IMU board is very important. It cannot be loose or free to vibrate as this will play havoc with the sensors. The recommendation is to mount it with machine screws solidly to the top or bottom camera plate. Many people also find that high quality servo tape ([U]not[/U] standard 3M double sided foam tape) works fine as well. Never use Velcro (hook and loop).
- IMU Mounting Orientation – With the default Martinez/BruGi software settings, the IMU board (the really small one) is mounted such that the “X” arrow shown on the board component side is pointed forward and the “Y” arrow points to the right side. This means the components will be on the downside of the board. You can swap the X-Y orientation or the Z/-Z orientation in the GUI if you want to mount it differently (but still horizontally). NOTE: Not all IMU's are created equally! Some have the X/Y directions printed on them and some do not. Please see "Motor Direction" section below for more information.
- Drivers – All necessary drivers must be installed and functioning correctly. On Windows PC’s, the 2.8.24 driver is the most common working driver (see driver section above).
- Connection Sequence - For "Live" tunning always follow this sequence:
- 1 - Connect battery power
- 2 - Connect USB
- 3 - Open GUI and click "Connect"
PWM AND PID Set-Up
PWM & PID Value Definitions
PWM is a direct multiplier of how much power to provide the motors by the controller from the battery. Higher usually means better performance especially for erratic flying and or harsh conditions but also means more heat on the motors. This value should be no higher than what is required for stability. Always check your motors for heat when tunning and lower this value if necessary.
P can be best described as torque used to move the gimbal. Heavier cameras need more torque. This is also directly related to power as you can only provide as much torque as you have overall power to the motor. Aggressive flying also needs more P to overcome inertia. More P is generally needed on the roll than the pitch as the roll generally has to move more mass than pitch.
- Low P can result in twitching, intermittent or steady motor hums, and inability to maintain gimbal orientation during maneuvers
- High P can result aggressive oscillation, overheating, Loud steady motor hums.
I is the span in time data is sampled and averaged for leveling, This will be different for every gimbal set-up depending on how well balanced and how aggressivly you maneuver. The better balanced the props & motors and the smoother the flying the lower "I" will be and thus the more accurate the assumed horizon will be.
- Low I can result in twitching especially in unbalanced setups
- High I can result in horizon drift and lack of ability to maintain levelness
D is the speed in which a correction is applied to return to level. This is also the speed used to apply manual roll and tilts.
- Low D can result in the gimbal not being able to keep up during extremely fast maneuvers and being slow to return to level.
- High D can result in the gimbal "overshooting" level when attempting to return to level and can result in rather aggressive oscillation
So to sum up, when a deviation for level is detected over I amount of time, P force is used to return it to level at a rate of D.
PWM & PID Tuning
This write-up started with a tuning method written on the google project site were all the Martinez code can be found. It should work on any software/board providing you understand there may be differences in the values and/or percentages.
Motor Direction - DO THIS FIRST
Motor direction can be difficult to understand and adjust in the BruGi set-up but it is important. Many have commented they cannot see any difference if they change the motor direction in the GUI or by reversing two motor wires. For the most part this is true if you don't know what to look for and even if you do, it still can be very difficult. This is one feature of the Alexmos system that really shines because they have provided an automatic solution in their GUI. This "AUTO" button for motor direction simply moves the gimbal in the positive X and Y direction and compares this to the response from the IMU. If there is a mis-match, it automatically reverses and saves that motor in the GUI.
To see the differences you must first know what IMU direction is positive and negative. Here are the IMU sense directions that will show on the trace chart if your IMU is mounted correctly:
- Gimbal roll has positive rotation to the right
- Left mounted Pitch motor has positive rotation tilting back (looking up)
- Right mounted Pitch motor has a positive rotation tilting forward (looking down)
So with this information you can start the trace chart in the GUI and roll the gimbal to the right. If the chart line for roll jumps "UP" and the green value gives a positive value, this is correct. Repeat with Pitch, tilt the camera back (look up) and the chart line for pitch should jump up, again, positive and correct. If these values don't follow this scenario then the IMU is mounted incorrectly and should be re-mounted.
This is where everyone seems to get a bit lost because there is very little information on what this does or means. If you look at how the system works in terms of simple If-Then logic it would look something like this:
- IF IMU senses roll right
- THEN turn roll motor left
- IF IMU senses level
- THEN STOP
- ELSE ERROR
Now, understand this is way over simplified but it does illustrate two important points:
- 1. The IMU must sense direction correctly, + or -, in terms of the programed driven motor direction.
- 2. If the feedback loop containing motor, controller and sensor are not aligned then the controlled action is being driven by error resolution rather than direct control.
In other words, for the program to run smoothly and without error, sensing left must be left and rolling right must be right.
How to Tell
Connect a spare RC channel from your RX to the RC Pitch (A1)input. Check the TX monitor to see which direction sends an increasing signal to the board. Turn on the gimbal controller and the GUI with the trace chart running and confirm that activating the channel (increasing value) causes the camera to pitch back (up) and the trace shows a spike up. This means the Pitch value, Motor direction and controller/IMU are all aligned in the same direction. Repeat for roll using the A2 input.
NOTE: Make sure you use the GUI that came with the firmware version you are using
- 1. Live tuning start-up sequence:
- a. With camera installed and balanced, connect battery power to the Gimbal
- b. Connect the USB
- c. Start the GUI and click connect
- 2. Zero out your max PWM and PID values in both Pitch and Roll
- 3. Beginning with Roll, start with a value of 5 on P, I & D (on v048, start with P=5, I=0.1, & D=5)
- 4. Raise the PWM value until the Roll motor begins to vibrate then back-off enough to completely stop the vibration
- 5. Raise the P value until the motor just begins to vibrate
- 6. Raise the D value until the motor becomes quiet
- 7. Continue going back and forth between P and D until you have reached the highest P value you can
- 8. Add the values for P and D together and divide by 2 to get a starting value for I (049 and up firmware, for 048, change I to 0.5)
- 9. Give the gimbal a light tap on one side while watching the GUI trace to make sure it immediately recovers
- a. If it starts to hum or takes a long time to settle down, I is too high, reduce by 10%
- b. If it returns immediately turn I up by 10% and recheck. The goal is the highest value of I without causing it to vibrate after a "tap"
- 10. Roll Tuning should be complete! Calibrate the Gyro and save these settings to your gimbal. THIS IS VERY IMPORTANT. If you are on firmware r161 or lower follow these 2 steps:
- Click on the options tab and then click "Save to Board"
- Click on options tab and then click "Save to Flash".
- If you are on a newer firmware than r161, simply click on options and "Save to flash".
- 11. Now, go to Pitch settings and repeat steps 3 through 10.
Time for a test flight!
Make sure you write down your final settings each time you tune as you may have to go back and make adjustments for balance or equipment changes.
- Brushless Gimbal Project
- Easy Brushless Gimbal
- RC Groups Martinez Thread
- RC Groups RCTimer BruGi Thread
Vendors used for this Project