cazacov / HoloControl

HoloLens input device

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My son testing the new controller

HoloControl

HoloLens input device based on Wii Nunchuk controller.

  • Adds two buttons and joystick functionality
  • Wireless connection over Bluetooth
  • Low latency, reaction time < 1/20 second
  • Easy to use in Unity, no external dependencies

Demo Video

Alt text

How it works

Overview

  • Arduino board reads button state from nunchuk over I2C protocol.
  • Arduno translates key press events in USB HID codes and sends them to EZ-Key board over serial interface.
  • Bluefruit EZ-Key board appears like an external keyboard in the list of available Bluetooth devices on the HoloLens.
  • Standard Bluetooth pairing, no PIN required. If something goes wrong there is Pair button on the EZ-Key board to restart the connection.
  • For Unity scripts the HoloControler looks like normal key press events coming from a keyboard.

First prototype

Prototype

Hardware

Parts list

Part Price in EU Comment
Wii Nunchuk 10 € Got one in perfect condition on Ebay
Arduino Mini 3.3V/8MHz 9.50 € Reads data from the Nunchuk
Bluefruit EZ-Key 21 € Bluetooth HID Keyboard Controller

You will also need FTDI cable to program Arduino Mini. It's also possible to use regular Arduino as programmer.

Wiring

Wired version

Circuit diagram

It's also possible to make it completely mobile by adding LiPo accumulator and charge controller, but then you'll need a 3D printer to print bigger case.

Arduino stacked on the top of EZ-Key board. I put a piece of plastic between boards for electrical isolation.

Boards

Nunchuk board pinout.

Nunchuk board

Electronics nicely fits into original nunchuk case.

Assembled controller

Firmware

Arduino sources are in the "Arduino" folder.

The easiest way to program Arduino Mini is using FTDI cable. It's also possible to use USB<->Serial adapter or Arduino UNO as programming device.

Be sure to choose correct board type in the Arduino IDE

Arduino IDE settings

Using in Unity

The controller simulates keys strokes on a Bluetooth keyboard. Joystick directions are translated in A, D, W, S keys. Z button is mapped to Return and C button to Escape.

You can get key state with the standard UnityEngine.Input class:

if (UnityEngine.Input.GetKey(KeyCode.A))
{
	// Joystick left
	...
}

if (UnityEngine.Input.GetKey(KeyCode.D))
{
	// Joystick right
	...
}

Demo Unity project is included.

Wired version

Still needs cable for power supply (USB plug A).

HoloController

Wireless version

Adds LiPo accumulator and charging controller.

Coming soon.

About

HoloLens input device

License:MIT License


Languages

Language:C++ 90.4%Language:C# 9.6%