Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

FSLP with Teensy 4.1 board

I’ve got a FSLP connected to a Teensy 4.1 board.

I know that you are supposed to trim the length of the FSLP per the Customization GUIDE. I have mine trimmed as in Fig. 4 of the guide, like this:
image

I’ve followed the directions in the FSLP-Integration-Guide-13.pdf to hook it up and it is generally working. I have SL connected to A12, D1 to 29, DL2 to A13 and BotRo to 28.

However, I have a problem with the impedance of the pin of the microprocessor (IMXRT1060CEC) that is connected to the bottom of Ro. The datasheet for the microprocessor says that when the pin is an input it has a R_Keeper (keeper circuit resistance) connected of about 105k to 175k ohms.

So, what is happening (i think) is that this R_Keeper is connected to the 3.3V internally in the microprocessor and it is screwing up the position measurement. The position is dependent on how hard i press. So when I press my finger in the center of the FSLP i don’t get near the center value out for position, unless I press really hard.

How might I fix this?
I tried an additional pull down resistor from the bottom of Ro to ground, and this helps, but it doesn’t seem like it would be very accurate (from board to board for example).

any ideas,
Thanks.

Assuming you’re right about R-Keeper and there’s no other way to defeat it (e.g. disable the pin?), maybe you could use pin 28 to drive the gate of an n-channel MOSFET that grounds the bottom of Ro? That way, pin 28 could be configured to be an output only, and when it’s high the bottom of Ro is grounded, and when it’s low, it’s floating?

Hello, timking251.

Jlo’s suggestion sounds like it is worth a try. You might also try posting on some Teensy-specific forums to see if they have any other suggestions or workarounds.

Brandon

That’s a good idea.
I tried a similar thing with a 2n2222, but it didn’t work.
I’ll have to get a MOSFET and try that. I also thought about an analog switch, which I guess would amount to the same thing.

I’ll try the Teensy forum over at PJRC as well. thanks.

Ok. so i found from the teensy site that there is an OUTPUT_OPENDRAIN setting for the pin mode.
so I tried this:
I replaced the pinMode(fslpBotR0, OUTPUT) with pinMode(fslpBotR0, OUTPUT_OPENDRAIN)
and replaced the pinMode(fslpBotR0, INPUT) with pinMode(fslpBotR0, OUTPUT_OPENDRAIN) and a digitalWrite(fslpBotR0, HIGH), which should turn of the fet and leave the pin at high z.

It doesn’t work any better than before. I can’t get the middle of the FSLP to read the middle value for the position read and the position read is pressure dependent.

Is the position supposed to be pretty accurate? if I only have a light pressure on the strip I can only get to the middle value (512/1023) at the position that is right next to the connector, but if i press pretty hard right near the connector end I get about 200/1023

not sure what else it could be.

What happens when you disconnect SL from Ro and the Teensy and just read the voltage with a meter?

In my experience, the pressure can slightly change the position reading because more of your finger is touching the sensor, which could bias the reading, but I wouldn’t expect it to be off by that much.

Do you have any other microcontrollers you could try to see how much it differs? If you have an Arduino, you could try using the fslpGetPosition() function from our “FslpLightStripDemo.ino” example. Posting your position reading code might help as well.

You could also try clearing the ADC like we do in that FslpLightStripDemo example by taking a reading of the internal GND channel, just in case your reading is getting influenced by voltage leftover on the ADC from the pressure reading.

Brandon

Ok. so I disconnected the FSLP from the microcontroller and just connected D1 to 3.3v and D2 to ground and then measuring the SL pin with a voltmeter I get around 1.9V when I press in the center, about 0.5v when i press all the way at the connector end and about 3.2v when I press near the far end. And it varies along the way as I slide my finger.

Now, i would expect the center to be closer to 3.3/2 = 1.65, but it is off quite a bit.

I had a second FSLP sensor so I trimmed it using the Customization Guide and this one seems to work fine. i’m not sure what happened with the first one. ( I might of screwed up the first one when I trimmed it or something, but I was pretty careful)

This second one I cut to the shortest length (just because I realized I didn’t need the extra length anyway).
image

Just to recap my working configuration for the teensy 4.1 board using a 10cm FSLP trimmed to the shortest length. I’m using these connections:
I have SL connected to A12, D1 to 29, DL2 to A13 and BotRo to 28.
Then I’m using the code from the “FslpLightStripDemo.ino” that BrandonM linked to above, but I’m replacing a few lines of code like this…

int fslpGetPosition()
{
...
//pinMode(fslpBotR0, OUTPUT);
  pinMode(fslpBotR0, OUTPUT_OPENDRAIN);
digitalWrite(fslpBotR0, LOW);
...
  digitalWrite(fslpBotR0, HIGH); // OUTPUT_OPENDRAIN means high impedance here
 // pinMode(fslpBotR0, INPUT);
...
}
int fslpGetPressure()
{
...
  pinMode(fslpBotR0, OUTPUT_OPENDRAIN);
//  pinMode(fslpBotR0, OUTPUT);
  digitalWrite(fslpBotR0, LOW);
...
}

so, thanks for you help.

1 Like

I am glad to hear you were able to get it working with your second sensor. I am not sure why the first one was giving you problems, but you might be right that it was somehow damaged when it was cut. If you want to post some pictures of it, we could take a look and see if there is anything obvious.

Thank you for sharing the changes you made to get it to work on your Teensy!

Brandon