Getting Started

From STorM32-BGC Wiki V1
Revision as of 13:43, 14 December 2014 by Yang (talk | contribs)
Jump to navigation Jump to search

You have a Gimbal, the StorM32-BGC board, the IMU and all cables. So what is next? This page is intended to guide you through the essential steps (based on the 0.56 firmware version) and contains references to the detail pages in case you need to know more. Basically the steps are

Ordering information

The StorM32-BGC board can be found at various shops. As of today there are three hardware revisions but frankly, they do not differ much. Hence nothing wrong with buying a v1.1 board, just keep in mind that some pins are placed at different places. Since the v1.3 hardware revision is the one you get everywhere these days, this page is using it as example. Together with the board buy an IMU and matching cable from the same vendor. There are tons of IMUs available but the connectors can be different. The plug on the StorM board is a so called Picoblade connector. And finally an USB-to-serial adapter with a matching cable is required for flashing the latest firmware. It can be any FTDI, CP2102, ..., but NOT a PL2303 based adapter. Again, if you do not have one already, I recommend getting this with the other parts. Personally I prefer those where the drivers come from the Windows Update Site automatically.

Things to watch out for when comparing prices

  • Bluetooth module included? The StorM board is designed to solder an HC06 bluetooth module on it. Then you can run the config tool on your laptop via bluetooth. The range of these modules is quite low, so do not expect to use it to remote monitor the gimbal values in flight. If in future there will be a smartphone app available, this might be realyl cool for changing configurations, on the other hand, how often will you be doing that?
  • Connectors soldered on it? Having connectors already soldered allows to simply plug in the motors and go. On the other hand, the RC and motor connectors are quite large, hence might be placed on the opposite side or motor cables being soldered directly to the board. Consider your preferences before buying.
  • IMU and cable included already? Or does it come without the IMU?


Flash Firmware

Because the StorM board has a very active community, new firmware versions with new enhancements are released on about monthly basis these days, so the first step will be to flash the newest firmware. This description here assumes the board used was bought by a vendor with a firmware already uploaded and it should be updated only. Else refer to the How to flash firmware page. Very quickly, there are three typical traps when flashing

  1. The board has no power
  2. The pins labeled UART is used for flashing instead of the RC labeled pins
  3. Wrong serial port is selected in the tool

