• Trill
  • Radial sliders with Trill

I would like to build a radial slider menu will the Trill. I have a Trill Craft for prototyping with copper tape (and would later like to use a Trill Flex with custom PCB). I was wondering if the code provided with the Trill sensor supports radial menus like the one shown in the reference of the Cypress chip:

Please note, that I would like to build a very small radial slider with only 8 touch areas (like shown in the picture).

    matboe You may want to look at the Trill Ring for reference.

    @max How would I use the code of Trill Ring with just 8 channels using Trill Craft hardware?

    matboe like the one shown in the reference of the Cypress chip:

    Not sure what piece of literature you refer to.

    Are you intending to compute a value indicating the position of the finger on the circle? Or do you just need to know when the finger crosses boundaries between sectors?

    The pads on Trill Ring have a different geometry from your image and have much higher density (28 pads across a circle with a 5 cm diameter), but you may still find it useful to use the CentroidDetection class, which is (sort of) used on-board Trill Ring. Here's an example using that library to create a slider using selected pads of Trill Craft: https://github.com/BelaPlatform/Bela/blob/master/examples/Trill/custom-slider/render.cpp
    In order for it to work with a circular pad array, you'll need to call cd.setWrapAround(1) after the cd.setup() call.

      giuliomoro I was referring to the manual of the Cypress chip, which was referenced in the Settings and sensitivity article.

      Is the layout of the pads on Trill Ring available somewhere? I am building a very tiny ring an cannot add too many pads (at least not by manually cutting the copper tape). I am not necessarily interested in the exact position, I would rather (on a flat ring) like to know how many fingers are touching.

      Thanks for sharing a ref to the code! I'll look into that.

        matboe Trill Ring available somewhere?

        https://github.com/BelaPlatform/Trill/tree/master/hardware/ring

        matboe I would rather (on a flat ring) like to know how many fingers are touching.

        That's fine, but keep in mind that in order for two touches to be detected as separate, you need them to be spaced by at least one "sector". If you don't care about touch position, you may even try to skip CentroidDetection and simply look at the DIFF readings and count how many of the readings are above a certain threshold.

        Okay, for a full pad to have space between the fingers: do you have any suggestion how small/thin I can make them? And does pad size in relation to cable length play a role?

          matboe do you have any suggestion how small/thin I can make them?

          As thin as you can, really. The thinner the pads, the higher the spatial resolution. Cables are themselves part of the sensing surface, so the longer the wire the larger the baseline capacitance of the pad. However, as long as the cables are tidied up and taped or otherwise locked in place, this shouldn't be a problem, as long as you use DIFF mode and the prescaler is appropriate.

          Thanks a lot! Would it also be possible to seamlessly combine two or more Trill sensors for building kind of a mega ring, i.a. lager diameter and more pads (to keep resolution)? I would have to feed in the sensor data of two (or more) trills.

          a month later

          giuliomoro

          I am using platformio with the Trill lib configured as
          [env:esp12e]
          platform = espressif8266
          board = esp12e
          framework = arduino
          monitor_speed = 115200
          lib_deps =
          belaplatform/Trill

          I cannot easily use the CentroidDetection class and its functions, esp setWrapAround as used in the example https://github.com/BelaPlatform/Bela/blob/master/examples/Trill/custom-slider/render.cpp

          Am I using a wrong lib or is the functionality not included in the lib?

            matboe I cannot easily use the CentroidDetection class and its functions, e

            What does this mean?

            I would like to use the custom centroid detection. I have a custom flex pcb with 8 circular pads (similar to TrillRing). These 8 pads are channels 23 to 30. I am using the latest lib available on https://github.com/BelaPlatform/Trill-Arduino/ But I cannot find where to set that it should wrap around and I cannot find where to setup that channels 23 to 30 should be used.

            In the example available at https://github.com/BelaPlatform/Bela/blob/master/examples/Trill/custom-slider/render.cpp the basic Trill code seems to be different.

              matboe n the example available at https://github.com/BelaPlatform/Bela/blob/master/examples/Trill/custom-slider/render.cpp the basic Trill code seems to be different.

              The examples at github.com/BelaPlatform/Bela use the Linux library. You are using the Arduino library, so the example are those that come with the library, i.e.: these https://github.com/BelaPlatform/Trill-Arduino/tree/master/examples

              The two libraries have a similar API, but CentroidDetection on Arduino does not allow to set wrap around (yet). You can try to do that manually by post processing the centroids after the call to process():

              • each location value is a fixed point fractional value v: i = v >> 7 is the integer part and f = v & ((1 << 7) - 1) is the fractional part. i tells you what pad the reading was in.
              • if you have two touches t0 (with location v0, size s0) and t1 (v0, s0) , one with an integer location i0 < threshold and the other with integer locationi1 > numPads - 1 - threshold, then they are actually two parts of the same touch
              • in that case, merge them into a single touch whose size will be the sum of the two sizes and whose location will be the weighted average: w = (v1 * s1 + ((numPads << 7) + v0 ) * s0) / (s1 + s2). This value should then be wrapped around: w = w % (numPads << 7).

              I hope this makes sense and is correct.

              Thanks for you support! That looks great and post processing might be a solution. Just wondering: how is the Trill Ring doing a wrap around for a radial slider with the Arduino lib?

              it does it on board the sensor itself. If you are using Bar, Ring, Hex or Square, the CentroidDetection library is not used because it's baked into the firmware.