Sergio Valverde (A96452) (valverde791@gmail.com)
The EvvGC Gimbal Controller is a board that uses a STM32F103RC and an IMU to control brushless motors, in order to stabilize in 3-axis the desired objects. Its development has been open-sourced for the most part, but the development started on Microsoft Windows and the controllers’ code uses peripheral libraries with dubious open-source status. The EvvGC is lightweight, small and with great performance (according to users’ experience); it is well suited for quadcopter gimbals.
In order to make it fully functional for the ARCOS-Lab of the School of Electrical Engineering, the EvvGC needs to be ported to a complete open-source environment. That means that libopencm3 libraries will occupy the current place of the ST Peripherals libraries in the control software and that code will be built and flashed from GNU/Linux.
• Build and flash code for the EvvGC, in Microsoft Windows. • Study the GNU/Linux development environment for STM32 microcontrollers.
• Build and flash code for the EvvGC, in GNU/Linux. • Adapt EvvGC’s control software to libopencm3 peripheral libraries.
EvvGC is a 3-axis gimbal controller board, designed in an open-source environment to work with brushless motors. It is based on the STM32 (high processing power, even for complex algorithms, and with many peripherals available) and MPU6050, with components widely available on eBay, Farnell and other international stores. Code was initially written with KEIL but it was ported to Eclipse, all in Windows.
Following the instructions from the github of the EvvGC project (in Microsoft Windows; for reference: https://github.com/EvvGC/Firmware), got to the following problems:
The problem raises from the use of the .cproject from the original author, which points to an unknown compiler when Eclipse tries to build the code. When trying to manually build the code from Windows, the built is always unsuccessful due to errors reading some header files. After several hours of debugging, the problems have not been solved. Waiting for reply of EvvGC-related forum and emails sent to people that have had similar problems.
In order to familiarize with the STM32 microcontrollers, some examples were tested with the STM32VLF4DISCOVERY. These were the steps followed.
a. Add i386 architecture to /var/lib/dpkg/arch.
dpkg --add-architecture i386
b. Modify /etc/apt/sources.list with the appropriate syntax for each source.
deb [arch=amd64,i386] http://site.example.com/debian distribution
c. Update the system.
sudo apt-get update
d. Install dependencies for the compiler.
sudo apt-get install libncurses5:i386
a. Open a terminal and type the following command:
sudo apt-get install libftdi1
a. Open a terminal and type the following command:
sudo apt-get install openocd
b. Check that the installation was completed accordingly by checking that directory /usr/local/share/openocd/scripts was created. c. If necessary, install manually by downloading the latest version of the software here: http://sourceforge.net/projects/openocd/files/openocd/0.8.0/. d. Install it accordingly.
cd <download directory> untar –xvf openocd-0.8.0.tar.gz cd openocd-0.8.0 ./configure make make install
a. Download, to directory ~/local/src, the latest version here: https://launchpad.net/gcc-arm-embedded. b. Uncompress the compiler there.
cd ~/local/src tar –xjf gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2
c. Add bin directory to PATH, in order to make the toolchain executables available.
echo ‘export PATH=$PATH:/home/<user>/local/src/gcc-arm-none-eabi-4_8_2014q1/bin/’ >> /home/<user>/.bashrc
d. Reload .bashrc.
. .bashrc
a. Install xstow (follow the Using xstow for local installations tutorial if xstow is not yet installed). b. Download STLink.
cd ~/local/src/ git clone https://github.com/texane/stlink cd stlink sudo apt-get install pkg-config ./autogen.sh ./configure –prefix=/home/<user>/local/DIR/stlink make make install cd cd local/DIR xstow stlink
c. Copy the necessary rules.
cd /local/src/stlink sudo cp 49-stlinkv1.rules /etc/udev/rules.d sudo cp 49-stlinkv2.rules /etc/udev/rules.d sudo /etc/init.d/udev restart
a. Install python-yaml.
sudo apt-get install python-yaml
b. Build the library.
cd ~/local/src/ git clone https://github.com/libopencm3/libopencm3-examples cd libopencm3-examples git submodule init git submodule update cd libopencm3 make
c. Build and flash an example to an USB-connected STMVLF4DISCOVERY.
cd ~/local/src/libopencm3-examples/examples/stm32/f4/stm32f4-discovery/miniblink/ make make flash
In order to build the code for EvvGC gimbal controller, the following steps were taken.
a. Add i386 architecture to /var/lib/dpkg/arch.
dpkg --add-architecture i386
b. Modify /etc/apt/sources.list with the appropriate syntax for each source.
deb [arch=amd64,i386] http://site.example.com/debian distribution
c. Update the system.
sudo apt-get update
d. Install dependencies for the compiler.
sudo apt-get install libncurses5:i386
a. Download, to directory ~/local/src, the latest version here: https://launchpad.net/gcc-arm-embedded. b. Uncompress the compiler there.
cd ~/local/src tar –xjf gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2
c. Add bin directory to PATH, in order to make the toolchain executables available.
echo ‘export PATH=$PATH:/home/<user>/local/src/gcc-arm-none-eabi-4_8_2014q1/bin/’ >> /home/<user>/.bashrc
d. Reload .bashrc.
. .bashrc
cd ~/local/src/ mkdir EvvGC git clone https://github.com/EvvGC/Firmware/blob/master/ cd Firmware
make
These are the proposed steps for flashing code into the EvvGC gimbal controller. These steps have been tested to work with the EvvGC in Debian and in Ubuntu. There is an USB-way of uploading code to the EvvGC that has not been explored yet.
cd ~/local/src/ svn checkout http://stm32flash.googlecode.com/svn/trunk/ stm32flash # this is a read-only copy
cd ~/local/src/stm32flash sudo make install
cd ~/local/src/EvvGC/Firmware/out/ sudo stm32flash –b 115200 –w STM32Gimbal.hex –v –g 0x0 /dev/ttyUSB0/
* Find appropriate port with “dmesg | grep tty”
To calibrate the PID of the EvvGC Gimbal Controller, follow the next steps, in Microsoft Windows.
The need to upload code to the EvvGC and to actually see it working requires soldering of pins to the board. The board was soldered in the ARCOS-Lab.
The work with the libopencm3 EvvGC is documented in the following link: https://bitbucket.org/vlvrd/evvgc-libopencm3.
* PD tuning: Controller tuning from Linux. * Port to libopencm3: Currently, ST Standard Peripheral libraries are being used without changes.
Gimbal Hardware To contribute further with the development of the use of quadcopter cameras stabilized with gimbals, a generic gimbal design is in progress. The main objectives of this gimbal are, in the short term, to be able to hold the EvvGC and three Quanum Gimbal Motor 2208, and to stabilize different cameras (tests will be held with iPhone 5s and GoPro HERO3+). In the long term, the goal is to place the gimbal in a quadcopter from the ARCOS-Lab. Design requirements are: * Lightweight and small design. * Adaptable platform for different cameras. * Sturdy and balanced hardware, in order to liberate the motors from unnecessary work. * 3D-printable design. * Segmented gimbal, allowing future development in specific pieces. * Edges that can distribute forces, for a high-quality gimbal. Design in Solidworks 2012; these are some of the parts in development:
http://en.wikipedia.org/wiki/Inertial_measurement_unit https://github.com/EvvGC/Firmware http://libopencm3.org/wiki/Main_Page http://www.rcgroups.com/forums/showthread.php?t=1872199 http://www.rcgroups.com/forums/showthread.php?t=1978860&highlight=startup&page=14 http://www.st.com/web/en/catalog/mmc/FM141/SC1169 https://wiki.arcoslab.eie.ucr.ac.cr/doku.php/stm32f4