• Trill
  • Trill Flex Base noise

Hi all.

I have some problems getting my Nano 33 BLE to work with the Trill Flex. I did some work with the Trill sensor and the Arduino Uno Rev3 before, and that worked all very nicely. I now switched to the Nano 33 BLE, as I needed a higher clock speed and smaller form factor. However, I now can't get the Trill Flex sensor (rev.C1) to send me data. The Nano 33 does see the sensor, I get the I2C adress if I run a scanner script, but just get 0 if I run the flex-raw reads for example. If I have the sensor on RAW read mode i get basically maxed out values with very little influence from a touch (base 4085, touch 4095). I know the Nano 33 has a different USB interface and that people reported problems with I2C devices, to do with DTR being disabled by default on the Nano 33. But I am not quite sure if that is the cause, and I don't know exactly how to enable DTR (quite new to C programming). Any help would be appreciated^^

Try setting a different prescaler value for the device.

Tryed that, used all available values in DIFF mode.

change the prescaler value while in RAW mode: do you see any that has enough headroom?

Can't seem to be able to replicate that small gap anymore, only seem to get 4095 now. With any of the prescaler values. I have played around with those on the Uno before and never got behaviour like this.

is it possible that the sensor is not connected properly and the pads are all shorted to ground?

    Yes, double checked those now again, and used a diferent GND. Same. But I noticed if I have the flex PCB removed and touch the pins going to the quick connector I do get a response. But if the flexPCB is in place I don't get a response from touching the PCB nor from touching the pins. curious ^^. Something to do with charge time for the pads? Scan settings?

    Okay now I can't get it to work properply on the Uno either anymore. Must be clearly something on my end...

    giuliomoro it possible that the sensor is not connected properly and the pads are all

    I meant the flex sensor here. If it is not connected properly to the FFC connector, it may tilt sideways and short all pads to ground in the process. This would result in all pads reading 4095.

    2 months later

    Hello, sorry for the 2 months break now, I had to put this project to the side but now back on it again.

    Update: I have taken out the Nano out of the equation and went back to the Uno, as that worked well in the past with my old Trill.Felx sensors to have the most consistent setting. I am comparing a Trill Flex rev. A2 and the new rev.C1 on the same Arduino with a C1 Trill Hub (switching them around, no I2C adress changes) and it seems I only have problems with the C1 Trill Flex. The A2 reacts nicely to my prescaler changes, I see the raw data read outs change accordingly. However, the C1 does not change at all. It is alway close to the max of 4095 without any changes at any prescaler setting. I have repeatedly reseated the flex pcb, changed them around with the old ones (black vs brown stifener) and even used some custom designed ones with no changes.

    If i remove the flex PCB completely, the raw read values drop to around 2700 on the C1 but still don't react to any prescaler changes. The A2 is around 50 on prescaler(4).

    I don't know what do do at this point, I have nearly 20 of the rev.C1 and sampled quite a few of them, all showing similar behaviour. Like they are all stuck at "setPrescaler(1)". The rev.A1 shows around that value if I set it to prescaler(1) without a flex PCB seated.

    Any ideas?

    I have the boards here and will give it a test.

    I've used an Arduino Mega to test a TRILL FLEX (REV C1) board with Firmware version 3. I ran this code:

    #include <Trill.h>
    
    Trill trillSensor;
    
    void setup() {
    	// put your setup code here, to run once:
    	Serial.begin(115200);
    	int ret = trillSensor.setup(Trill::TRILL_FLEX);
      delay(10);
      trillSensor.setMode(Trill::RAW);
      delay(10);
    	if(ret != 0) {
    		Serial.println("failed to initialise trillSensor");
    		Serial.print("Error code: ");
    		Serial.println(ret);
    	}
      // when the slider is connected we increase the
      // prescaler to deal with the increased baseline
      // capacitance it brings
      trillSensor.setPrescaler(4);
      delay(10);
      // after any prescaler change, it's always good to update
      // the baseline, too.
      trillSensor.updateBaseline();
    }
    
    void loop() {
    	// put your main code here, to run repeatedly:
    	delay(100);
    	trillSensor.requestRawData();
    
    	while(trillSensor.rawDataAvailable() > 0) {
    		int data = trillSensor.rawDataRead();
    		if(data < 1000)
    			Serial.print(0);
    		if(data < 100)
    			Serial.print(0);
    		if(data < 10)
    			Serial.print(0);
    		Serial.print(data);
    		Serial.print(" ");
    	}
    	Serial.println("");
    }

    With the prescaler set to 4 (default) I get these eyeballed values:
    no touch: ~ 1300-1700
    touch: ~ 2300-3600
    disconnected slider: ~ 0000-0370

    prescaler 3
    no touch: 2900-3035
    touch: 3800-4095
    disconnected slider: 0140-0540

    prescaler 5
    no touch: 0520-0830
    touch: 1050-2500
    disconnected slider: 0000-0219

    Oberservations:

    1. Making sure the slider sits in properly in the connector is important. If it doesn't sit in straight and flush, you may short the pins. Close the connector completely.
    2. Fingers on the flexpcb to hold it when reading the numbers will give false readings.

    Hi and thanks for you help.

    I am running nearly the same code as you, with the exception that I have the setMode a bit further down and I haven't set extra dealy for that (might be somewhat the reason for the issues).

    `
    #include <Trill.h>

    Trill trillSensor;
    
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(115200);
      int ret = trillSensor.setup(Trill::TRILL_FLEX);
      if(ret != 0) {
        Serial.println("failed to initialise trillSensor");
        Serial.print("Error code: ");
        Serial.println(ret);
      }
      // when the slider is connected we increase the
      // prescaler to deal with the increased baseline
      // capacitance it brings
      trillSensor.setPrescaler(4);
      delay(10);
      // after any prescaler change, it's always good to update
      // the baseline, too.
      trillSensor.updateBaseline();
      trillSensor.setMode(Trill::RAW);
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      delay(100);
      trillSensor.requestRawData();
    
      while(trillSensor.rawDataAvailable() > 0) {
        int data = trillSensor.rawDataRead();
        if(data < 1000)
          Serial.print(0);
        if(data < 100)
          Serial.print(0);
        if(data < 10)
          Serial.print(0);
        Serial.print(data);
        Serial.print(" ");
      }
      Serial.println("");
    }

    `

    I have been playing around with both a lot now
    What i figured out so far
    *your code with the delay and mode change earlier seems to be more robust (makes sense to have it earlier)
    *the rev.A2 doesn't care what so ever. both of those codes work exactly the same
    *the rev.C1 does care

    One example that I have now that seems to be very reproducable.
    I take your code, flash it on the UNO, have the C1 connected. I get good response to the changes, everything seems to be fine (signal around 500 at prescaler(4) with the flexPCB). I can take the Trill sensor off the hub an plug it back in, all fine.
    I then flash my code. Everything is the same, all good. I unplug the Trill sensor, plug it back it and i get maxed out values (or around 2700 without flexPCB). I can reset the UNO, reflash the code, no changes. The complete power cycle seems to reset something. IF I reflash it to your code, back to normal.
    And that only happens on the C1, A2 is code agnostic in that example.

    I have a photo of my test set up attached, just for reference.

    Also I might have at least one C1 that is broken, with 300-400 points higher signal on the first pin and very highly fluctuating baselines, making it not usable over the whole slider.
    prescaler(4), no flexPCB:

    I know I have a working solution now, but I would like to know why they behave so differently so I can avoid that in the future. But in general already thanks for you help, its very much appreciated!

      The delay after setting the prescaler is important.
      I also see the values on the first pin significantly higher. I think that may be normal.

      I see that now, but doesn't seem to be any issue for the A2, so it never came up to me.

      Yes I see those being higher in general, but with this one in particular its quite extreme, to the point where I can get a uniform signal back from it in DIFF mode.

        Desan I see that now, but doesn't seem to be any issue for the A2, so it never came up to me.

        There has been a change in firmware in the rev C sensors which ensures that all pads are scanned before setting the new baseline. This should prevent some edge case failures when setting the baseline. The recommendation for any command sent to Trill is to always sleep 10 ms between them to ensure the command is received and processed

        Desan Also I might have at least one C1 that is broken, with 300-400 points higher signal on the first pin and very highly fluctuating baselines, making it not usable over the whole slider.
        prescaler(4), no flexPCB:

        What do you mean "highly fluctuating"? The variability you show there seems small enough to me? Can you show the RAW values with the flex PCB attached?

          giuliomoro There has been a change in firmware in the rev C sensors which ensures that all pads are scanned before setting the new baseline. This should prevent some edge case failures when setting the baseline. The recommendation for any command sent to Trill is to always sleep 10 ms between them to ensure the command is received and processed

          Okay, yes. If I am running multiple sensors I can sleep after sending them all, right? i.e.:
          delay(10);
          trillFlex1.updateBaseline();
          trillFlex2.updateBaseline();
          trillFlex3.updateBaseline();
          trillFlex4.updateBaseline();
          trillFlex5.updateBaseline();
          trillFlex6.updateBaseline();
          trillFlex7.updateBaseline();
          delay(10);

          giuliomoro What do you mean "highly fluctuating"? The variability you show there seems small enough to me? Can you show the RAW values with the flex PCB attached?

          Today the RAW ist not that much different to the other pins (before it was +600), don't know why, but the problem in the DIFF is still there. Seems to be not setting Baseline correctly? Running Max's code:
          RAW:

          DIFF:

          BASELINE:

          I also sometime see spikes in my DIFF readouts without interaction with the sensor. Is this all from "not seated correctly"?

          I am sorry for bringing all these questions up, but I did't have that many issues with the A2 and running into a lot of different behaviour now. Is the lower profile high-desnity conector so much more delicate to set right?

            Desan Okay, yes. If I am running multiple sensors I can sleep after sending them all, right? i.e.:

            yes that's fine.

            Desan I also sometime see spikes in my DIFF readouts without interaction with the sensor. Is this all from "not seated correctly"?

            What prescaler setting are you using there? To find the appropriate prescaler setting, set the mode to RAW with the flex PCB connected and slide your finger across the flex PCB. Select the smallest prescaler value for which none of the sensor readings reaches 4095.

              giuliomoro What prescaler setting are you using there? To find the appropriate prescaler setting, set the mode to RAW with the flex PCB connected and slide your finger across the flex PCB. Select the smallest prescaler value for which none of the sensor readings reaches 4095.

              For these I used (4).
              If i go as low as 2 I would be still bellow maxing out but then I get a lot of false positive readings and a lot of those random spikes (see last picture above). For my application I must not have false positives, so with the standard (4) i was doing okay between sensitivity and stability with the A2. Also, I still have the constant wrong read for the fitst pad at any prescaler setting. Which pad it is changes between sensors, but on that sensor stays the same between flex-pcb reseating or re-plugging in.

              Any idea regarding those reading spikes and/or wronly set baseline (where my error is)? I would like to not have to manually adjust the baseline