In order to flash a new firmware the following steps are recommended.

  1. Get your USB-to-serial adapter to work by installing all windows drivers as requested by the vendor.
    Usb-to-uart-driver.png
  2. Unplug(!) the USB-to-serial adapter again
  3. Connect the USB-to-serial adapter to the StorM board to the pins labeled RC(!). The firmware is not programmed via the UART labeled port, not via USB but via the RC pins. In other words, when the board is brought into the bootload mode, the RC pins are re-assigned to microcontroller's UART1, in normal mode these pins are assigned to the PWM timer. And the pins labeled as UART are the mcu's UART0. All of this is a security measure to avoid people programming the board via e.g. bluetooth and end up with an nonoperational board.
    Stom32-bgc-flashing-w-usbttladapter-connections-02.jpg
  4. Connect the StorM board via USB to the computer. We are not using this connection yet but we power the board via USB. Although we do not need it yet, this might trigger Windows to install a driver for the STM processor's USB connection.
  5. Download the newest firmware, unzip it and run the exe file, in this example the o323BGCTool_v056.exe program. It does not matter what the current firmware installed is, you use the tool that comes with the firmware zip file. Get the zip file from here: Downloads.
  6. In the tool select the [Flash Firmware tab] on the very right hand side and select the hardware revision of your board. This does change the firmware file to be used in the field below.
    Firmware selector.png
  7. In step two, the middle of the screen, there is a [com port selector] for flashing. NOT the com port selector at the bottom! Click on the drop down box to see all currently available com ports. Since we do not have connected the USB-to-serial adapter to the computer yet, the new one appearing when plugging in the adapter will be the one to use. Hence remember that list of ports to identify the new one in the next step.
    Firmware comport1.png
  8. Plugin the USB-to-serial adapter and click again on the drop down box of the serial connector for programming. Select the new one.
    Firmware comport2.png
  9. The board has two buttons, the boot and reset button. When the board is started, the very first thing the software does is checking if the boot button is currently pressed. If it is, the bootloader mode is entered, else the normal operation starts. The best way of entering the bootloader mode is hence to press the boot button and while it is pressed press and release the reset button to initiate a hard reset.
    Firmware-bootloadermode.jpg
  10. Check if the board is in bootloader mode or in operational mode. If the boards appears to be dead, then it is brought into bootloader mode successfully, if the Leds are blinking, it is in normal operation and obviously the boot button was not pressed while the reset button was released.
    Firmware-bootloadermode-leds.jpg
  11. Now the board is listening on the RC pins for serial data, the usb adapter is connected, the firmware tool is using the Windows COM port of the serial adapter, hence you can click on [Flash Firmware] button.
    Firmware start flash.png
  12. A dos box will open and either return an error that the UART connection is not responding or a sequence of downloading and verifying the firmware is shown.
    Flash.png
  13. After the reset your board is operational and can be reached via the USB cable. Hence disconnect both, the USB cable and the USB-to-serial adapter and click on the com port selector at the very bottom. Again, remember the list.
    Board read 0.png
  14. Then plugin the StorM board via the USB cable to power it. Either the matching driver was installed already or it will be installed now. Either way once windows has installed the driver when clicking on the drop down for the com port selector, it should now show an additional one.
    Board read 1.png
  15. Jump back to the [Main tab] and click on [Read] to validate the connection with the board.
    Board read 2.png


In case you have troubles with the StorM's USB driver, it can be found here: download page.


Hardware setup

The camera IMU

This IMU is to be mounted in a way so that it does measure all camera movements. Its actual position does not matter, behind the camera, on the pitch arm below the camera,... anything will work. The only thing to watch out for is that its axis are aligned with the camera axis. Each axis has to be either horizontal or vertical. Just imagine, the sensor would read that the horizon is level but because of an misalignment the camera does hang slightly to one side and hence the horizon in the video is not level.

Mounting the StorM board

One of the outstanding features of the StorM board is its 2nd IMU support. In fact the board has such IMU itself already and to make use of it, the board should hence be mounted on the copter frame. The direction does not matter as long as it is the frame. In case this is not possible, either the 2nd IMU support has to be disabled or another external IMU is mounted to the frame and connected to the frame I2C connector. Again, the IMU axis have to be either vertical or horizontal.

Electric connection and insulation

All the IMUs go to their corresponding I2C plug, that is the I2C labeled Picoblade connector next to the USB connector for the camera IMU.

Stom32-bgc-v130-ports-and-connections-01.jpg

On the backside of the board is a I2C#2 connector for the optional frame IMU.

One thing we found out the hard way is to never mount the board or the IMUs with metal screws and distance sleeves, always use plastic ones. Not only does that enhance the probability of survival in case of an electric defect but also the I2C bus might use the entire metal frame and motors as antenna. Which leads to massive amounts of errors on the I2C bus. And without constant readings of the IMU positions the entire purpose of the gimbal is forfeit. Make sure the IMUs are mounted rigidly also so they measure the actual position.

Gimbal mechanics

Before using the gimbal, it is absolutely necessary to balance it and to ensure minimum resistance to rotations (friction in bearings, stiff cables, etc). Any improper balance or resistance to rotation will make setting up the gimbal more difficult or even impossible. The goal shall be to rotate the camera in the gimbal and it should stay in that position by itself. In other words, the center of gravity should be in the center of all gimbal motor axis. Just imagine the camera's center of gravity is way below the pitch axis (looking with the camera up and down). It would act like a pendulum. So just because your copter does accelerate forward, the gimbal pitch motor has to hold against the mass inertia. You will need very strong motors and lots of energy which is a waste. On the other hand, if the gimbal is balanced properly, all the motor has to compensate is copter rotations, wind resistance and inertia when rotating the camera to point to somewhere else.

