Shark Rehab

Submitted by kmpark on Tue, 03/12/2013 - 08:38

 

Description

I had several plans using a DC motor, but the power was not enough in most of cases (or I couldn't find the right material to use). I ended up a project to rehabilitate /revive a broken bath toy. It is a shark who used to swim in a bath tub by winding up. It is a cheap but my son's favorite. I felt sorry for him whenever my son asked me to windup the shark because it can't swim at all. 

I took the parts out and connect the parts with DC motor and added LED (for fun). The speed of moving fin was controlled by FSR, and the LED brightness was also synced with little bit of flickering.

The toy was designed to use the windup gear, so I had to take some parts out and fix the broken parts. After many trials and errors, I could fix the fin of the shark and I showed it to my son :) (He was very excited and tried to press the shark to the breadboard. However, soon he got very angry because I had to take the shark away. "It's mama's work to show in class! Sorry!"

 

 

Components Used

 

1- Arduino Uno

3- LEDs

3- 10k Resistor

1- Breadboard

1- DC Motor

1- FSR

1- DC power supply

 

 

1- transistor

1- Resistor for motor

1- Resistor for FSR

1- broken toy Shark

 

 

 

 

Code

 

int potPin = 0;   // select the input pin for the potentiometer
int motorPin = 6; // select the pin for the Motor
int ledPin1 = 9;
int ledPin2 = 10;
int ledPin3 = 11;
int i = 0;
int val = 0;      // variable to store the value coming from the sensor
void setup() {
  pinMode(ledPin1, OUTPUT);   // sets the digital pins as output
  pinMode(ledPin2, OUTPUT);   
  pinMode(ledPin3, OUTPUT); 
  Serial.begin(9600);
}
void loop() {
  val = analogRead(potPin);    // read the value from the sensor, between 0 - 1024
  Serial.println(val);
  i = i + 1;
  analogWrite(motorPin, val/6); // analogWrite can be between 0-255
    analogWrite(ledPin1, val/4); // analogWrite can be between 0-255
    analogWrite(ledPin2, val/4); // analogWrite can be between 0-255
    analogWrite(ledPin3, val/4); // analogWrite can be between 0-255
 
  if (i% 10 == 0) {
    analogWrite(ledPin1, 0); // analogWrite can be between 0-255
    analogWrite(ledPin2, 0); // analogWrite can be between 0-255
    analogWrite(ledPin3, 0); // analogWrite can be between 0-255
  }
 
}

 

Video

http://youtu.be/RC1ijlbQcPc

0
Your rating: None
Drupal theme by Kiwi Themes.