User login

Powered by Drupal, an open source content management system

Theory and Practice of Tangible User Interfaces

DC Motor: Twister Game

Submitted by sarah_vanwart on Wed, 10/15/2008 - 22:00

Assignment: DC Motor: Actuation Assignment 1

Collaborators:

Assignment: DC Motor: Actuation Assignment 1

Collaborators: Ljuba Miljkovic

Description

The purpose of this lab was to:

  1. Control a DC motor with various input devices.
  2. Create an interesting DC motor application.

Components Used

  • Arduino board
  • 2 DC Motors
  • 2 diodes
  • 2 transistors
  • 2 1k Resistors (brown black red)
  • Wires
  • 1 Piezo Speaker
  • Soldering iron and solder
  • 1 old clock (found in dumpster)
  • colored paper
  • putty

Twister Game

Ljuba found an old clock that had been discarded, and we decided to try and use the DC motor to manipulate the hands of the clock in an interesting way. Our idea was to make a "Twister" game with two rotational surfaces (each powered by DC motors). The first rotational spinner would tell the player which color should be his/her target, and the second rotational spinner would tell the user which hand or foot to use on his/her target. We decided that the player should flick a piezo speaker to spin the DC motors, since the piezo speaker does a pretty good job of detecting vibrations.

Circuit Photos

 

Arduino Code

int motorPinSmall = 9;  // select the pin for the small motor 
int motorPinBig = 8;    // select the pin for the big motor 
int speakerPin = 5;     // select the input pin for the piezo speaker 
                        // (will detect input and serve as the "spinner" driver). 
int thresholdVal = 100; // the minimum 
int val = 0;            // variable to store the value coming from the sensor 

void setup() 
{ 
   Serial.begin(9600); 
   pinMode(speakerPin, INPUT); //gets the "spinner" value. 
} 

void loop() 
{ 
   val = analogRead(speakerPin); 
   if(val > thresholdVal) 
   { 
      int numIterations = 2*val/100; 
      int i = 0; Serial.println(numIterations); 
      val = val/4; 
      for(i=0; i < numIterations; i++) 
      { 
         analogWrite(motorPinBig, val*2); // analogWrite can be between 0-255 
         analogWrite(motorPinSmall, val/2); // analogWrite can be between 0-255 delay(50); 
      } 
   } 
   else 
   { 
      analogWrite(motorPinBig, 0); 
      analogWrite(motorPinSmall, 0); 
   } 
}

Twister Game Video

Deconstructed Twister Spinner