Powering the Gimbal

For the motors the 5V supply of the USB bus is not enough for sure. So the motors will work only if the battery connector provides the power. That is the reason why e.g. flashing the firmware is done via USB power only as we do not want to motors to get power at that time. The battery connector can handle any voltage from 6V to 18V. Connecting the PC via the USB cable while the board is powered via a battery is no problem at all. The order does not matter, first USB then battery or reverse, both will work.

Motor connector

The board has three connectors for the motors labeled Mot0 to Mot2. Before connecting any motor, it might be a good idea to measure the resistance of the motor windings and the motor frame. The three motor cables should have an electrical resistance of 12 Ohm or more and completely isolated from the motor housing. If the resistance is too low, the amount of amps flowing through the motor might be too high for the board driver to handle. And if one of the motor cables is connected to the motor housing, the entire gimbal and maybe even the frame gets the motor voltage. The usage of the three connectors is Mot0: Pitch motor to point the camera up/down Mot1: Roll motor to stabilize the horizon Mot2: Yaw motor to turn the camera left/right

0connections.JPG

First Configuration

The last steps in the firmware flashing section had been to check if the StorM32-BGC is operational.

  • Disconnect the USB cable and click on the com port selector at the very bottom. Remember the list.
    Board read 0.png
  • Plugin the StorM board via the USB cable to power it. Either the matching driver was installed already or it will be installed now. Either way once windows has installed the driver when clicking on the drop down for the com port selector, it should now show an additional one.
    Board read 1.png
  • Jump back to the [Main tab] and click on [Read] to validate the connection with the board.
    Board read 2.png

Now it's time to set the most important parameters, namely the IMU orientations and motor parameter values. Without that the controller can't perform the basic operations even.

