STorM32-NT, getting rid of I2C errors, and other cool advantages … see here
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:
(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.
- 13. June. 2015: Firmware v0.80 released
- 5. Apr. 2015: Firmware v0.70 released
- 28. Mar. 2015: Firmware v0.68 released
- 28. Nov. 2014: Firmware v0.56 released
- 10. Okt. 2014: Firmware v0.51 released
- 1. Okt. 2014: Firmware v0.46 released
- 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
- STorM32-BGC wiki
- Discussion thread at rcgroups
- Github repository
- Where to buy STorM32-BGC boards
(Demo video showing the advantages of a 2nd IMU.)
Selected User videos
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, GekoCH.
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.
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.
II. STorM32-BGC: Board v1.3
processor: STM32F103RC at 72 MHz
motor drivers: TC4452VMF
on-board Bluetooth (optional)
on-board 6DOF IMU (MPU6050)
IR led port
Spektrum satellite port
up to 7 PWM/Sum-PPM inputs/outputs
joystick for each axis
additional I2C port (I2C#2)
3 auxiliary ports
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
See the wiki article How to order the electronic parts – BOM for v1.3.
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.
- 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)
- cream pad added to DFN packages
- silk for DFN packages a bit imporved
- value of R11 changed to 1.5k
- 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
- 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
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 the only functional free/open source 3-axis gimbal controller providing these features:
Firmware features (v0.46):
- unique* 2nd IMU support, either on-board or external, for extended angle range, enhanced precision, and ultimative stability even in the pan modes
- unique* adaptive acceleration correction to minimize horizon drift in high-g maneuvers
- this is one of the best features: the motor direction is determined automatically… this removes quite 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“ 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:
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.
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.
Please read also the release notes for the respective firmware linked to in this thread, to learn about known bugs.
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-v080-v20150613 [.zip] (8.5MB)
o323bgc-release-v070-v20150405 [.zip] (8.6MB)
o323bgc-release-v068-v20150328 [.zip] (8.4MB)
o323bgc-release-v056-v20141128 [.zip] (6.6MB)
o323bgc-release-v051-v20141010 [.zip] (4.8MB)
o323bgc-release-v046-v20141001 [.zip] (4.6MB)
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)