Headtracker: BOSCH Sensortec BNO055

for the headset i need a headtracking solution.

The IMUs have problems with drift in horizontal and that makes manual centering via custom key set needed.
I could notice that drift with the usb headtracker from ZEISS.
https://www.heise.de/newsticker/meldung/Zeiss-Headtracker-kommt-im-April-1817672.html

Maybe the drift is more or less, depending on a calibration after powering up the device, 10 seconds none moving. And maybe i will give it a second try?

BUT again..
i thought about TrackIR – its expensive solution, without look over shoulder feature.
i thought about EDtracker a arduino solution with MPU-9250
https://hobbycomponents.com/electronics/440-diy-head-tracker-bundle
which seems well supported by the german team from:
https://elitedangerous.de/forum/index.php?board/43-head-tracking-eye-tracking/
while edtracker founders withdrawed.

and while looking through internet i came around with the BOSCH Sensortec BNO055
„Smart sensor combining accelerometer, gyroscope, magnetometer and orientation software“
https://www.bosch-sensortec.com/products/smart-sensors/bno055.html

This IMU has many great features that should be a better solution to me.
– a auto calibration
– python libs
– community support
– hight refresh rate
– fusion data, quaternions to euler
this all was interesting enough to me to give it a chance , and i ordered the USB Stick Evaluation Version, red USB3.0 version, from Digi-Key for 50,-€ incl. shipping from USA. Shipping was very fast within 3 days!

the BNO055 is available in different styles
– the BOSCH evaluation USB Stick green USB2.0 only, red USB3.0
– Arduino breakouts from adafruit and others
– Arduino Professional Series: IoT MKR https://store.arduino.cc/arduino-mkr-imu-shield
– and as chip alone

BOSCH Sensortec – Calibrating BNO055
https://www.youtube.com/watch?v=Bw0WuAyGsnY
NDof FMC OFF
NDof FMC ON
NDof Nine Degrees of freedom
FMC = Fast Magneto Calibration

Paul McWorther uses BNO055 with Arduino and explains equations.. great stuff ;o)

there are documentations from BOSCH and code examples in the internet.
Finally it was a trail within 4 days to get the device working in streaming mode on a windows pc using python 3, build up on existing scripts, modified by me.

First we need to install the BOSCH Sensortec Development Desktop 2.0.
https://www.bosch-sensortec.com/software-tools/tools/development-desktop-software/
When it is installed we can run the programm and connect to the USB Stick. For me the USB connections failed , but COM3 worked.

In the installation folder structure of Development Desktop 2.0 we find the .dll and PDF manual for a first small python script.
Is started with python version2.
The script was not fully ready to go, and did not contained full fledged support of everything the bno055 delivers.

From that point i looked through various examples for arduino, and found BOSCH github repository
https://github.com/BoschSensortec
https://github.com/BoschSensortec/BNO055_driver

the .h header file gives impression on whats all possible, the registers and values, functions…

and then, there is BOSCH sensortec forum:
https://community.bosch-sensortec.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&filter=location&location=category:bst_community&q=bno055
where some usefull information is located.

this post contains a zip with python example using the co called „GenericAPI“,
https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BNO055-USB-Stick-USB-3-APIs/m-p/6166

finally i got a full fledged python3 script into my hands,
bno055_usb_stick_py-0.9.5
https://pypi.org/project/bno055-usb-stick-py/
that was intended for linux.
so i had to install python3, comes ready with pip inside, batteries included ;o)
then installed pyserial … (py -m pip install pyserial)
then outcommented linux lib „pyudev“(that needs linux only „fcntl“) and setted manual values in the autodetec function to use COM3…
from that point it was working in streaming mode.

from there is used a while loop with sleep 0.01,
and reading stream 10 packages,
read the euler values and converted them in usefull representation for
Virtual Joystick vJoy
http://vjoystick.sourceforge.net/site/

vJoy gives us the possibility to simulate a Joystick Device within python.
So i update the 3 axis of that virtual joystick.

Next step is simple.. using OpenTrack
https://github.com/opentrack/opentrack/releases
to read the input from that (virtual) Joystick and make output for „freetrack2.0 enhanced“.
Figure out some settings in OpenTrack and i was ready to go, to use it within in WarThunder.

i could use simlulating mouse input using python, but OpenTrack gives already some usefull features (axis mappings and much more) and outputs comon protocolls.

PS:

i still used Euler values because i dont need endless rotations, and i mapped the euler values to suitable values for my aim to use as headtracking look around with feature of „look over shoulder“ with 1:1 ratio of Head-View-Alignment.

Python for programming Arduino

you can plug arduino via usb to a computer/laptop to use the computer/laptop for the main programm logic, using arduino only as sensor&actuator…

but powering an laptop all time..

hmm.. is there anything out there, using Python directly on the arduino?

you could use a cellphone/handy with symbian S60 and nokias DeveloperKit

arduino + Symbian S60
http://www.developer.nokia.com/Community/Wiki/Communicating_with_Arduino

or something more like this, python on a chip
arduino + py-on-a-chip
http://code.google.com/p/python-on-a-chip/
https://xcore.com/projects/python-chip

so i am waiting for a extra ArduinoPythonShield, in the plug and play way…
that would be great.. solving many starting problems with C/C++
having more fun, faster results..

Python serial read for Arduino



# -*- encoding: utf-8 -*-
#

import sys
import time
import serial

print "ok"

# Parameter von Konsole entgegennehmen
#if len(sys.argv) != 2:
#   print "you have to pass the name of a serial port"
#   sys.exit(1)
#serial_port = sys.argv[1]

serial_port = "COM13"
arduino = serial.Serial(
   serial_port,
   9600,
   serial.EIGHTBITS,
   serial.PARITY_NONE,
   serial.STOPBITS_ONE)
   
time.sleep(2)

# continous read
line = arduino.readline()

while len(str(line))!=0:

      line = arduino.readline().rstrip()
      print line
      
#
###