The Annoying Ball

Submitted by soren svejstrup on Tue, 03/05/2013 - 22:14

Description 

The Annoying Ball is extremely intrusive and annoying, due to the sound and the rapid blinking. It forces users to turn it off, to get relief of the terror. The idea is, that it can be used as a tool when professional athletes has to do physical training. You could have ten annoying balls distributed in a room, and then the athletes would be forced to hunt down and turn of the annoying ball. When a ball has been turned of, another one goes off at the other side of the training facility. 

 

Components used

 

  • Breadboard
  • Arduino Uno
  • Red LED
  • Piezo speaker
  • 2 resisters
  • Photo cell
  • Ping pong ball

 

Code

 

/*
* The Annoying Ball is extremely intrusive and annoying, due to the sound and 
* the rapid blinking. It forces users to turn it off, to get relief of the terror.
* The idea is, that it can be used as a tool when professional athletes has 
* to do physical training. You could have ten annoying balls distributed in a room, 
* and then the athletes would be forced to hunt down and turn of the annoying ball. 
* When a ball has been turned of, another one goes off at the other side of the
* training facility. 
*/
 
 
int photocellPin = 1;  // Photocell connected to analog pin 0
int photocellVal = 0;  // define photocell variable
int ledPin = 10;       // LED connected to digital pin 10
int ledState = 0;      //state of the led 
int piezoPin = 7;      // Piezo connected to digital pin 7
int piezoVal = 0;      //state of the piezo speaker 
int minLight = 500;    //min light threshold
 
 
void setup() {
  Serial.begin(9600);
  pinMode(photocellPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(piezoPin, OUTPUT);
  }
 
  void loop() {
    photocellVal = analogRead(photocellPin);
    Serial.println(photocellVal);
    int pitch = photocellPin/10;
  
      if (photocellVal > minLight) {  // if the light measured by the photocell is greater than minLight
      digitalWrite(ledPin, HIGH);   // turn the LED on
      delay(50);                    // wait for 50/1000 of a second
      digitalWrite(ledPin, LOW);    // turn the LED off 
      delay(50);                    // wait for 50/1000 of a second
      
      tone(piezoPin, 900, 500);     // assigns the piezo pin, the frequency of the sound, and the duration in milliseconds
      tone(piezoPin, 200, 500);     // does the same as the line above, but with different frequency. This creates a siren-like sound 
      
  }
    else  {
      digitalWrite(ledPin, LOW);    // if the photocell measures a value belov minLight, the ball turns off for 5 sec.
      noTone(piezoPin);             // turns off piezo speaker
      delay(5000);                  // 5 sec delay
    }
 
    
}

 

Video showing The Annoying Ball in action:

http://youtu.be/ve36E-iTGm4

0
Your rating: None
Drupal theme by Kiwi Themes.