Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 21 of 21

Thread: Signal Problem; game controller with Teensy3.2 and Tekscan Flexiforce Sensor

  1. #1
    Junior Member
    Join Date
    Mar 2019
    Posts
    16

    Signal Problem; game controller with Teensy3.2 and Tekscan Flexiforce Sensor

    Hello everybody,
    i have a very strange problem with the signal of a Tekscan Flexiforce Sensor to be used in a hardware game controller (pedals).

    This is my sketch:

    Code:
    //-------------------------------------------------------------------------------------
    
    // Flexiforce SimCylinder Sketch
    // 3x Flexiforce A301/201 Brake 1, Brake 2, Clutch
    // 
    
    //-------------------------------------------------------------------------------------
    
    #include <ResponsiveAnalogRead.h> // https://github.com/dxinteractive/ResponsiveAnalogRead
    
    //Pedalachsen
    const int FSR_PIN1 = 20; // Flexiforce1 Bremse vorn; Pin connected to FSR/resistor divider
    const int FSR_PIN2 = 21; // Flexiforce2 Bremse hinten; Pin connected to FSR/resistor divider
    const int FSR_PIN3 = 22; // Flexiforce3 Kupplung; Pin connected to FSR/resistor divider
    const int FLEX_PIN = 23; // Flexsensor Gas; Pin connected to voltage divider output
    
    ResponsiveAnalogRead analog(FLEX_PIN, true);
    
    void setup() {
    
      ResponsiveAnalogRead analog(FLEX_PIN, true);
    
      //Setup Flexiforce + Flex-Sensor
      pinMode(FSR_PIN1, INPUT); //Flexiforce1 Bremse vorn
      pinMode(FSR_PIN2, INPUT); //Flexiforce2 Bremse hinten
      pinMode(FSR_PIN3, INPUT); //Flexiforce3 Kupplung
      pinMode(FLEX_PIN, INPUT); //Flexsensor Gas
    
      //deactivate Joystick Hat
      Joystick.hat(-1);
      Joystick.Y(-1);
    
    }
    
    void loop(void) {
    
       
      analog.update();
    
      Joystick.sliderLeft(analogRead(FSR_PIN1)); // Bremskreislauf vorne
      Joystick.sliderRight(analogRead(FSR_PIN2)); // Bremskreislauf hinten oder Handbremse
      //Joystick.Y(analogRead(FSR_PIN3)); // Kupplung
      
    
      if (analog.hasChanged()) {
        // Input 3 axis: read analog inputs from potentiometer and set Z-position (Gas)
        Joystick.Zrotate(analogRead(FLEX_PIN)); // Achse Gas pin 23 an teensy
      }
      //delay(50);
    }
    The teensy is recognized as a game controller in windows, all defined axis are recognized and working.

    But i have a strange problem with the signals of the Felxiforce Sensors (FSR_PIN1 and FSR
    _PIN2)

    Hookup is made like this as shown in a hookup guide:

    https://cdn.sparkfun.com/assets/lear...ample_bb_2.png

    In the Arduino Plotter the output looks like this:

    Click image for larger version. 

Name:	IMG_20200713_073827.jpg 
Views:	33 
Size:	52.9 KB 
ID:	20939

    When i apply pressure on the sensors the signal jumps up at a certain point and continues to raise, same behaviour when i release pressure.
    The problem is not hardware or temperature related. When i change the resistor, therefore can measure higher or lower pressures, i have the signal jump at approx. the same values.
    So i therefore suppose that the sensors are fine.

    In my oppinion there has to be a problem in the electrical hookup or the program or whatever.

    Iīm really stuck here and would need some help or thoughts!?

    Thanks in advance!

    Cheers Dan

  2. #2
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Additional information:

    I used the 3.3V Pin. 5V pin shows same behaviour.
    One GND used for the Sensors, the other one used for the potentimoeter.

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    159
    Maybe mechanical hysteresis - can you show how its attached to the pedal?

  4. #4
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Following sketch shows integration in "pedals"

    As i stated it seems to be a non mechanical problem. It also occurs outside the assembly when appplying force on the sensor via the load concentrator only.
    So no levers etc. in between.
    When i change range via resistor, it also occurs at lower load or vice versa.

    Click image for larger version. 

