When flying real aircrafts, pilots rely on plethora of Flight Instruments. Most Radio Controlled hobbyist however are limited to maintaining visual contact with their drone in order to conduct flight. This makes flights under nighttime or low visibility conditions a challenge.
My project aims to solve this problem in a fun way. It will enable realtime 3D representation of quadcopter's orientation on your Android screen. Altitude is calculated from Absolute Digital pressure sensor. Other useful telemetry from various sensors onboard Hexiwear is displayed as an overlay.
Hexiwear is compact, lightweight and battery powered, which makes it ideal for mounting onto a Quadcopter or airplane.
Hexiwear boasts triple-axis Accelerometer, Gyroscope and Magnetometer. Combined with barometric pressure sensor, it is enough raw information to build an impressive 10 Degree of Freedom (3+3+3+1 DOF) Inertial Measurement Unit for sensing full range of motion. Given only triple-axis Accelerometer and Gyroscope (6 DOF), you can balance a Quadcopter or a Segaway™ Hoverboard.
Given 10DOF you can build inertial navigation that doesn't rely on GPS! like this.
OrientationOrientation is measured using accelerometer and gyroscope sensors on Hexiwear.
Gyroscope
Conceptually gyroscope is similar to the ride shown in picture below where the central part is free to move irrespective of its outer frame.
Once spinning, the orientation of this axis is unaffected by tilting or rotation of the mounting, according to the conservation of angular momentum.
In semiconductor chips like the one on-board Hexiwear, gyroscope does not have spinning wheels instead it is based on Microelectromechanical technology. It essentially contains very small vibrating arms. When device is rotated, the small changes in vibration are amplified, cleaned and measured as shown in below diagram.
Accelerometer
Solid state accelerometer have an electrode that has enough mass to move up and down very slightly when you move or tilt the accelerometer, shown in red. The electrode is supported by a flexible beam. There's a second electrode, shown in yellow, that work together as a capacitor.
The movement of mass produces slight variations in the capacitance which is amplified and refined with the help of support circuitry.
The accelerometer chip used in Freedom board is a FXOS8700CQ. it is a s 3-axis, accelerometer and 3-axis magnetometer combined chip. The chip talks to MCU via I2C interface.
Combining Accelerometer and Gyroscope
Accelerometer data is not always reliable. The reasons are :
- Accelerometer measures force, gravitation or movement of the device can change readings.
- Accelerometer tend to be sensitive to vibration and mechanical noise
The gyroscope is relatively immune to the above mentioned issues. However gyroscope can suffer from some different issues:
- Gyros can drift where the reading does not return to zero after motion stop
- Gyro reading can change with temperature or during power cycles.
- Gyro readings can fluctuate along a pattern. Mathematically it looks very similar to a fluctuating a stock price on NASDAQ, like the once shown below:
In summary, accelerometer data is generally reliable in long term, while gyroscope data is more accurate in the short term. This represents a case where you have two different measurement sources and the noise properties of the two measurements are such that one source gives good information only in low frequency region while the other is good only in high frequency region. In this situation we can use a technique called Complementary Filter.
Altitude
In the field of Aeronautical Engineering, there are two instruments used to measure altitude, GPS and Pressure Sensor. Similar to what discussed in last section, GPS is good for low frequency measurement while Pressure Sensor is reliable for high frequency. They are to be combined in Complementary Filter to get a reliable altitude estimation.
Hexiwear only has Pressure Sensor and no GPS. So we have to make do, with the understanding that readings from pressure sensor will only provide us with altitude changes relative to a reference point. For example RC Quadcopters have typical fly time of 10mins. If we note the reading when aircraft is resting on ground and consider it zero then just track how readings change during flight. The below formula can be used to convert pressure reading to altitude:
altitude = 44330 * (1.0 - pow(pressure/1013.25, 0.1903))
where Sea Level Pressure is assumed to be 1013.25 millibar.
ArchitectureBelow is a simple diagram to show the flow of data in this project:
Restore factory image
Install mbed serial driver for Hexiwear Docking station. If you didn’t already have that, you can download drivers from here:
https://developer.mbed.org/handbook/Windows-serial-configuration
The factory image file for Hexiwear is available for download here:
https://github.com/MikroElektronika/HEXIWEAR/blob/master/SW/binaries/HEXIWEAR_MK64.bin
Preparing Hexiwear
Toggle sensor tag ON:
Go to Settings and toggle Bluetooth ON:
Preparing Android Device
- Go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
- Enable USB debugging on your device by going to Settings > Developer options.
- Connect to your Android device to your PC
Preparing Host PC
- Clone git repo on your PC
- Download and Install Android Studio using these instructions
- Import project from WolkSense-Hexiwear-/android into Android Studio
- Download any required packages and updates if prompted.
- Build Project
- Run on the connected Android device, select 'yes' to any prompts on device
Pair with Hexiwear
- The app will prompt to turn ON the Bluetooth on your phone
- Log-in to your WolkSense acconut (first time users will need to register, it's free)
- From the main screen, swipe down to scan for available Hexiwear devices; select one.
- A six digit passkey will appear on Hexiwear's display. At the same time the smartphone app will prompt you to type in the passkey.
- Hexiwear is now connected to your smartphone. Sensor readings will appear shortly.
Receiving Data
- Tap on bounded device and select "Individual sensor readout"
- You should see readings from temperature, humidity and other sensors, hit back.
- Now tap the device and select Telemetry
You should now see the 3D representation of data:
I designed and 3D printed custom mounts to install the Hexiwear on my Quadcopter. Yours might be slightly different. You can use the provide Autodesk 360 design to modify it to your needs.
Comments