How It Works
An Arduino microcontroller reads data from an IMU sensor (gyroscope and accelerometer) and sends the orientation data over serial USB to OpenTrack. The HATire tracker parses this data and converts it to head tracking coordinates.HATire supports rotational tracking (yaw, pitch, roll) and can optionally include positional tracking if your IMU has magnetometer or additional sensors.
Requirements
Hardware
- Arduino board: Arduino Nano, Uno, Pro Micro, or compatible
- IMU sensor: One of:
- MPU6050 (gyro + accel, $2-5)
- MPU9250 (gyro + accel + mag, $5-10)
- BNO055 (9-axis with fusion, $20-30)
- GY-521/GY-85/GY-86 breakout boards
- Connecting wires: For I2C or SPI connection
- USB cable: To connect Arduino to PC
- Mounting: Headset, cap, or headband to wear Arduino + IMU
Software
- Arduino IDE for programming the Arduino
- HATire Arduino sketch (available in OpenTrack or DIY community)
- USB serial drivers (usually automatic)
Total hardware cost is typically $5-30 depending on your choices. This is one of the most affordable head tracking options.
Setup Instructions
Build the Hardware
Connect your IMU to the Arduino:For MPU6050 (I2C):For other IMUs: Check the sensor’s datasheet for pinout.
Program the Arduino
- Download HATire Arduino sketch
- Install required libraries (e.g., MPU6050 library from Jeff Rowberg)
- Open sketch in Arduino IDE
- Select your Arduino board and COM port
- Upload the sketch
- Open Serial Monitor to verify data output
Configure Serial Protocol
HATire supports multiple data formats. Configure your Arduino sketch to output:Simple format:Binary format (more efficient):
- Send data as binary struct
- Configure frame start/end markers
- See HATire protocol documentation
Configure in OpenTrack
In OpenTrack tracker settings:
- Serial Port: Select Arduino’s COM port
- Baud Rate: Match Arduino (typically 115200)
- Data Bits: 8
- Parity: None
- Stop Bits: 1
- Flow Control: None
Map Axes
Configure which Arduino output maps to which head movement:Enable/disable and invert axes as needed:
Set Commands (Optional)
Configure commands to send to Arduino:Your Arduino sketch must handle these commands.
Configuration Options
Serial Port Settings
| Option | Default | Description |
|---|---|---|
| Serial Port Name | - | COM port (COM3, /dev/ttyUSB0, etc.) |
| Baud Rate | 115200 | Communication speed |
| Data Bits | 8 | Bits per byte |
| Parity | None | Error checking |
| Stop Bits | OneStop | End of byte marker |
| Flow Control | None | Hardware flow control |
| DTR | false | Data Terminal Ready signal |
Axis Mapping
| Option | Default | Description |
|---|---|---|
| Roll Axis | 1 | Which data channel (0-5) |
| Pitch Axis | 2 | Which data channel |
| Yaw Axis | 0 | Which data channel |
| X/Y/Z Axis | 0 | Position channels |
Axis Control
| Option | Default | Description |
|---|---|---|
| Enable Roll | true | Use roll data |
| Enable Pitch | true | Use pitch data |
| Enable Yaw | true | Use yaw data |
| Enable X/Y/Z | false | Use position data |
| Invert Roll | false | Flip roll direction |
| Invert Pitch | false | Flip pitch direction |
| Invert Yaw | false | Flip yaw direction |
Commands
| Option | Default | Description |
|---|---|---|
| Init Command | "" | Sent during initialization |
| Start Command | "" | Sent when tracking starts |
| Stop Command | "" | Sent when tracking stops |
| Reset Command | "" | Sent to reset IMU |
| Center Command | "" | Sent to recenter view |
| Zero Command | "" | Sent to zero position |
Timing
| Option | Default | Description |
|---|---|---|
| Init Delay | 0ms | Wait after init command |
| Start Delay | 0ms | Wait after start command |
| Sequence Delay | 0ms | Wait after each command |
Advanced
| Option | Default | Description |
|---|---|---|
| Big Endian | false | Byte order for binary protocol |
| Enable Logging | false | Log serial data for debugging |
Example Arduino Sketches
Basic MPU6050 Example
Using MPU6050 DMP
IMU Sensor Comparison
| Sensor | Cost | Axes | Features | Difficulty |
|---|---|---|---|---|
| MPU6050 | $2-5 | 6-axis | Gyro+Accel, DMP | Easy |
| MPU9250 | $5-10 | 9-axis | +Magnetometer | Medium |
| BNO055 | $20-30 | 9-axis | Built-in fusion | Easy |
| LSM6DS3 | $5-8 | 6-axis | Low power | Medium |
| ICM-20948 | $10-15 | 9-axis | Newer MPU9250 | Medium |
Recommended for beginners: BNO055 (easier) or MPU6050 with DMP (cheaper)
Advantages and Limitations
Advantages
- Very low cost ($5-30)
- No line-of-sight required
- Works in any lighting
- Rotational tracking only (no marker)
- DIY-friendly and customizable
- Educational/learning opportunity
- Low latency (~20ms)
- Lightweight on head
Limitations
- Rotation only (no position tracking)
- Gyro drift over time
- Requires DIY assembly
- Programming knowledge helpful
- Magnetometer affected by metal
- Sensor calibration needed
- Wired connection (USB cable)
- Less accurate than optical tracking
Troubleshooting
Serial port not detected
Serial port not detected
- Install USB drivers for Arduino (CH340, FTDI, etc.)
- Check Device Manager (Windows) or
ls /dev/tty*(Linux) - Try different USB port
- Verify Arduino is powered (LED should light)
- Check USB cable (some are charge-only)
No data received
No data received
- Open Arduino Serial Monitor to verify output
- Check baud rate matches in OpenTrack and Arduino
- Verify serial format matches expectations
- Check enable logging in HATire settings
- Look for parse errors in logs
Tracking drifts over time
Tracking drifts over time
- This is normal for gyro-only tracking
- Implement complementary or Kalman filter
- Add magnetometer for yaw stability
- Use sensor fusion (DMP, Madgwick, Mahony)
- Recenter view regularly
- Calibrate IMU properly
Jittery or noisy data
Jittery or noisy data
- Enable low-pass filter in IMU configuration
- Increase averaging/smoothing in Arduino code
- Use sensor fusion algorithm
- Enable filtering in OpenTrack
- Check for loose connections
- Shield from electrical interference
Wrong axis orientation
Wrong axis orientation
- Check axis mapping in HATire settings
- Try inverting problematic axes
- Verify IMU mounting orientation
- Adjust coordinate system in Arduino code
- Use debug mode to see raw values
I2C communication errors
I2C communication errors
- Check wiring connections
- Add pull-up resistors if needed (4.7kΩ)
- Reduce I2C clock speed in Arduino
- Keep wires short (<15cm ideal)
- Check for loose connections
Advanced Topics
Sensor Fusion
For stable tracking, implement sensor fusion:-
Complementary Filter: Simple, fast
-
Madgwick Filter: Better accuracy
- Use Madgwick library
- Provides quaternion output
- Moderate computational cost
-
DMP (Digital Motion Processor): MPU6050/9250
- Hardware sensor fusion
- Best accuracy for MPU chips
- Use I2Cdevlib library
Wireless Options
Make your tracker wireless:- Bluetooth: HC-05/HC-06 modules
- ESP32: WiFi + Bluetooth built-in
- nRF24L01: 2.4GHz wireless
- Battery power: LiPo battery + charging circuit
Position Tracking
Add limited position tracking:- Double integrate accelerometer (accumulates error)
- Use ultrasonic sensors for distance
- Add magnetometer for absolute reference
- Combine with camera tracking for hybrid system
Community Resources
Arduino Sketches
- EDTracker project
- OpenTrack forums
- GitHub repositories
- Arduino forums
3D Printable Cases
- Thingiverse
- Printables
- Custom designs
- Mounting brackets
Comparison with Other Trackers
| Feature | HATire | PointTracker | NeuralNet |
|---|---|---|---|
| Tracking type | Rotation only | 6DOF | 6DOF |
| Hardware cost | Very Low ($5-30) | Low-Medium | Very Low |
| DIY required | Yes | Some | No |
| Setup difficulty | Medium-Hard | Medium | Easy |
| Drift | Yes (gyro drift) | No | No |
| Line of sight | Not required | Required | Required |
| Latency | Low (~20ms) | Very Low (~10ms) | Medium (~50ms) |
| Accuracy | Medium | Excellent | Good |
Tips for Best Results
- Sensor Choice: Start with BNO055 for easiest setup, or MPU6050 for lowest cost
- Calibration: Properly calibrate your IMU (follow sensor datasheet)
- Sensor Fusion: Use DMP or complementary filter for stable output
- Mounting: Mount IMU rigid and close to head rotation center
- Update Rate: 50-100Hz is sufficient, faster uses more power
- Filtering: Enable both Arduino-side and OpenTrack filtering
- Cable Management: Use flexible cable, strain relief at connections
See Also
- FreePIE UDP - Alternative for wireless IMU setups
- PointTracker - For 6DOF position tracking
- Hardware Guide - General hardware information