Name:	Sketch.jpg 
Views:	23 
Size:	56.3 KB 
ID:	20940

  5. #5
    Senior Member
    Join Date
    Jul 2020
    Posts
    159
    You setup seems to apply even pressure to the sensor, not flex it. That's not right surely?

  6. #6
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Yes, it applies pressure. The sensor works with pressure not bending or flexing.

    Thatīs the one i use:

    https://www.tekscan.com/products-sol...e-sensors/a301

  7. #7
    I have worked with some of Tekscan products before.

    Looking at your graph, the vertical axis is the change in A/D value (0 to 1023)?

    What is the horizontal axis? I am guessing it is not force. Is it time?

    It would be more useful if the horizontal axis was force, but I don't know how you would do that without a independent force gauge with a digital output.

    The problem is, we don't know what the force is that is applied to the sensor. You are assuming the applied force is continuous, but it could be an issue with your test setup or how you are applying force. Tell me about your testing setup.

    Now, I am curious about your foot pedal. Is the pedal designed not to move? In other words, there is no physical displacement in the pedal? Why have you done it this way?

  8. #8
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    The picture with the graph is just a Screenshot of the arduino IDE plotter so that you can see what my problem is. So I suppose y axis is time.
    Vertical axis is load or analoge signal from FSR_PIN.
    Actually there is no test setup but a finished product. See the link for details:

    https://www.simprolouge.com/start/products/simcylinder/

    As I stated, it theoretically can not be the assembly because I have the same problem when I just press the sensor.

  9. #9
    Quote Originally Posted by gaplauncher View Post
    The picture with the graph is just a Screenshot of the arduino IDE plotter so that you can see what my problem is. So I suppose y axis is time.
    Vertical axis is load or analoge signal from FSR_PIN.
    Actually there is no test setup but a finished product. See the link for details:

    https://www.simprolouge.com/start/products/simcylinder/

    As I stated, it theoretically can not be the assembly because I have the same problem when I just press the sensor.
    Wow, that is impressive! I think what you are doing is very clever, indeed.

    I have a lot of experience in controls much like that. It's what I do. Personally, I am not that much of a fan of these pressure sensitive foils. I would rather use strain gauges, and I do, for applications that require force measurement where there is no displacement.

    However, your scenario does have displacement and I have had very good results (virtually zero failure rates) with these linear sensors:

    https://www.digikey.com/products/en?...s=1724-1226-nd

    These are used in actual automotive throttles, so they are very robust, yet simple. Another advantage is since they are resistive you can use the full electrical travel and therefore do not require analog amplification or signal conditioning. You can't get that with the Tekscan sensors since there is a upper and lower limit to the sensor resistance range, so if you plan on using the full resolution of the A/D you must use amplification and likely some kind of offset null to get an output from zero to say 3.3 VDC (voltage used to run the microprocessor).

    If you are absolutely stuck on using a force transducer I would probably recommend looking at like what Micro Measurement has to offer. These are not cheap, but they are extremely reliable. Again, you will need to do signal conditioning to get the level and span of the output to use the full range of the A/D.

    Lastly, you could roll your own force gauges with strain gauges. I have a lot of experience with these myself. They can be tricky to apply and you will need some kind of lab oven for the epoxy (i.e., M-Bond 610) cure. The advantage to rolling your own is that you are free to design something that exactly fits your application with linear precisions of less than 1%.

  10. #10
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Thanks for the flowers.

    Alright, I wanna use force sensors. At least I wanna make this type work properly.
    They are pretty charming, small and except for that jump in signal working perfect im the assembly. And they are relatively cheap.

    The thing is that in the sim racing world a "Loadcell" is seen as top notch in pedals.
    So you kind of are forced to use Loadcell technology to be seen as professional hardware. A linear potentiometer would work also I course, or even a hall sensor. But people would then be like sceptical. You know what I mean?

    Strain Gages is a good point. The first version of my SimCylinders were that way. But unfortunately it is far to expensive for serial production and to be able to sell them at a reasonable price.
    I could put them on myself, but time is the issue there.

    I will upload pictures of the old ones tomorrow if you're interested.

    Anyway, I would like to find the solution for that problem... Can you help? Any ideas?

    Cheers Dan

  11. #11
    Quote Originally Posted by gaplauncher View Post
    Thanks for the flowers.

    Alright, I wanna use force sensors. At least I wanna make this type work properly.
    They are pretty charming, small and except for that jump in signal working perfect im the assembly. And they are relatively cheap.

    The thing is that in the sim racing world a "Loadcell" is seen as top notch in pedals.
    So you kind of are forced to use Loadcell technology to be seen as professional hardware. A linear potentiometer would work also I course, or even a hall sensor. But people would then be like sceptical. You know what I mean?

    Strain Gages is a good point. The first version of my SimCylinders were that way. But unfortunately it is far to expensive for serial production and to be able to sell them at a reasonable price.
    I could put them on myself, but time is the issue there.

    I will upload pictures of the old ones tomorrow if you're interested.

    Anyway, I would like to find the solution for that problem... Can you help? Any ideas?

    Cheers Dan
    Happy to help any way I can.

    The foil pressure sensors, I have found, have issues compared to a true load sensor. I went the route you did thinking I was saving money, but the results were unacceptable. I would first look for affordable COTS load cells (real load cells) and go from there.

    How much force or what range of forces are you looking for? I can see the potential of hundreds of pounds on a brake pedal if the pucker factor is high enough. I've had a few incidents on the autocross track myself (in a real car) where you lay on the brakes far beyond what is meaningful to stop. Once you hit the threshold where the ABS kicks in, more pressure doesn't do a thing, but tell that to your brain while your butt is having a brown-trousers moment.

  12. #12
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Quote Originally Posted by Loren42 View Post
    Happy to help any way I can.

    The foil pressure sensors, I have found, have issues compared to a true load sensor. I went the route you did thinking I was saving money, but the results were unacceptable. I would first look for affordable COTS load cells (real load cells) and go from there.

    How much force or what range of forces are you looking for? I can see the potential of hundreds of pounds on a brake pedal if the pucker factor is high enough. I've had a few incidents on the autocross track myself (in a real car) where you lay on the brakes far beyond what is meaningful to stop. Once you hit the threshold where the ABS kicks in, more pressure doesn't do a thing, but tell that to your brain while your butt is having a brown-trousers moment.
    For now i wanna try to make the flexiforce sensors work. The option with loadcell exists as a concept, but i like the other more.
    So, is there a way to get rid of this signal jump?

  13. #13
    Quote Originally Posted by gaplauncher View Post
    For now i wanna try to make the flexiforce sensors work. The option with loadcell exists as a concept, but i like the other more.
    So, is there a way to get rid of this signal jump?
    If it were me, the first thing I would want to do is prove that it is real and not some artifact of the system.

    I would need to see the complete schematic, but the way it is wired to the Arduino would not be my first choice. You are creating a voltage divider, but the range is from some point less than 5 VDC with no pressure applied to something closer to 5VDC with maximum pressure. Isn't the Arduino A/D full-scale input 3.3VDC? How do you protect from over voltage? At a minimum I would put the resistor between the gauge and the +5VDC excitation or just use the 3.3 VDC supply. That way you are protecting the A/D and who knows how it will respond when the signal exceeds the input's maximum.

    Nevertheless, in the absence of a true force gauge I would use a spring and a linear sensor to test the foil gauge in a relative way. Springs may vary 20% in their specifications, but they will still have a linear response, so something that is 200 pounds per inch of travel will at least tell you if the foil gauge's change in resistance is also linear. All you need to do is measure the change in compression and even a mechanical dial gauge attached to a lever could do that, but a linear pot like the one I showed you could also be connected to the Arduino and you could actually graph the change in resistance of the foil gauge to the change in resistance of the Tekscan foil.

    If the resulting plot is a straight line, then the gauge is doing what you expect. If not, then it is likely the gauge has problems or the way you are applying it is wrong or the way you are measuring it with the Arduino is wrong.

  14. #14
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Quote Originally Posted by Loren42 View Post
    If it were me, the first thing I would want to do is prove that it is real and not some artifact of the system.

    I would need to see the complete schematic, but the way it is wired to the Arduino would not be my first choice. You are creating a voltage divider, but the range is from some point less than 5 VDC with no pressure applied to something closer to 5VDC with maximum pressure. Isn't the Arduino A/D full-scale input 3.3VDC? How do you protect from over voltage? At a minimum I would put the resistor between the gauge and the +5VDC excitation or just use the 3.3 VDC supply. That way you are protecting the A/D and who knows how it will respond when the signal exceeds the input's maximum.

    Nevertheless, in the absence of a true force gauge I would use a spring and a linear sensor to test the foil gauge in a relative way. Springs may vary 20% in their specifications, but they will still have a linear response, so something that is 200 pounds per inch of travel will at least tell you if the foil gauge's change in resistance is also linear. All you need to do is measure the change in compression and even a mechanical dial gauge attached to a lever could do that, but a linear pot like the one I showed you could also be connected to the Arduino and you could actually graph the change in resistance of the foil gauge to the change in resistance of the Tekscan foil.

    If the resulting plot is a straight line, then the gauge is doing what you expect. If not, then it is likely the gauge has problems or the way you are applying it is wrong or the way you are measuring it with the Arduino is wrong.
    What you mean with schematic?

  15. #15
    Senior Member
    Join Date
    Jul 2020
    Posts
    159
    Thatīs the one i use:

    https://www.tekscan.com/products-sol...e-sensors/a301[/QUOTE]

    I saw flexiforce and assumed it was a flex sensor... The specs on device that aren't great, it has high hysteresis, I wouldn't expect miracles
    as it appears to be some sort of squashable resistance material, rather than a strain-gauge.
    The way to check if its the sensor or not is use a multimeter with nothing connected but power and the other resistor...

  16. #16
    Quote Originally Posted by MarkT View Post
    I saw flexiforce and assumed it was a flex sensor... The specs on device that aren't great, it has high hysteresis, I wouldn't expect miracles
    as it appears to be some sort of squashable resistance material, rather than a strain-gauge.
    The way to check if its the sensor or not is use a multimeter with nothing connected but power and the other resistor...[/QUOTE]

    Yes, or just set the multimeter to resistance.

    However, that really doesn't tell you if it is responding linearly; watching digits on a display will not work unless you are mapping out enough known pressures at a number of discrete intervals.

    I agree with the hysteresis. It's what I remember with my own experiments.

  17. #17
    Quote Originally Posted by gaplauncher View Post
    What you mean with schematic?
    Well, I am thinking you must have created some sort of system schematic for your device.

    From the picture it looks like the way it is connected is not right. That assumes that the Arduino board's A/D input runs from 0 to 3.3VDC and the analog reference pin is at 3.3VDC.

  18. #18
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    yeah, but except for the signal jump it works like a charm. Reaction time and precision (for that kind of use) is great and as i need it.
    See this video, i use them already but raised the pressure since the jump is out of reach for me and the pressure iīm used to in the sim:

    https://www.youtube.com/watch?v=mx6GeDEaW90&t=289s

    But the jump is still there of course. And thatīs what bothers me!!

    Would be sad to drop it just because of this.
    I could erase the jump in the sketch. For example if value is higher than X, substract Y from X. But thatīs not a nice proper way.

  19. #19
    Quote Originally Posted by gaplauncher View Post
    yeah, but except for the signal jump it works like a charm. Reaction time and precision (for that kind of use) is great and as i need it.
    See this video, i use them already but raised the pressure since the jump is out of reach for me and the pressure iīm used to in the sim:

    https://www.youtube.com/watch?v=mx6GeDEaW90&t=289s

    But the jump is still there of course. And thatīs what bothers me!!

    Would be sad to drop it just because of this.
    I could erase the jump in the sketch. For example if value is higher than X, substract Y from X. But thatīs not a nice proper way.
    You are apexing your turns too early.

    I would sort out a few things first.

    1. Do you know what the no-load resistance of the sensor is?

    2. What is the resistance of the sensor at maximum load?

    3. What is the A/D input voltage range for the micro board?

    4. Is the resistor you are using 3.3K?

    5. What Arduino board are you using (what is the processor)?

  20. #20
    Junior Member
    Join Date
    Mar 2019
    Posts
    16
    Hey, after having seen that the sensor is no good option, i rework everything with a proper loadcell. Thanks for input @Loren42

  21. #21
    I think you will be better off in the long run with the quality.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •