Bendlabs single-axis bend sensor
Last updated: Jan 11, 2023
Using the Bendlabs 1-axis bend sensor with an ESP32 board
This post explores using a more tactile and sensitive type of flex sensor than I’ve used so far. This is part of my ongoing flex sensor assistive technology project.
The flex-sensor is the bendlabs 1-axis flex sensor.
In this post I show how I interfaced this sensor with an Unexpected Maker feather S2 board and started logging data from it. This board uses the ESP32 S2 MCU. The ‘S2’ variation has the feature that enables the board to appear as a physical keyboard. This will be useful to control communication software as part of the assistive technology project.
A short video showing the test system displaying real-time data can be viewed here.
A photo of the flex sensor from the Bendlabs website is shown below.
A photo showing my grubby hand holding one of the flex-sensors is shown below. I already soldered the wires onto the end connector in this photo. The sensor comes without these.
To use these sensors you can either buy a development kit that Bendlabs sells which has the sensor and a board to plug it into or you can just buy the sensor and solder on your own wires to connect with your own board. I just bought the sensor. I need to be able to coonect this sensor to my own projects. If I can only get the sensor to work with a demo kit, it is not of much use to me.
I soldered on some silicone insulated wires to the end connector. The silicone allows the wire to be more flexible than the regular PVC insulation. This was a little tricky, but not too bad an exercise. I terminated the ends of the wires onto 0.1" header pins. The wires that I soldered onto the flex sensor and the header that they connect with can be seen in the photo below. On the left of the photo are the wires that connect to the Unexpected Maker Feather S2 board. I soldered female headers onto this board. Male or female headers on a development board? I’ve seen both. I went with female as I could and nobody stopped me.
The pinout for the connector is shown below.
The pinout shows that the signal interface is I2C - these are the SDA and the SCL signals. In addition to these, there are power (VCC) and ground (GND). The part is not 5V tolerant. I used the Unexpected Maker Feather S2 3.3V supply to connect with VCC. There are two other signals to deal with. nDRDY is ’not data ready’ - meaning inverted logic on the data ready line. When data is ready, the line will go low. nRST is ’not reset’, meaning that when this signal goes low, the sensor enters a reset condition. I connected these signals to two sockets on my board. nDRDY goes to pin 7 and nRST goes to pin 3. In the example code provided, nDRDY goes to pin 4, but I don’t have a socket for pin 4, so I chose pin 7 and ajusted the software. More details on this below.
The wire colours that I used and their corresponding signals are: 1 black wire - GND ground 2 red wire - Vcc - 1.62-3.6V NOT 5V TOLERANT 3 green wire - nDRDY 4 blue wire - SDA - needs 10K pull up 5 yellow wire - SCL - needs 10K pull up 6 orange wire - nRST
The board I used has built-in 10K pullup resistors for the dedicated SDA and SCL ports. These pull-up resistors are necessary of I2C communication. I found that out the usual way that I find things out.
The Unexpected Makers Feather S2 board has a Qwiic connector socket which takes care of the power, ground, i2c clock and i2c signal lines. I bought a flexible wire Qwiic connector to attach the Qwiic connector socket on the board with the relevant signal lines on the flex sensor, using the 0.1" pins to connect the two devices.
I used the same colour wires from the flex sensor to the header pins as the Qwiic connector wires have that connect on the opposite side of the header pins.
code
Demo code from Bendlabs can be found at:
Bendlabs one-axis flex-sensor Github.
This is written to run on the Arduino platform.
This code is aimed at the the Sparkfun Pro nRF52840 Mini. With the hardware abstraction that C allows, the example code compiles for the Unexpected Makers Feather S2 once you install the necessary ESP32 library. Have a search on t’net on how to install the ESP32 library.
The only update that I needed to make to the demo code is that I use pin 7 on my board instead of the pin 4 defined in the code for the nDRDY signal. I adjusted the corresponding line of code:
from
#define ADS_INTERRUPT_PIN (4)
to
#define ADS_INTERRUPT_PIN (7)
The quick start guide from Bendlabs says to use the C program ‘bend_interrupt_demo’ through the Arduino platform. I couldn’t get this to work. I used my ‘scope on the I2C lines. I could see clock signals on the clock line - SCLK, but no data on the SDA line. I did get the example program ‘bend_polled_demo’ to work with one correction. Hopefully, this will be corrected in the Github repository by the time that you read this post.
The line:
int ret_val = ads_read_polled(&sample, &data_type);
should be
int ret_val = ads_read_polled(sample, &data_type);
in the function:
void loop() {
float sample[2];
uint8_t data_type;
// Read data from the one axis ads sensor
int ret_val = ads_read_polled(&sample, &data_type);
After flashing the code to the board, I can see real time angle data plotting on the Serial Plotter in the Arduino IDE. See below for a screenshot.
What next?
The positives of this flex-sensor are:
- It is more flexible and tactile than the flex sensor I’ve used so far.
- Works for positive and negative deflection.
- More sensitive at detecting flex.
The negatives are:
- Difficult to make an extension lead for. The soldering is finicky and there are 6 power and signal lines to contend with.
- Cost. I’m not sure how much of an issue this is. The Bendlabs sensor costs around £40 at the time of writing. This is about double the cost of the other flex sensor I tested.
Bendlabs look to have a business model where they want to be consultants and customise their technology for each product. What I would like is an off the shelf ‘plug and play’ sensor and a lead with a socket on the end that the sensor plugs into. Hand soldering the leads onto the sensor presents a potential mode of failure, as well as being time consuming.
I will contact Bendlabs to see if they have something like this for sale.