• Trill
  • Recreating functionality of Square with Craft

Hello, I am creating my own PCB of capacitive pads and have a few questions regarding if the code associated with the Trill Square may work with a grid layout of capacitive pads and a Trill Craft.

I've read in your documentation it is best to wire the Craft pins consecutively to the capacitive pads. Does this still apply when trying to re-create an X, Y grid for knowing location of touch? I have attached an image of proposed layout and pin hook up.

I realise the pads may be too large and too spaced out creating a loss of resolution. However, this is just in an early prototyping stage at the moment so once I have the logic working I can experiment with different pattern layouts to improve this.

I am working with your Arduino and Processing libraries and have been adapting my own code from your Craft examples. I am using the CENTROID mode but had a few further questions.

  1. In Arduino if set to CENTROID mode can the functions such as touchSize() and touchLocation() be included to the craft print example sending raw data. Will these functions work if the board is set to craft. I notice it is not listed as an option in the Processing lib Trill sensor instancing.
  2. Would the trill square print examples work if the overall sensor size was edited. Or would this not work as well as currently the pad design is too different?
  3. What is the pin order hookup for the trill Square ? (vertical 0-14, horizontal 15-30?)
  4. Am I best just trying to write my own code to calculate location with this different design? I notice you mention using a weighted average algorithm to do so - do you have further documentation of this?

Thanks in advance for entertaining the mass of questions!
alt text

    j3nsykes I've read in your documentation it is best to wire the Craft pins consecutively to the capacitive pads. Does this still apply when trying to re-create an X, Y grid for knowing location of touch?

    No. The firmware on Trill Craft is essentially the same as Trill Bar, so it's only if you were to try and recreate the latter that it would work simply by connecting the pads in order.

    j3nsykes Am I best just trying to write my own code to calculate location with this different design? I notice you mention using a weighted average algorithm to do so - do you have further documentation of this?

    Yes that's probably the solution: set the craft to the default (DIFF) mode and read the pads. Then on the host (Arduino or even Processing) you can parse those to compute the location and size of the touches.

    The calculateCentroids() function that computes the touch location and size on the Trill Bar/Square/Hex/Ring is this one: https://github.com/BelaPlatform/Trill/blob/master/firmware/common/trill-main.h#L553-L676

    For Bar/Ring, this is executed only once per set of reading. For Square/Hex (for which TWOD is #defined), it is called twice: once with the horizontal pads and once with the vertical pads. centroidBuffer and sizeBuffer are the output buffers where up to maxNumCentroids centroids ("touch position") and size are written to, respectively. It assumes that readings from each pad have been stored in the global array CSD_waSnsDiff[]. minSensor is the first element of this array to be processed, and maxSensor is the last element + 1. numSensors in your case will just be maxSensor - minSensor. It would be something else only on a circular interface, like Trill Ring, where the first few pads could be part of a touch whose peak is at the last few centroids, so it could be simplified slightly for your application, but also there is no real need for that.

    Hope that's a good starting point. I think all your questions are answered, but let me know if they are not .

    Thank you this is really useful !
    I'll let you know how I get on and if I code something for location and size detection with the Craft I'll share it here for others to use.

    3 years later

    hi @j3nsykes ,

    Were you able to write something for this?
    I am trying to do the same with craft. Please share if you figured this out.

    Thanks!

    @giuliomoro , thanks for the response.

    I have rx11 x tx12 custom touch array.
    How should I connect rx and tx? 0 to 12 rx? 15 to 22 tx?

      triller I have rx11 x tx12 custom touch array.

      That sounds like a mutual capacitance touch pad? There is no support for mutual capacitance on Trill Craft, but if the pads have the geometry I expect them to have, just connect them in order to the Trill Craft channels and treat them as two sliders, one giving you the horizontal position and one giving you the vertical position of the touch. This will be single touch as full multitouch is not achievable without mutual capacitance.

      Yes, Its a mutual capacitance touch array 11x12.
      Do you offer any other solution for mutual cap touch sensing?

      How does trill square do multitouch?
      I was assuming TRILL SQUARE had two layers with rows and columns on each

      It has a single layer where rows and colums alternate in "diamond" shaped pads. It's self-capacitive though, so it doesn't do real multi touch. It can detect multiple touches across each axis, but it cannot match touches on one axis to those on the other. For this reason we sell it as a single-touch device.