STorM32 BGC: 3-Axis STM32 Brushless Gimbal Controller

I present here the STorM32-BGC project. It is a controller for brushless gimbals with 3 axes, and is based on a STM32 32-bit microcontroller.

The project actually consists of three parts, the STorM32-BGC controller board, the firmware o323BGC for this board, and the Windows GUI o323BGCTool:

  • Controller Board STorM32-BGC
  • Firmware o323BGC
  • Windows GUI o323BGCTool
(open source, see here)               
(free, see here) (free as in free beer, and not only as in freedom)
(open source, see here)

Strictly spoken, ‘STorM32-BGC’ refers only to the hardware, but I will use this label also for the whole project.

storm32 bgc v017 test microgimbal olliw
(Test setup using a micro gimbal and STorM32-BGC v0.17 controller board, and first demo video using this setup)


(Demo video showing the advantages of a 2nd IMU.)

News

  • 19. June. 2014: Firmware v0.33 released
  • 28. Mai. 2014: Firmware v0.31 released
  • 21. Mar. 2014: New board STorM32-BGC v1.3 released (this will now really be the “final one” for quite a while)
  • 20. Mar. 2014: Firmware v0.25 released
  • 20. Feb. 2014: Wiki created for documentation: http://www.olliw.eu/storm32bgc-wiki
  • 19. Feb. 2014: The new board STorM32-BGC v1.2 has arrived today, and it is working absolutely perfect! :)
  • 6. Feb. 2014: Development goes on, new board STorM32-BGC v1.2 ordered
  • 11. Jan. 2014: Board STorM32-BGC v1.1 works!
  • 2. Dez. 2013: GitHub Repository created: https://github.com/olliw42/storm32bgc
  • 26. Nov. 2013: Bluetooth module HC06 installed, works as expected, Windows GUI augmented by an auto-configuration utility
  • 21. Nov. 2013: Take off, the first batch of print boards STorM32-BGC v0.17 has arrived

Useful links

User videos


Acknowledgements
I am pleased that Martinez agreed to do the layout of the (first, v0.17) STorM32-BGC board. I was also ‘allowed’ to move around some wires, but the hard part of the routing was done totally by him, and he indeed did a fantastic job!
A special thanks goes to hexakopter/Dario, for his endless hours of testing.
I also want to thank various individuals for support in different ways: erickwesz, KingDaKa, Marc, yang/wdaehn, careyer&TheBlindHawks, Greg Covey, fpvberlin.


I. STorM32-BGC: Concept

The board was in principle designed to serve “larger duties”. The current firmware doesn’t yet make full use of its potential, but that’s why the project is not yet at its end :) (please check the current feature list). Hardware-wise the STorM32 controller provides these, partially innovative, features (for the current version v1.3):

Processor: 32-bit microcontroller STM32F103RC or STM32F103RB or STM32F405RG
The board has been designed to accomodate the 32 bit microcontrollers STM32F103RC or STM32F103RB, which run at 72 Mhz, as well as STM32F405RG, which runs at 168 MHz and in addition provides a floating point unit. Currently the STM32F103RC is recommended.

Motor drivers: TC4452
The TC4452 drivers are actually designed as Mosfet drivers, but it turned out that they are also well suited for our purposes. They allow for a maximum voltage of 18 V, and hence operation at up to 4 S. The data sheet specifies a maximum current of 13 A peak and 2.6 A continuous per motor phase, but that’s unrealistic (heat!). A realistic maximal value is 1.5 A per motor (for DFN8 packages); fortunately more is rarely needed. The disadvantage of the drivers is its limitation to 18 V or 4 S. The great advantage however is its – in comparison to discrete drivers – high fault tolerance (or, as it is expressed so nicely in the data sheet: “These devices are essentially immune to any form of upset.”).

Interfaces: USB, UART, and Bluetooth
The board provides a USB port, which shows up as virtual com port on the PC. It also provides the usual serial UART port (a USB-TTL adapter is needed to connect to a PC). In addition, the board can be equipped with a HC06 bluetooth module hence providing wireless connection (which is cool!).

Ports: PWM, Sum-PPM, Spektrum, Futaba S-Bus, IR Led, Joystick, Button, AUX
The board provides 7 ports (3 ports with STM32F103RB), which can be used as inputs or outputs for RC signals (PWM/Sum-PPM). These ports are 5 V tolerant. A Spektrum satellite as well as the Futaba S-bus is supported. In addition 3 further ports (7 ports with STM32F103RB) are available as general inputs/outputs (they too are 5 V tolerant). The board also provides 3 analog-digital converter inputs (3.3 V maximal), to connect e.g. a joystick. A further port is offered for connecting a button. Finally, one port is available for connecting a IR led.

Saftey
The motor drivers, the usage of the microcontroller ports, and the voltage supply are designed for a safe operation, inclusive a reverse voltage protection. Furthermore, a voltage devider is integrated for measuring the battery voltage; in case of e.g. too low voltage the motor drivers are shut down.

On-board 6DOF IMU
The STorM32 controller has a separate 6DOF IMU chip MPU6050 integrated on the board. Alternatively a second IMU can be connected to an additional I2C port. This should allow for exciting novel features in the future.

Magnetometer or 10DOF IMU
Instead of the common MPU6050 module mounted on the camera, also the GY-86 10DOF IMU module can be installed, which provides an additional magnetometer for compensating the drift in the yaw axis. However, in praxis, this doesn’t (yet) work really well because of some fundamental issues with the working principle. And in fact a magnetometer is not really needed..

TERMS OF USAGE
The STorM32-BGC board is open source hardware, under the terms of the TAPR Open Hardware License as published by the Free Hardware Foundation, see http://www.tapr.org/ohl.html. The Eagle and Gerber files can be downloaded below. The TAPR licence explicitely permits a commercial use, with some (easily accomplished) conditions, such as e.g. that copyright logos are not removed. The firmwares/softwares are subject to the licences/terms of usages given below.

Data sheets
STM32F103RB, STM32F103RC, STM32F405RG, TC4452, MPU6050, HC06, HM10


II. STorM32-BGC: Board v1.3

Specifications