For the following the motors should NOT be operational. This can be achieved in various ways, for example by physically disconnecting all motors, or using the [Disable all Motors] buttons in the configuration tabs. The easiest and recommended way is however to power the board via USB only, i.e. to not connect a battery to it (when the board is powered by USB only the motors are shut off and won't work).

1main.png

IMU Orientation

the procedure is still valid, but a better and much easier procedure is available in v0.56

The tab called [Configure IMU] is meant to support you in setting up the IMU orientation. There are so many different ways in which you can attach the IMU to your camera (above the camera, below, at the backside, with the axis up, down, left, right, and so on) but the controller does not know. Hence you have to tell.

It is of outmost importance to set the IMU orientation correctly, else the controller has no chance to work correctly. Please double and triple check that you got the IMU stetting right!

Determining the IMU Orientation

The first thing is to ensure that all motors are shut off to avoid any motor movements. Then investigate the IMU board, there is usually an arrow printed on it for the x axis. If not, you may use the little dot marker on the IMU chip as reference (see the Appendix below). Now hold the gimbal and camera in front of you, as if you would be taking a picture. "Up" refers to the top of the camera, "forward" to its front with the lense, and "right" to the right-hand side of the camera. The questions to answer in the IMU orientation dialog are where the z axis and x arrow point to.

The IMU's z axis points outwards of the surface of the IMU chip, i.e., comes straight out of the IMU board. In the example below, as the IMU board is mounted upside down, it points downwards the camera, so you specify the [z axis points] "down". For the x axis we use the printed arrow on the IMU board. In the example below it is pointing in the camera's forward (shooting) direction, hence in the GUI you set that the [x axis points] "forward". The little graphic on the right displays your setting, i.e., the IMU's x-y-z axes with respect to the camera's up-right-forward orientations.

To send these setting to the board click on the [Write] button. In order to make the changes permanent, the menu option [Store to EEPROM] can be used. Alternatively, click on the check box next to the [Write] button, which causes the button label to change to [Write+Store], and hit the button. Both methods are fine.

Please note that the [Configure IMU] page is for your support only. Its sole purpose is to help you determining the IMU orientation index, here no. 15, and writing it into the [Imu Orientation] parameter field located on the [Gimbal Setup] tab.

Comment: In older firmware versions (v0.27 and lower) the meaning of "right" and "left" is reversed. The orientation index number however has not changed.

6configureimu.png

3imuorientation.JPG

Checking the IMU Orientation

In order to ensure a correct IMU Orientation you should test it. Write the setting to the controller (temporarily or into the EEPROM) and then click on the [Data Display] button. This will open a realtime monitor window. In the top you can see the current Pitch, Roll, and Yaw angles once you did click on [Start] in the window.

As the motors are (hopefully) disabled still, you can move the camera by hand. The following behavior must be observed:

  • When you tilt the camera downwards (lens points to the ground), the Pitch value has to get more positive (the red line in the middle panel of the Data Display has to move upwards).
  • When you roll the camera like in flying a right turn (clockwise when standing behind the camera), the Roll value has to get more positive (the green line in the middle panel of the Data Display has to move upwards).
  • When you rotate the camera around the yaw axis anti-clock wise, the Yaw value hast to get more positive (the blue line in the middle panel of the Data Display has to move upwards).

If you do not observe that, then go back and repeat the IMU orientation setting.

9datadisplay.png

Appendix

In case your IMU board has no arrow printed on it or you are uncertain then you can use the white dot in one of the corners on the IMU chip (MPU6050) as well for the orientation. In the diagram below the axes and their orientation in relationship to the dot are shown.

As said before, the z axis comes out of the top surface of the chip and the x axis points away from the dot. Check the chip labels, the x axis runs in the reading direction of the labeling.

The diagram below provides some examples of the IMU orientation.

5IMUorientation.JPG

Motor Settings

the procedure is still valid, but an easier procedure is available in v0.56

For the motor settings there is a separate tab as well, the [Configure Motors] tab. Again, ensure that the motors are disengaged.

In the example below the Mot0 port on the controller is connected to the Pitch motor, which lets the camera look up or down. Mot1 is connected to the Roll motor, which keeps the horizon level. Remember, Mot2 has to be used for Yaw always.

The motor poles are best read from the motor's datasheets found in the internet. A common value is 14 poles for smaller motors. Large motors may have 22 poles or even more. Self-wound motors often have 12 poles.

The last setting of importance is the motor direction. However, the STorM32 controller provides you an "auto" setting, which is recommended to be used. With "auto" the initialization phase of the gimbal takes few seconds longer - who cares (you can avoid that later if you like).

With these few steps the most important fields in the [Gimbal Setup] tab are properly set, and you are ready to go!

7configuremotors.png

First Startup

Once you have completed the above steps, the motors can be turned on. In the [Expert] tab check that the [Pitch Usage], [Roll Usage] and [Yaw Usage] parameter fields are all set to "normal" (the default is "disabled"). If not, set them to "normal" (or click on [Enable all Motors]), and write and store the changed setting.

Comment: If you are using the STorM32-BGC for a 2 axis gimbal, set [Yaw Usage] to "disabled" (and maybe set [Yaw P], [Yaw I], and [Yaw D] to zero).

Now connect a battery to the controller (it is assumed that you did follow the above advice of powering the board via USB). The gimbal should go through a number of initialization steps (the green led blinks, with increasing frequency), and finally should start with normal operation (the green led goes solid).

Comment: During the initialization the gimbal needs to be at rest.

In short, after power up keep the gimbal at rest until the green led goes solid. Holding the gimbal e.g. in the hands is not keeping it at rest.

Next step - PID Tuning

At this point the gimbal may already stabilize the camera. However, usually, the camera is not yet stabilized perfectly, or the gimbal may even start to show weird shaking or make high frequency noises. This indicates that the PID values in the [Main] tab are not proper.

See the PID parameter Tuning Guide for adjusting those.