Rafael Diaz
Published

Flex controlled air powered gripper

A silicone air powered gripper controlled with a flex sensor glove.

IntermediateFull instructions provided6 hours346
Flex controlled air powered gripper

Things used in this project

Hardware components

Adafruit Air pump
×3
Adafruit Air valve
×1
Adafruit Air tube
×1
Ecoflex 00-30
×1
Long flex sensor
×1
Nano 33 BLE Sense
Arduino Nano 33 BLE Sense
×2
coin cell holder
×1
Adafruit nOOds- Flexible LED Filament
×1
Grove - 2-Channel SPDT Relay
Seeed Studio Grove - 2-Channel SPDT Relay
I used 7 individual relays.
×3

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Base & top

Feed the air tubes through the holes & super glue the 3 fingers to each side. Super glue the top on the base.

Finger silicone molds

This makes the top & bottom of a silicone finger which you connect together with some silicone. The circular designs goes on the outside, the linear design goes on the inside.

Glove_TPU

Glove made 3d printed out of tpu. Super glue flex sensor & electronics.

Schematics

Transmitter _schematic

Code

Transmitter_BLE_Flex

Arduino
The transmitter code, arduino nano 33 BE sense with a flex sensor sends msg via BLE to another arduino.
#include <ArduinoBLE.h>

const int R_LED_PIN = 22;
const int G_LED_PIN = 23;
const int B_LED_PIN = 24;

int voltageThreshold = 250;



void setup() {
  Serial.begin(9600);
  


  // initialize the BLE hardware
  BLE.begin();

  Serial.println("BLE Central - LED control");

  // start scanning for peripherals
  BLE.scanForUuid("19b10000-e8f2-537e-4f6c-d104768a1214");
}

void loop() {
  // check if a peripheral has been discovered
  BLEDevice peripheral = BLE.available();

  if (peripheral) {
    // discovered a peripheral, print out address, local name, and advertised service
    Serial.print("Found ");
    Serial.print(peripheral.address());
    Serial.print(" '");
    Serial.print(peripheral.localName());
    Serial.print("' ");
    Serial.print(peripheral.advertisedServiceUuid());
    Serial.println();

    if (peripheral.localName() != "LED") {
      return;
    }

    // stop scanning
    BLE.stopScan();

    controlLed(peripheral);

    // peripheral disconnected, start scanning again
    BLE.scanForUuid("19b10000-e8f2-537e-4f6c-d104768a1214");
  }
}

void controlLed(BLEDevice peripheral) {


 
 
  Serial.println("Connecting ...");

  if (peripheral.connect()) {
    Serial.println("Connected");
  } else {
    Serial.println("Failed to connect!");
    return;
  }

  // discover peripheral attributes
  Serial.println("Discovering attributes ...");
  if (peripheral.discoverAttributes()) {
    Serial.println("Attributes discovered");
  } else {
    Serial.println("Attribute discovery failed!");
    peripheral.disconnect();
    return;
  }

  // retrieve the LED characteristic
  BLECharacteristic ledCharacteristic = peripheral.characteristic("19b10001-e8f2-537e-4f6c-d104768a1214");

  if (!ledCharacteristic) {
    Serial.println("Peripheral does not have LED characteristic!");
    peripheral.disconnect();
    return;
  } else if (!ledCharacteristic.canWrite()) {
    Serial.println("Peripheral does not have a writable LED characteristic!");
    peripheral.disconnect();
    return;
  }

  while (peripheral.connected()) {
    
   
 int currentVoltage = analogRead(A0); // store the incoming voltage 
   Serial.println(currentVoltage);
   
      if (currentVoltage < 200 ) {
       

        setColor("GREEN");
        ledCharacteristic.writeValue((byte)0x01);
      } if (currentVoltage > voltageThreshold) {
        Serial.println("button released");

        setColor("RED");
        ledCharacteristic.writeValue((byte)0x00);
      }
   
  }

  Serial.println("Peripheral disconnected");
}

