Orientation sensors are popular in e.g. flight control and mobile phones. This sensor uses a MPU 9250 which consists of a Gyroscope/ Accelerometer/ Magnetometer (compass) and BMP280 - barometer/ temperature. The board in the aliexpress link in BOM works on 5 and 3.3V and includes sufficient pull-up for I2C high speed.
This is an advanced device which makes it possible to determine the exact orientation/ movement and altitude.. Mounted to @GertSanders "Battery based atmega328p sensor" this makes a perfect "Orientation sensor" with a simple I2C interface.
In the video you can see the sensor at work with a two servo pan/tilt actuator.
As there (currently) is no "Orientation type" for MySensors I have created my own type as a subset from the V_TEXT type. V_ORIENTATION = Yaw ; Pitch ; Roll
Yaw - for the orientation in the vertical plane Pitch - orientation in the horizontal plane Roll - the position of the object (e.g. aircraft) around its own axis. (not used in the example)
The "Modern devices - motion plug" Arduino library is used to read the sensor and have acceptable position readings. The Yaw, Pitch and Roll are calculated from the 9 axis readings of accelaration, magnetic field an gyroscope and are pretty stable. For who is interested in the theory & calculations ;) quaternions
The sketch sends the values if there is a more than one degree change in any direction.
As (currently) no controller can handle the V_ORIENTATION type the information is send directly to a node/actuator.
An example will be published separately as "Orientation actuator".
|Qty||Value||Device||Package||Parts||Description||MF||MPN||Aliexpress or ebay link|
|1||Custom||Battery based atmega328p sensor board, populated||Custom board||GertSanders board or any MySensors Board with radio||https://www.openhardware.io/view/5/Battery-based-atmega328p-...|
|1||MPU9250||10DOF I2C board||Board||Combined 9 axis / barometer board||AliExpress: http://nl.aliexpress.com/item/MPU9250-BMP280-SPI...|
|4||Dupont wires||Female/ female to connect I2C|