Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By zz9pa
#41089 Hi,
I used stock MPU6050 and i2c libraries - and made a tiny modification to one of the examples (MPU6050_DMP6.ino) to get opentrack head tracking working via UDP.

If you Google for "Ed Tracker" - its pretty much the same sort of thing, only theirs is much much better!

Its not calibrated properly - and "drifts" over time (google around - there might be a fix somewhere).
I only knocked it up as a play thing, I don't intend to maintain/improve it...

I don't have any setup/config in there - the ssid/password and PC are all hard coded in the sketch.

You should see these lines which will need changing




WiFi.begin("ssid", "password");
...
port.beginPacket("192.168.2.10",remotePort);


And you'll need to adjust :
Wire.begin(0,2);

for I2C configuration, depending on how you wire up the sensor.


Which are the I2C pins, the Wifi setup and the remote PC to send the data packets to.

With that all working - start opentrack on the PC you setup in "beginPacket", move the sensor - and the octopus should move. The sensor seems to take a little while to warm up - and at least on mine - I get yaw drift for a few minutes during this phase - after that - it gets more reliable.

In opentrack set :

Tracker: FreePIE UDP receiver
Protocol freetrack2.0 enhanced

Make sure you set a "center" key in the options (with the drift - you'll need it) - then "start".
Depending on how you place the sensor - you might need to adjust the pitch/roll/yaw options (On mine - I needed to invert pitch and roll).

Then start your game (I'm playing with Elite Dangerous) and move your head :)


[ Uploaded with a .txt extension - it should obviously be .ino - but the forums block that extension ]
You do not have the required permissions to view the files attached to this post.
User avatar
By OndrejB
#60686 Hello,

thanks for this sketch, I am thinking of the same thing, but with MPU-9250 with integrated compass, so it should be drift free.

Actually my Wemos D1 Mini should arrive in 1 or 2 days, so I will start experimenting (I am absolute beginner, but I hope I will sort it out. :D)
User avatar
By rudy
#70851
I am thinking of the same thing, but with MPU-9250 with integrated compass, so it should be drift free.

They all will drift no matter how good a sensor. There needs to be a real reference in order to get rid of drift. Optical is the most common.