processor: STM32F103RC at 72 MHz
motor drivers: TC4452VMF
on-board Bluetooth (optional)
on-board 6DOF IMU (MPU6050)
IR led port
Futaba S-Bus
Spektrum satellite port
up to 7 PWM/Sum-PPM inputs/outputs
joystick for each axis
additional I2C port (I2C#2)
3 auxiliary ports
BUT port
voltage: 6 – 18 V or 2 – 4S
current: max. 1.5 A per motor (see also here)
dimensions: 5 cm x 5 cm, holes Ø3 mm, distance 45 mm
weigth: ca 13 g

Electric scheme and board layout

storm32 bgc v130 scheme sheet1 olliw storm32 bgc v130 scheme sheet2 olliw
storm32 bgc v130 top bottom olliw

Parts list

See the wiki article How to order the electronic parts – BOM for v1.3.

Build
The placement of the parts is shown in the next picture, which gives the values of the resistors and capacitors. The other parts are not labelled since there shouldn’t be any confusion about their locations.

storm32 bgc v130 top-bottom wvalues olliw
storm32 bgc v130 board dfn mpu olliw
(The v1.3 board, incl. the optional MPU6050)

Changelog
v1.3:

  • voltage regulator in DPak/TO-252 package
  • AUX2 instead of 3.3V pin at AUX port
  • solder jumper to disconnect bluetooth led
  • values of resistors R12, R13, R22 changed (not critical)

v1.2 rev2:

  • cream pad added to DFN packages
  • silk for DFN packages a bit imporved

v1.2 rev1:

  • value of R11 changed to 1.5k

v1.2:

  • minor errors in v1.1 corrected (order of pins of I2C#2 connector reversed, SWD port labelling corrected, stop mask added to big battery solder holes)
  • USB disconnect pin network changed (as suggested by ala42, THANKS)
  • XOR gate added to RC-0 pin to support Futaba S bus
  • Spektrum satellite port added
  • “cooling pad” for LDO added
  • reinserted Vbat reverse voltage protection diode as in v0.17, using smaller diodes though
  • all parts named/valued properly to produce a good BOM
  • further smaller changes in the scheme and layout

v1.1:

  • reverse voltage protection using p channel fet (SOIC8)
  • large solder pads and holes for battery connection
  • layout allows using TC4452 motor drivers in DFN package
  • I2C#2 connector
  • high-side open collector (pnp) port for driving a IR led
  • sequence of pins changed for the RC and SWD ports
  • further smaller changes in the scheme and layout

Older boards

STorM32-BGC v1.2

STorM32-BGC v1.1

STorM32-BGC v0.17


III. Firmware o323BGC

For how to use the firmware see the STorM32-BGC wiki. Here only some technical infos are given.

To the best of my knowledge the o323BGC firmware/STorM32-BGC board is (still) the only functional free/open source 3-axis gimbal controller providing these features:

Firmware features (v0.33):

  • this is probably the best feature of all: the motor direction is determined automatically… this removes really a lot of issues in setting up the gimbal, in particular of the yaw axis
  • the IMU/MPU6050 module can be mounted in any of the 24 possible orientations, the GUI makes setting this up very simple
  • bluetooth: the firmware together with the GUI provides an auto configuration tool for a one-click setup of the optional on-board bluetooth module
  • battery voltage measurement: it is used for a lipo saver function (I wouldn’t want to be without that anymore!) and an automatic voltage drop compensation feature of the PID controller
  • pan/follow mode for each axis; the mode can be choosen individually, and it can be changed any time (“during a shoot”)
  • camera orientation can be controlled by external rc signals (PWM, sum-PPM) and/or a joystick in all three axes
  • external control of camera orientation can be adjusted precisely, speed limits as well as acceleration limits can be set
  • IR led remote control of camera: shutter, shutter delayed, video on/off, time sequences
  • Mavlink-type commands for a remote control of the camera by e.g. an app
  • the startup procedure includes a dedicated no-oscillation detection scheme, is crucial for a good gyro calibration in particular of the yaw axis (minimizes drift in the yaw axis)
  • quaternion based IMU algorithm (Mahony type), with unique* mechanism for suppresing the drift in the yaw axis without magnetometer
  • unique* adaptive acceleration correction to minimize horizon drift in high-g maneuvers

* “unique” means that the developped algorithm is not found in any other DIY/open source project, and provides advanced perfomance.

Motor PWM frequency: 23.4 kHz
The STM32 allows to choose the motor PWM frequency freely in a relatively large range. I have choosen 23.4 kHz. This corresponds to a resolution of the PWM signal of about 10.5 bits.

Control frequency: 0.67 kHz
The main loop is repeated every 1.5 ms.

Angular resolution: 10 bits
This number depends to some extend on how it is exactly calculated. In comparison to 8 bit BGC boards the angular resolution is however significantly larger.

TERMS OF USAGE
The o323BGC firmware is free (but not open source). Besides unlimited private use you are also granted the permission to use it for commercial purposes under the condition that (1) you don’t modify the firmware, e.g. remove or change copyright statements, (2) provide it for free, i.e. don’t charge any explicit or implicit fees to your customers, and (3) correctly and clearly cite the origin of the firmware and the project web page in any product documentation or web page.


IV. Windows GUI o323BGCTool

For the description of the Windows GUI o323BGCTool see the STorM32-BGC wiki. Here just some “teaser” screenshots of a preliminary version are shown to indicate the rich set of features:

0323bgctool setupmain olliw 0323bgctool datadisplay olliw
0323bgctool setupgimbal olliw 0323bgctool setuprcinputs olliw 0323bgctool setupexpert 0323bgctool configureimu olliw
0323bgctool configuremotors 0323bgctool flashfirmware olliw 0323bgctool btconfigtool olliw

TERMS OF USAGE
The o323BGCTool software is open source (but see below). Besides unlimited private use you are also granted the permission to use it for commercial purposes under the condition that (1) you don’t modify the software, e.g. remove or change copyright statements, (2) provide it for free, i.e. don’t charge any explicit or implicit fees to your customers, and (3) correctly and clearly cite the origin of the firmwares and the project web page in any product documentation or web page. The GUI software is based on libraries, which I am using since nearly 10 years and which I have modified over time in several places I can’t remember anymore. Furthermore, it is written in Perl using Win32::Gui, which is not maintained anymore. It would take me an enormous effort to build a working distribution. I hence don’t publish the complete code but just the “master” perl source file, which however contains all relevant code.


V. Downloads

The files are also available at the GitHub repository https://github.com/olliw42/storm32bgc.
Visit post #1 in the rcgroups thread to check for potential beta releases.

STorM32-BGC Eagle and Gerber files
storm32-bgc-v130-eagle-gerber-files-20140322 [zip] (2.5 MB)
storm32-bgc-v1202-eagle-gerber-files-20140311 [zip] (2.5 MB)
storm32-bgc-v110-eagle-gerber-files-20131227 [zip] (1.8 MB)
storm32-bgc-v017-eagle-gerber-files-20131120 [zip] (1.5 MB)

storm32-bgc-mpu-module-v009-eagle-gerber-files-20140506 [zip] (1.3 MB)

o323BGC firmware and o323BGCTool files
o323bgc-release-v033-v20140619 [.zip] (4.9MB)
o323bgc-release-v031-v20140528 [.zip] (4.7MB)
o323bgc-release-v029-v20140518 [.zip] (4.5MB)
o323bgc-release-v028-v20140511 [.zip] (4.3MB)
o323bgc-release-v025-v20140320 [.zip] (4.2MB)
o323bgc-release-v024-v20140316 [.zip] (16.0MB)
o323bgc-v20140122 [.zip] (3.1MB)
o323bgc-v20140117 [.zip] (2.9MB)


126 Kommentare

  1. Andre J. sagt:

    Hi OlliW,

    I have been researching BLDC control for some time now to begin a project of my own for a dual use GoPro BLDC Gimbal that can be used in the traditional “stabilized” gimbal sense or also as an object-tracking system.

    To this end, I have come across your STorM32 board frequently and find it to be one of the best options available for bldc gimbal control. My question is, would it be possible to use the on-board STM32 as a slave and an external microcontroller as a master in order to feed in target values for the control algorithm from the master controller?

    Essentially I want to use a main board to do image processing and determine the error (in this case the distance an object in the camera view is from the center of the perceived screen) and update the control algorithm on your board to use these outside values as new target to move the camera stage until the object being tracked is once again in the center of the camera’s field of view.

    Any guidance you could provide would be greatly appreciated!

    Thanks,
    -Andre

    • OlliW sagt:

      Hey Andre,
      it’s certainly possible to use the hardware for your purpose, and hence the answer to your first paragraph is yes. The current firmware would in principle also provide what you need to do for what you suggest in the second paragraph, but I think that for good results you would want to use a dedicated firmware on your “slave” board. I mean, this is a control loop, and the communication with the board is not designed for such a thing.
      However, I think what you have in mind is very exciting, and – I’m convincecd – the future of where gimbals will go to, and I had supporting such things on my longer term plans. So, I would invite you to the rcgroups thread, to discuss more and deeper about that. From my side I would be interested in such a project.
      Olli

  2. Alex sagt:

    Hallo Olli,

    danke für deine arbeit, habe das Board eben bestellt und freue mich schon darauf

    • OlliW sagt:

      na, dann hoffe ich das es gefällt und den Erwartungen halbwegs entspricht :)
      bedenke bitte das es in letzter Zeit ein ganze Reihe von beta Releases gab, die v0.33 ist etwas veraltet
      ein guter Platz für Diskussionen/Fragen usw. ist der rcg Thread
      :)

  3. kronosol sagt:

    Hey Olliw. ich vermisse noch eine Art “EierUhr” Funktion, Also das sich das Gimbal z.b. um 1°/min um 2 Achsen dreht. Damit könnte man dynamische Langzeitaufnahmen machen. Diese Funktion gibt es noch bei keinem anderen BGC und ich denke das ist durchaus machbar.
    Ich danke dir für diese tolle Arbeit, die du machst. Mit dem Storm32BGC habe ich schon sehr viele 2,7K aufnahmen gedreht und es funktioniert einfach wunderbar!!
    Danke, danke, danke ;)

    • OlliW sagt:

      Hey
      das Problem mit dieser Art Funktionen ist, dass es irgendwann einfach zu viele Parameter und Einstellmöglichkeiten unter einem Hut zu bringen gilt, so das am Ende keiner mehr ausser ein paar wenige Spezialisten mit zurecht kommt. Mir klingt das nach nen Panorama-Head (LangzeitAufnahmen in der Luft sind ja nicht so), diese Anwednung haben wir gerade erst im rcgroups Forum diskutiert, und eigentlihc klar verworfen.
      Das Drehen um zwei Achsen geht ja schon, aber das mit den 1°/min ist so nen Ding … was allerdings geht ist, dass du die Position z.B. über ne App oder nen Arduino oder nen PC langsam veränderst, Erick hatte so was mal gemacht, schau mal in den rcgroups thread die letzten Seiten durch. Vielleicht verstehe ich auch nur noch nicht genau was du im Sinn hast.
      Freut mich dass du mit dem STorM32BGC Freude hast! Wäre schön/nett wenn bei Gelegenheit eines deiner Aufnahmen z.B. in rcgrouops postest.
      Cheers, Olli

    • kronsol sagt:

      Hey Olliw., man müsste das ja gar nicht so kompliziert machen, die Grundfunktion ist ja schon vorhanden.
      Ich nutze z.b. zwei Schieberegler an dem Rücken meines Rc-Senders um im Flug die Kamera zu neigen und zu rollen. Klar macht so eine Panorama-Aufnahme bei einem sich bewegendem Objekt keinen Sinn ;).
      Nur könnte man den RC-Eingang nicht Simulieren? Das Board rechnet dann einfach von 1000ms auf 2000ms mit wahlweise X ms/sec ;). Dann würde sich die Kamera langsam drehen und man hätte den Vorteil, das man auch auf schiefen Ebenen schnell mal eben einen Sonnenaufgang Filmen kann, ohne die Kamera auszurichten. Die zusätzliche Bewegung sorgt für ein sehr schön anzusehendes Timelapse. Ein Beispiel mit Eier Uhr ;)
      http://www.youtube.com/watch?v=lVL3Lg0Mjlk

    • OlliW sagt:

      das sind aber keine 1°/min, sondern eher 5°/s … und das sollte eigentlich jetzt schon locker gehen (die kleinste Einstellung ist zumindest 0.5°/s, technisch ist’s auf 0.1°/s ausgelegt)(habe ich nie getestet), also einfach Limits passend setzen, Speed passend setzen, dann die Yaw Achse auf nen RC Kanal legen, Kanal umschalten, und schon fährts langsam rum … das selbe kannst du auch mit nem Taster erreichen, oder über einen MavLink Befehl … weis ja nicht was du mit simulieren meinst, aber “irgendetwas” muss ja sagen wann’s los geht, und viel anderes als Schalter, Rc Signal, Telemetrie-Befehl fällt mir da gar nicht ein
      also, das was im Video zu sehen ist scheint mir bereits gut zu gehen :)

    • kronsol sagt:

      Hey Olliw., also in dem Video sind es deutlich weniger als 5°/sec.
      Du meinst also über den BUT port mit nehm einfachen Schalter gehen? Wollte mir demnächst eine zweite Gimbal Steuerung kaufen und dann ein 3 Achs Gimbal bauen, für solche Zeitraffer Aufnahmen und als Handheld.
      Das Optimum wäre, wenn man.. ähm.. das Gimbal in Standby (Motoren Kraftlos) stellen könnte, dann die Anfangsposition mit der Hand hält, diese abspeichert (z.b. Taster) dann die Endposition mit der Hand hält, diese wieder abspeichert (Taster) und dann wenn man den Taster ein 3tes mal drückt, das Gimbal mit seiner Arbeit beginnt, die Anfangsposition einstellt und dann ganz langsam zur Endposition gleitet. Die Geschwindkeit einstellbar über einen Drehwiderstand.
      Geht sowas Olli? Das wäre super, hoffe du hast verstanden was ich mein.

    • OlliW sagt:

      na gut, dann vielleicgt 2°/s … aber keine 0.02°/s …
      Ja, einfach einen Schalter an z.B. BUT oder einen der AUX, dann die Grenzen mit Min Max einstellen, relative oder absolute geht beides, ich würde relative nehmen, und dann natürlich die Geschwindigkeit, wenn du dann den Schalter in der einen Stellung hast fährts zu Min, in der anderen fährst zu Max. Du kannst den selben Schalter auch auf meherer Achsen legen, dann fahren halt eben auch zwei oder drei Achsen, es egehn also nicht nur Schwenks, sonder auh “gekoppelte” Bewegungen. Alles schon da :)
      Zum Optimum, klar geht das, im Prinzip, aber du wirst verstehen das ich derartige Spezialfunktionen nicht in den Kontroller programmieren werde … stell dir nur mal das Cahos in der GUI vor, abgesehen von dem Chaos im Code, … und morgen kommt der Nächste … wie gesagt, eierlegende Wollmilchsäue sind das was sie sind, eierlegende Wollmilchsäue. Das Einzige was der Kontroller sinnvoll leisten kann, ist die Fernsteuerbefehle zu bieten damit man soetwas mit ner externen App/Tablet/Pc/Hardware machen kann … und das ist bereits drinnen. Da musst du dir also nur ein kleines Progrämchen schreiben, und schon geht es genau so wie du wünscht. Vielleicht könnte ich von meiner Seite aus noch ne Art Move Befehl zufügen, mit nem echten Slerp (bisher wäre es ja nur Lerp), aber ansonsten, alles da.

  4. Tilman sagt:

    WOW!
    Richtig Gut! Endlich mal ein erschwinglicher guter BGC :)

  5. clancey sagt:

    1. You need a standard usb-ttl adapter (FTDI, CP2102,…), ensure that it’s working (drivers installed etc.)

    Goona order this.

    • OlliW sagt:

      yes, the witespy board doesn’t come with firmware preflashed, so, at first you have to flash it, and for that you need a usb ttl adapter
      I only can recommend to spend time in the wiki, and for questions to move over to the rcg thread

  6. clancey sagt:

    Yes i have are gonna read some more, and if i can’t figure it out i’ll make a new form, and talk about it further there TY have a blessed day

    CA aggen

  7. Clancey sagt:

    Hello i can not seem to make this board talk to my computer, i have the whitespyquads version and are looking for help are running windows 7 64bit my board is blue.

    • OlliW sagt:

      well, hard to say, not much info given here, could be anything from trivial to DOA
      xou’ve seen the wiki? has a page just for this board
      maybe consider asking in the rcgroups thread, it allows much better communication (e.g. screenshots etc) than this commentary function here
      :)

Add Comment Register



Hinterlasse einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *