Inspired by my friend´s overpriced acquisition of a motion capture suit, I started looking into alternative motion tracking hardware solutions, that could be built with a fraction of the suit´s price. My ambition was to create a more flexible platform, compatible with any number of cheap, Open Source tracking nodes.
My journey started with preassembled MPU6050 sensor PCB modules. They include all basic sensor periphery in a small and price effective package, are ideal for tests and are sometimes be found in final production devices.
The MPU6050 is a MEMS gyro/accelerometer with 6 DOF, which targets mobile devices and consumer drones for orientation tracking and inertial guidance purposes. After selecting this mid-priced module, the initial implementations of the wireless data links with GY-521 sensor board involved communication over serial, UDP/OSC as well as Google Firebase were built on ESP32 based prototypes, which performed in a stable way.
Further development was focused on a less bulky and power hungry solution. It was shown that the ESP-01 module is reliably capable to uphold an outgoing connection via UDP/OSC, which made it an acceptable compromise for the majority of use cases, considering the price and size of the module.
Given its two cores, the ESP32 shined in applications that involve intensive bidirectional communication. While one of the cores can be tasked with processing and serving incoming (XML)http requests over WiFi (a routine that otherwise becomes blocking under load), the other core handles the sensor readout. With GY-521 this can be done in few lines of simple library calls. The second method utilizes interrupts and I²C register manipulations allowing for time critical readouts on highest frame frequencies.
One of the ESP-01 specialties – the need for an external power regulator pushed the miniaturization effort further towards a small fabricated motherboard: a PCB measuring 16mm x 20mm to house the AMS 11117 power circuitry and organize the interconnection of comprising parts in a most compact way.
Paired with 1000uF film and 0.1uF ceramic capacitors, the voltage regulator provides a stable 3.3V source from a variety of potential inputs, ranging from USB to 12V. An optional small switch provides a convenient way to turn device power on and of. If switching is controlled otherwise, its pads on the PCB should be bridged out.
Serial Communication
Second to blinking the onboard led, successful data acquisition over serial is a very relieving feeling. Establishing I²C communication on ESP controllers is a straightforward process. This was also the case while pairing the GY-521 sensor with DOIT ESP32 dev board. Being an overkill power- and dimension-wise it was a great debugging platform, which later was downgraded to ESP-01.
Google Firebase
The usual experience of n the fly data structure implementation with Firebase worked out again: using a well-documented wrapper library for ESP32 , basic NoSQL CRUD interaction was done without much debugging. Although max. throughput of one transaction per node per second was not sufficient for the specific purpose of real-time motion capture, the universal and scalable nature of this serverless solution impressed me once more.
OSC/UDP over Wi-Fi
Given its two cores, the ESP32 shined in applications that involve intensive bidirectional communication . While one of the cores can be dedicated to processing and serving incoming (XML)http requests over WiFi (a task that very fast becomes blocking under load otherwise), the other core handles the sensor readout. With GY-521 this can be done in few lines of simple library calls. The second method utilizes interrupts and I²C register manipulations allowing for time critical readouts on highest frame frequencies.
A convenient way to stream out the retrieved and normalized information is via the OSC protocol. Applicable to several artistic environments, such as DAWs, real-time game engines and digital systems for performance and gesture control.
Infrastructure that builds on instant state propagation between a mesh of sensors, backend and frontend is everywhere. Being able to implement an own instance of such, in a universal and effortless manner is an interesting experience and definitely feels like future. The exact interfacing pin sequence of the node PCB ( VCC / GND / SCL / SDA ) is commonly used by a lot of I²C periphery manufacturers, bearing potential for plug and play adaptation of other sensors in similar scenarios.
Next iteration
Hardwarewise the system could be shrunk down even more by unifying all three components: power, esp and sensor on one board. Current layouts of those PCB components also potentially allow for much higher component density. Integration of a Li-Ion charge/discharge controller is also a high priority task. Further firmware optimization will be focused on interrupt-based readouts in order to harness the maximal sampling frequencies and true real-time operation.
Bill of materials
- Mocap Node PCB
- MPU6050 sensor board aka GY-521
- ESP-01 module
- ESP-01 usb programmer
- 2×4 female pin header
(pitch 2.54mm) - 100nF capacitor (104)
- 1000uF capacitor
- AMS 1117- 3.3 voltage regulator
- Optional: shrink tube, 3 pin switch, 2×1 male pin header, power bank, wires.