void setColor(String color)
{

  if (color == "RED")
  {
    digitalWrite(R_LED_PIN, LOW);  // High values -> lower brightness
    digitalWrite(G_LED_PIN, HIGH);
    digitalWrite(B_LED_PIN, HIGH);
    
  }else if (color == "GREEN")
  {
    digitalWrite(R_LED_PIN, HIGH);  // High values -> lower brightness
    digitalWrite(G_LED_PIN, LOW);
    digitalWrite(B_LED_PIN, HIGH);
    
  }else if (color == "BLUE")
  {
    digitalWrite(R_LED_PIN, HIGH);  // High values -> lower brightness
    digitalWrite(G_LED_PIN, HIGH);
    digitalWrite(B_LED_PIN, LOW);
    
  }else if (color == "PURPLE")
  {
    digitalWrite(R_LED_PIN, LOW);  // High values -> lower brightness
    digitalWrite(G_LED_PIN, HIGH);
    digitalWrite(B_LED_PIN, LOW);
  }        

}

Receiver_BLE_Flex

Arduino
Receiver code, controls the relays connected to the 3 air pumps/3 air valves plus the nOOds LED.
#include <ArduinoBLE.h>

BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // BLE LED Service

// BLE LED Switch Characteristic - custom 128-bit UUID, read and writable by central
BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);

int relay7SOLELEFT = 7;
int relay10PUMPLEFT = 10;


int relay8SOLEMIDDLE = 8;
int relay11PUMPMIDDLE = 11;



int relay9SOLERIGHT = 9;
int relay12PUMPRIGHT = 12;

int relay5LED = 5;

void setup() {
  Serial.begin(9600);
 pinMode(relay7SOLELEFT, OUTPUT);
  pinMode(relay10PUMPLEFT, OUTPUT);
   
  
 pinMode(relay8SOLEMIDDLE, OUTPUT); 
 pinMode(relay11PUMPMIDDLE, OUTPUT); 
 

 pinMode(relay9SOLERIGHT, OUTPUT); 
 pinMode(relay12PUMPRIGHT, OUTPUT); 

pinMode(relay5LED, OUTPUT);

  // begin initialization
  if (!BLE.begin()) {
    Serial.println("starting BLE failed!");

    while (1);
  }

  // set advertised local name and service UUID:
  BLE.setLocalName("LED");
  BLE.setAdvertisedService(ledService);

  // add the characteristic to the service
  ledService.addCharacteristic(switchCharacteristic);

  // add service
  BLE.addService(ledService);

  // set the initial value for the characeristic:
  switchCharacteristic.writeValue(0);

  // start advertising
  BLE.advertise();

  Serial.println("BLE LED Peripheral");
}

void loop() {
  // listen for BLE peripherals to connect:
  BLEDevice central = BLE.central();

  // if a central is connected to peripheral:
  if (central) {
    Serial.print("Connected to central: ");
    // print the central's MAC address:
    Serial.println(central.address());

    // while the central is still connected to peripheral:
    while (central.connected()) {
      // if the remote device wrote to the characteristic,
      // use the value to control the LED:
      if (switchCharacteristic.written()) {
        if (switchCharacteristic.value()) {   // any value other than 0
         digitalWrite(relay8SOLEMIDDLE, HIGH);
         digitalWrite(relay11PUMPMIDDLE, HIGH);
         digitalWrite(relay7SOLELEFT, HIGH);
         digitalWrite(relay10PUMPLEFT, HIGH);
         digitalWrite(relay9SOLERIGHT, HIGH);
         digitalWrite(relay12PUMPRIGHT, HIGH);
         digitalWrite(relay5LED, HIGH);
        Serial.println("ON");
        } else {                              // a 0 value
        digitalWrite(relay8SOLEMIDDLE, LOW);
        digitalWrite(relay11PUMPMIDDLE, LOW);
        digitalWrite(relay7SOLELEFT, LOW);
        digitalWrite(relay10PUMPLEFT, LOW);
        digitalWrite(relay9SOLERIGHT, LOW);
        digitalWrite(relay12PUMPRIGHT, LOW);
        digitalWrite(relay5LED, LOW);
          Serial.println("OFF");
        }
      }
    }


  }
}

Credits

Rafael Diaz

Rafael Diaz

2 projects • 2 followers
Computer scientist, love robotics & coding ^_^.

Comments