Cyber Tail

by pengfeizhang in Circuits > Arduino

2996 Views, 18 Favorites, 0 Comments

Cyber Tail

Screenshot 2022-06-17 223322.jpg
Cyber Tail

About 25 million years ago, our ancestors lost their tails during the evolution to better adapt to the the environment. Today, as we live in the digital age, our bodies are evolving along with the cyber world. What would a cybernetic tail bring to our daily life? With the easily accessible technologies, such as Arduino and 3D printing, you can make your own cyber tail!


// This project was undertaken as part of the Computational Design and Digital Fabrication seminar in the ITECH masters program at the University of Stuttgart.

// By Sarvenaz Sardari, Xi Peng, and Pengfei Zhang

Supplies

71z22cRPeeL._AC_SL1000_.jpg
Infrared Reflective Sensor TCRT5000.jpg
mpu-6050-6-dof-gyro-accelerometer-imu_1.jpg
Servo sg90.jpg
EPE-Foam-Rod.jpg
  • Arduino Uno
  • Infrared reflective sensor module TRCT5000
  • Accelerometer MPU6050
  • Servo motor SG90 (x4)
  • Capacitor (x4)
  • 9v battery
  • EPE foam rods

Making the Base Frame

Screenshot 2022-06-18 005305.jpg

The base frame can hold all the necessary electronic parts. You can either download the attached 3d model and print it on a 3d printer, or just be creative and make it using foam boards, cardboards, or wood boards. As long as it is strong enough to hold all the parts and a 1 kg tail shown in the exploded diagram.

Attaching Electronic Parts to the Frame

Screenshot 2022-06-17 224138.jpg
Screenshot 2022-06-17 224207.jpg

Attached Arduino Uno, breadboard, 9v battery, and 4 mini servo motors to the frame as indicated in the assembly diagram in step 1.

Connecting the Circuit

Screenshot 2022-06-18 005332.jpg

Follow the diagram and connect the circuit using jumping wires. Two longer wires (about 0.6 - 1m long) will be needed for extending the sensors.

Coding

Connect Arduino Uno with computer using a USB cable and upload the cade below.

In order to use the accelerometer to get the hand position, the MPU6050 library will need to be installed on the Arduino IDE. Go to this webpage https://www.arduino.cc/reference/en/libraries/mpu6050/ and download the latest version. Then open the Library Manager in the Arduino IDE and install it from there.


int IRSensor = 10; // connect IR sensor module to Arduino pin D10
int LED = 13; // connect LED to Arduino pin 13

#include <Servo.h>
#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;

Servo servo1; 
Servo servo2;
Servo servo3;
Servo servo4;

int pos1 = 90;
int pos2 = 90;
int pos3 = 90;
int pos4 = 90;


void setup()
{
//Acceleration sensor

  Serial.begin(115200);
  Serial.println("Initialize MPU6050");

  while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
  {
    Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
    delay(500);
  }


  // If you want, you can set accelerometer offsets
  // mpu.setAccelOffsetX();
  // mpu.setAccelOffsetY();
  // mpu.setAccelOffsetZ();
  
  checkSettings();
  
  Serial.println("Serial Working"); // Test to check if serial is working or not
  pinMode(IRSensor, INPUT); // IR Sensor pin INPUT

  servo1.attach(3); //servo1 signal connected to pin3
  servo2.attach(5); //servo2 signal connected to pin5
  servo3.attach(6); //servo3 signal connected to pin6
  servo4.attach(9); //servo4 signal connected to pin9
}


void checkSettings()
{
  Serial.println();
  Serial.print(" * Sleep Mode:            ");
  Serial.println(mpu.getSleepEnabled() ? "Enabled" : "Disabled");
  Serial.print(" * Clock Source:          ");
  switch(mpu.getClockSource())
  {
    case MPU6050_CLOCK_KEEP_RESET:     Serial.println("Stops the clock and keeps the timing generator in reset"); break;
    case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println("PLL with external 19.2MHz reference"); break;
    case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println("PLL with external 32.768kHz reference"); break;
    case MPU6050_CLOCK_PLL_ZGYRO:      Serial.println("PLL with Z axis gyroscope reference"); break;
    case MPU6050_CLOCK_PLL_YGYRO:      Serial.println("PLL with Y axis gyroscope reference"); break;
    case MPU6050_CLOCK_PLL_XGYRO:      Serial.println("PLL with X axis gyroscope reference"); break;
    case MPU6050_CLOCK_INTERNAL_8MHZ:  Serial.println("Internal 8MHz oscillator"); break;
  }
  
  Serial.print(" * Accelerometer:         ");
  switch(mpu.getRange())
  {
    case MPU6050_RANGE_16G:            Serial.println("+/- 16 g"); break;
    case MPU6050_RANGE_8G:             Serial.println("+/- 8 g"); break;
    case MPU6050_RANGE_4G:             Serial.println("+/- 4 g"); break;
    case MPU6050_RANGE_2G:             Serial.println("+/- 2 g"); break;
  }  

  Serial.print(" * Accelerometer offsets: ");
  Serial.print(mpu.getAccelOffsetX());
  Serial.print(" / ");
  Serial.print(mpu.getAccelOffsetY());
  Serial.print(" / ");
  Serial.println(mpu.getAccelOffsetZ());
  
  Serial.println();
}

void loop(){
  //IR sensor read
  int sensorStatus = digitalRead(IRSensor); // Set the GPIO as Input
  
  //Accel Sensor read
  Vector rawAccel = mpu.readRawAccel();
  Vector normAccel = mpu.readNormalizeAccel();

  Serial.print(" Xraw = ");
  Serial.print(rawAccel.XAxis);
  Serial.print(" Yraw = ");
  Serial.print(rawAccel.YAxis);
  Serial.print(" Zraw = ");

  Serial.println(rawAccel.ZAxis);
  Serial.print(" Xnorm = ");
  Serial.print(normAccel.XAxis);
  Serial.print(" Ynorm = ");
  Serial.print(normAccel.YAxis);
  Serial.print(" Znorm = ");
  Serial.println(normAccel.ZAxis);
  
  // IR sensor
  if (sensorStatus == 1) // Check if the pin high or not
  {
    // if the pin is high turn off the onboard Led
    digitalWrite(LED, LOW); // LED LOW
    Serial.println("Motion Detected!"); // print Motion Detected! on the serial monitor window
 
   servo1.write(180);  
   delay(20);            
   servo3.write(0); 
   delay(20);          
  
  }
  
  if  (sensorStatus == 0)
  {
    //else turn on the onboard LED
    digitalWrite(LED, HIGH); // LED High
    Serial.println("Motion Ended!"); // print Motion Ended! on the serial monitor window
   servo1.write(0);  
   delay(20);            
   servo3.write(180); 
   delay(20);    
  }


  if (normAccel.YAxis >= 0)
  {
  pos2 = round(normAccel.YAxis * 18);
  }
  else {
    pos4 = round(normAccel.YAxis * -18);
  }
  servo2.write(pos2);
  delay(20); 
  servo4.write(pos4);
  delay(100);  
  
}
  

Making the Eye Blinking Sensor

Screenshot 2022-06-17 224223.jpg

Attached the IR reflective sensor module TRCT5000 to a pair of eye glasses or goggles. Adjust the tiny potentiometer on the sensor module until it can properly recognize your eye blinking.

Making the Tail

Screenshot 2022-06-17 230221.jpg
Screenshot 2022-06-18 011400.jpg
Screenshot 2022-06-18 011540.jpg

Cut the EPE foam tubes into 10cm segments and glue them onto the 3d printed "tail bones". Run 4 strings through the tail bones and connect the strings to the arms of the 4 servo motors. Adjust the tightness of the strings until the tail is in desired shape.

Wear It!

Screenshot 2022-06-17 224013.jpg
Screenshot 2022-06-17 224606.jpg

Now the Cyber Tail is ready for wearing! Put it on your belt and wear the blinking sensor. Tape the Accelerometer to you hand. The tail will dance along with you unconscious eye blinking and hand gestures.