Wireless Gimbal Control

Wireless Control with Computer:

The figure below shows the control schematic and illustrates the principle of wireless gimbal control, which will be discussed in this post. (Click on it for clearer picture)

The control schematic
The control schematic

Wi-Fi was chosen for this application since it has the furthest range and is an available technology on both the Glass and the Arduino. In each wireless technology there may be a range of protocols one can use to send data. The two predominant protocols in the Wi-Fi class are web-sockets and User Dene Protocol (UDP) packages. Web-sockets are generally used when package delivery is very important, a connection is made with handshakes and acknowledge packages are sent to and fro. This protocol is unnecessarily complicated to implement and it’s functionality will not be fully utilised. UDP packages are a lot simpler to implement: the package is sent on a specific port to a specific IP address. Whether or not the package arrives at its destination is unknown to the client, but packages can be sent at a high frequency to ensure delivery of data, although it might not be package-specic delivery. This functionality is good enough for gimbal control, considering the fact that the frequency at which packages are sent can be defined, and the frequency at which the Arduino microcontroller scans for packages on a specic port can also be defined.

In order to achieve wireless gimbal control, it was first necessary to test wireless control of the gimbal independent of the Google Glass. This was done using a program called SocketTest v.3.0.0 to send commands to the Arduino Mega, which then relayed those commands to the gimbal controller through its UART port. SocketTest can send or receive web-sockets or UDP strings which can be used to command the gimbal through the gimbal controller’s UART port, BasecamElectronics’ serial API library for Arduino was used for that purpose, which can be found here:

BasecamElectronics Serial API Library download: https://www.basecamelectronics.com/serialapi/

The video below shows how wireless gimbal control was tested using the SocketTest program and an Arduino with a Wi-Fi shield. Commands are sent to the Alexmos gimbal controller through its UART serial port.

Wireless Control with Google Glass:

Google Glass applications are fundamentally dierent to other Android applications because Glass has a dierent hardware structure and capabilities. Glass also has a completely dierent design philosophy, and therefore the style in which applications are written dier between Glass and a mobile phone or tablet. Glass has two dierent types of applications, immersion activities and live cards. Immersion activities are the more well-known type of applications where a user enters and exits the application, whereas live cards run in the background, for example a stop-watch. The gimbal control application written for this project is done in a immersion activity, since the user will only be using the Glass to control the gimbal and won’t be relying on multi-functionality or parallel task execution.

The primary IDE used in Android application development is Android Studio which uses Java code for the functionality and structured XML for the user interface or GUI of the application. XML code is used in dierent les to set up the menu ow of the program and denes the visual features and labels on each screen and menu item. The menu flow was based on the functional requirements of the Glass application, and is simple and intuitive to use. Each menu option in the XML code links to a functional Java code le that executes the relevant commands when selected. These commands implement the functionality on Glass to achieve the necessary results.

A screenshot of the view in the Google Glass HUD
A screenshot of the view in the Google Glass HUD

The video below shows how Google Glass controls the gimbal on its pitch and yaw axes. Unfortunately there is too much interference in the lab to use normal head movements (such as looking left and right) to control the gimbal on its yaw axis, since a sensitive magnetometer is used to get those sensor readings.

Below is a video demonstration of my wireless gimbal control project on both the yaw and pitch axes.


Code samples from Beginning Android Wearables by Andres Calvo were extracted and used as guidance for the development of the Glass’ user interface and functionality (Calvo, 2015).

To implement wireless control via Google Glass, code samples from Beginning Google Glass Development by Jeff Tang were extracted and used as guidance for the development of the Glass’ wireless functionality.

Gimbal Stabilisation

The gimbal controller used in this project is the BaseCam Electronics 32-bit three-axis brushless control board with a frame and main IMU. The frame IMU is on board the controller itself, which is mounted on the gimbal, below-yaw (as sown in the figure below). The main IMU is mounted on the pitch axis where it is subject to all three axes’ movements (also sown in the figure below). These IMUs send real-time feedback to the gimbal controller about the orientation of the surface they are mounted on, relative to their calibration orientations. This type of closed-loop feedback is used to implement Proportional, Integral, Derivative (PID) control algorithms which correct for any errors between the target angle and the current angle of the payload. The gimbal controller is power by a 12 volt 3 cell lithium-polymer battery and in turn powers all the other electronics in the system. The PID algorithm is developed by BaseCam electronics, but the PID values are user-dened, depending on the gimbal properties such as weight, size and motor size. The PID calibration process requires some knowledge of PID controllers and the aects that each term has on the control of the gimbal. Each axis’ gimbal motor is tuned independently as to avoid interference from noise of the un-tuned motors.

Gimbal assembly with component labels
Gimbal assembly with component labels

The derivative control acts like a holding brake on the gimbal motors, minimising overshoot. Too high D-value results in high frequency oscillations of the gimbal motor as it tries to correct for overshoot. The Proportional value adds gain to the motor power, which provides torque to correct the error in the motors target angle and its current angle. Too high P-value results in low frequency oscillations of the motor. The Integral value denes the rate at which the motor corrects for an
error, too high I-value could result in low frequency oscillations and overshoot of the target angle. The PID values were iteratively tuned in the order of derivative, proportional and then integral control until eective stabilisation was achieved.

The video below shows the stabilisation characteristics of the gimbal and how effective it is at keeping the payload level.