SHUN-HSUN LIANGchenningtai
Published © GPL3+

Tangible Light

This is a conceptual app platform designed for tangible user interfaces, and the hardware is a specific example to show the implementation.

AdvancedShowcase (no instructions)2,296
Tangible Light

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×100
Adafruit PCA9685
×10
Connector Adapter, DC Power - 2.1mm
Connector Adapter, DC Power - 2.1mm
×10
5v 10A switching power supply
×10
Male/Female Jumper Wires
Male/Female Jumper Wires
×10

Software apps and online services

Arduino IDE
Arduino IDE
We use Arduino to receive data from Processing to perform 3D display on this tangible user interface through servo motor matrics.
Unity
Unity
We create a virtual model in Unity as the user interface for people who are not experienced programmers, and the matrics of the display signals generated in the backend will be written in the text file, then send them to RPi through TCP, so that Processing can read them.
Processing
The Processing Foundation Processing
We use Processing to read the text file of the matrics of the display signals, and then send these matrics to Arduino through the serial port.
Autodesk Inventor
Autodesk Inventor

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Hardware device STL format

The linkage between pins and servo units are not drawn in this assembly file.

Hardware device STP format

The linkage between pins and servo units are not drawn in this assembly file.

Schematics

Schematic

There are 7 PCA9685 servo drivers used in project, and the servos/ power supply are attached on each.

Code

Display Shape - Sine

Arduino
We use this simple code to test whether the pin matrix works out, which would show a dynamic sine wave.
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <Math.h>

// Address
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x41);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x42);
Adafruit_PWMServoDriver pwm3 = Adafruit_PWMServoDriver(0x43);
Adafruit_PWMServoDriver pwm4 = Adafruit_PWMServoDriver(0x44);
Adafruit_PWMServoDriver pwm5 = Adafruit_PWMServoDriver(0x45);
Adafruit_PWMServoDriver pwm6 = Adafruit_PWMServoDriver(0x46);
Adafruit_PWMServoDriver pwm7 = Adafruit_PWMServoDriver(0x47);
Adafruit_PWMServoDriver pwm8 = Adafruit_PWMServoDriver(0x48);
Adafruit_PWMServoDriver pwm9 = Adafruit_PWMServoDriver(0x49);

#define SERVOMIN  110 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  400 // this is the 'maximum' pulse length count (out of 4096)
int t = 0;
int offset = (SERVOMAX + SERVOMIN) / 2;
int ampl = (SERVOMAX - SERVOMIN) / 2;
int freq = 1;

void setup() {
  Serial.begin(115200);
  Serial.setTimeout(10);
  Serial.println("16 channel Servo test!");

  pwm.begin();
  pwm1.begin();
  pwm2.begin();
  pwm3.begin();
  pwm4.begin();
  pwm5.begin();
  pwm6.begin();
  pwm7.begin();
  pwm8.begin();
  pwm9.begin();
// Analog servos run at ~60 Hz updates
  pwm.setPWMFreq(60);
  pwm1.setPWMFreq(60);
  pwm2.setPWMFreq(60);
  pwm3.setPWMFreq(60);
  pwm4.setPWMFreq(60);
  pwm5.setPWMFreq(60);
  pwm6.setPWMFreq(60);
  pwm7.setPWMFreq(60);
  pwm8.setPWMFreq(60);
  pwm9.setPWMFreq(60);

//Zero
  for(int i = 0; i < 16; i += 1){
    pwm.setPWM(i, 0, SERVOMIN);
    pwm1.setPWM(i, 0, SERVOMIN);
    pwm2.setPWM(i, 0, SERVOMIN);
    pwm3.setPWM(i, 0, SERVOMIN);
    pwm4.setPWM(i, 0, SERVOMIN);
    pwm5.setPWM(i, 0, SERVOMIN);
    pwm6.setPWM(i, 0, SERVOMIN);
    pwm7.setPWM(i, 0, SERVOMIN);
    pwm8.setPWM(i, 0, SERVOMIN);
    pwm9.setPWM(i, 0, SERVOMIN);
  }
  Serial.println("Ready");
}

void loop() {
  while(Serial.available()){ //To control the starting time.
    for (int i = 0; i < 10; ++i)
    {
      Serial.print((int)(offset+ampl*sin(freq*(i+t))));
      Serial.print(" ");
      pwm.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t))));
      pwm1.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+1))));
      pwm2.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+2))));
      pwm3.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+3))));
      pwm4.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+4))));
      pwm5.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+5))));
      pwm6.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+6))));
      pwm7.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+7))));
      pwm8.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+8))));
      pwm9.setPWM(i, 0, (int)(offset+ampl*sin(freq*(i+t+9))));
    }
    Serial.println("");
    delay(100);
    t++;
  }
}

Credits

SHUN-HSUN LIANG
0 projects • 1 follower
Contact
chenningtai
0 projects • 1 follower
Contact

Comments

Please log in or sign up to comment.