Skip to content
C Other
  1. C 97.7%
  2. Other 2.3%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Restart. Jul 1, 2016
docs Add hardware link + pictures. Jul 2, 2016
lib/nrf51822 Restart. Jul 1, 2016
scripts
src
.gdbinit Restart. Jul 1, 2016
.gitignore Restart. Jul 1, 2016
Makefile
README.md

README.md

~ Twiz ~

twiz_top twiz_bottom

Abstract

Twiz is a wireless motion sensor sending its data using Bluetooth Low energy.

Its Inertial Measurement Unit has 9 degrees of freedom and the fusion of its sensors (3D accelerometer + 3D gyroscope + 3D magnetometer) is made on board.

The fusion result is sent as Euler angles, telling how it id tilted compared to the gravity vector and how it is oriented compared to the north pole.

This repository contains the firmware but the hardware is open source too, it can be found on upverter.

Details

The data sent is as follow:

* 3D accel values
* 3D Euler angles

These values are advertisement in the manufacturer data packet as 12 bytes representing 6 signed integers, each of them being normalized on 16 bits:

* Order of the data: 0011 2233 4455  AABB CCDD EEFF
                     x    y    z     yaw pitch roll
                     [accel values]  [euler angles]

* accel values range: [-2.0 g ; +2.0 g[

* euler angles range: [-180.0 ; +180.0[

Note: the range of a 16 signed bit value is [-2**15 ; 2**15 - 1]

Examples:

1 ) If we look at the bytes #4 and #5, we get z = 0x4455. To get the acceleration value, the calculation is:

z_accel = 0x4455 * 4.0 / 2**16
        = 17493  * 4.0 / 2**16
        = 1.0677 g

Note: When the sensor is horizontal with the battery below, z should be -1.

2 ) To get the yaw angle, corresponding to 0xAABB in our example:

yaw_angle = 0xAABB * 360.0 / 2**16
          = -21829 * 360.0 / 2**16
          = -119.9 degrees

Note: the accuracy of magnetometers is not that great yet, the fusion with the gyroscope improves it but decimals are not hugely relevant.

BLE services

  • IMU data stream: accel + attitude (same as in advertizing)
  • GPIO:
    • LED: write
    • button: read
  • UART:
    • TX: write
    • RX: read
You can’t perform that action at this time.