Electromechanical Design

Wire Management

We decided to do an upside-down table that would go under the table and hold the electronics in an organized and hidden fashion. We used Velcro to stick it on for easy access when needed.


Circuit Design

For the circuit, we connected an Arduino Uno with a button and motor controller so that the motion of the mechanism could be controlled by pressing the button. The circuit and code are shown below:

Code

Arduino Uno Code
// General param - adjust for greater/lower responsiveness
#define TIMEOUT 50

// Pin information - determined by wiring
#define BUTTON 13
#define POW 9
#define POS 8
#define NEG 7

bool motorRunning = false;

void runMotor() {
  digitalWrite(POS, HIGH);
  digitalWrite(NEG, LOW);
  analogWrite(POW, 255);
}

void stopMotor() {
  digitalWrite(POS, LOW);
  digitalWrite(NEG, LOW);
  analogWrite(POW, 0);
}

void setup() {
  pinMode(BUTTON, INPUT);
  pinMode(POS, OUTPUT);
  pinMode(NEG, OUTPUT);
  pinMode(POW, OUTPUT);

  motorRunning = false;
}

void loop() {
  bool buttonPressed = !digitalRead(BUTTON);
  if (buttonPressed && !motorRunning) {
    runMotor();
    motorRunning = true;
  } else if (!buttonPressed && motorRunning) {
    stopMotor();
    motorRunning = false;
  }
  
  delay(TIMEOUT);
}