/Interface_Design

LIDAR MPE Interface which tracks objects within a given range and translates their position over time into midi data for use with any device that accepts USB midi

Primary LanguageC++

MPE LiDAR Midi Interface

Interface Final Teaser Thumbnail

Purpose

This device tracks objects within a given range and translates their position over time into MIDI data for use with any device that accepts USB MIDI. It is easily reproducible with 3D printing and commonly available parts. The device is designed to run without any reprogramming by the end user, but the open-source nature allows for deep customization if you so choose.

Applications

  • Parameter modulation based on how members of a band move around on stage
  • Allowing dancers to play chords and notes based on their choreography without needing to wear sensors
  • Control of the sound in an art installation based on audience movement
  • Audience feedback that can control an aspect of the overall performance sound

Fabrication

Required Parts

I will list the McMaster-Carr parts out in a table by individual pieces, as they may be easy to substitute with something you have on hand, and ordering packs of 50-100 just for this project could quickly double the budget.

Quantity Part # Description
4 98952A106 Aluminum Male-Female Threaded Hex Standoff, 4.5mm Hex, 8mm Long, M3 x 0.50 Mm Thread
4 91290A113 Alloy Steel Socket Head Screw, Black-Oxide, M3 x 0.5 Mm Thread, 8 Mm Long
6 91290A111 Alloy Steel Socket Head Screw, Black-Oxide, M3 x 0.5 Mm Thread, 6 Mm Long
3 91290A572 Alloy Steel Socket Head Screw, Black-Oxide, M3 x 0.5 Mm Thread, 15 Mm Long
1 90611A112 Screw-Mount Nut, Steel, 1/4"-20 Thread, 0.313" Diameter x 1/4" High Barrel
13 97258A101 18-8 Stainless Steel Thin Square Nut, M3 x 0.5 Mm Thread
7 91290A102 Alloy Steel Socket Head Screw, Black-Oxide, M2.5 x 0.45 Mm Thread, 8 Mm Long
7 90710A025 18-8 Stainless Steel Thin Hex Nut, M2.5 x 0.45 Mm Thread, Din 439B, Iso 4035

3D Printing

The enclosure is printed in PETG for better durability and resilience to heat. I printed using a Prusa Mini+ and Prusament. The GCode for that combination is included in this repository, along with .3mf files, which contain prusa slicer projects that you can customize to your needs. Please be aware that in order to achieve a clean look, the print is set to pause whenever a square nut needs to be inserted in the body. If you tweak the settings, those pause points will likely be inaccurate, so you will need to reset them. I'll post further documentation on that process in the 3D_Print folder. For now, you will just find two sets of files, as the print is split between top and bottom.

Top Print Preview

Bottom Print Preview

It is also important to note that there is a long, thin bridge where the top of the LCD screen sits, and the best way I found to get it to print was using the organic supports, which are now available in the stable build of PrusaSlicer.

Custom PCB

PCB

This is more of a breakout board than anything and is at the top of my priority list for a revision as I'd like to make the internal USB connection cleaner and add the ability to use some better libraries to drive the screen. It is fairly cheap to manufacture through a company like JLCPCB and I have included the Gerber files in the PCB folder. Simply upload them to the website and pick what color you want the board to be.

Soldering

I will expand on this section in the coming weeks, but the main soldering can be broken down into 4 groups:

  1. Cut micro USB cable soldered to USB C breakout board
  2. Soldering all the pins to the custom PCB
  3. Desoldering the header pins that came with the LCD and soldering the Molex connector on (this can be skipped if you aren't concerned about cables coming loose inside)
  4. Cutting the default RPLiDAR cable and resoldering it to the right wire gauge/connector for your board

Assembly

This area needs detailed photos of the assembly steps, so until I have those, here is an exploded view from Fusion360.

Main.Assembly.v20_1.mp4

Software

Building and Installing

This project uses Platform.IO and CLion, though VSCode shouldn't be an issue. The most important thing is just to make sure platform.io is installed and configured correctly. Then, you should be able to clone the repository, and your IDE will do the rest of the work. I will also put compiled versions in the release area in case you just want to use teensy loader to flash the device without changing the code.

Code Organization

  • ZGLidar : Handles management of the physical lidar device and pulls data off the serial buffer.
  • ZGObjectTracker : This analyzes point cloud data from the lidar and attempts to match objects' positions over time. Holds all tracked objects and tells them when they are no longer relevant
  • ZGObject : Represents a tracked point and manages all midi updates and signals throughout its lifetime. It only requires updated coordinates to derive further parameters that it needs to send
  • ZGDisplay : This manages the real-time data display and touchscreen menu
  • ZGConversionHelpers : Inline functions that are useful in multiple objects

Touch Screen Options

  • Gear Icon : Brings up the main menu
    • SCAN : Contains settings related to LiDAR data processing
      • Range - Sets the maximum detection distance for object tracking
      • Algorithm - Switches between Distance (Low Latency/Low Accuracy) and DBSCAN (High Accuracy/10-20ms added latency)
    • MIDI : Contains settings that modify the Midi being sent as a result of processing the data
      • Root Note - Sets the note that will be assigned to the 0-degree position
      • Scale Type - Changes the number of notes in a 360-degree pattern and the offset for each degree to quantize to a scale mode
    • DISPLAY : Contains settings that modify the information displayed during real-time updates
      • Main View - Allows the user to select between a plot of tracked points and a debug screen outputting latency measurements
    • ABOUT : Contains info about the project and current version

Next Steps

  • Full code documentation
  • Custom PCB revision
  • Detailed Assembly Guide
  • Updated GUI framework
  • More touch-friendly GUI design
  • More user control over MIDI
  • Ability to set scan exclusion zones for use in smaller spaces