Midterm Project: Fishing Time!

Fishing Time

Haotong & Alyssa – Margaret Minsky

CONTEXT AND SIGNIFICANCE

Firstly, we noticed the device in the recitation, which has a mechanical pulley structure, so we had the idea to make things like fishing rods which also have a mechanical structure. We want to build a fishing simulator with interaction ways like putting on the baits and auto-motor, which can take up and roll out the fish tape. However, we found it hard to put the circuit on the fish rod, so we think only to put the functions on the “pool” and the “basket”. 

After further discussion, we found it very difficult to implement all the features. We planned to make a separate fishing rod, a turntable that allows the fish to turn, and a console and basket. Alyssa was in charge of model design and production, and I was in charge of circuitry and coding.

Also inspired by the fishing toy in childhood, our fishing simulator is more interesting and real, with a roller device similar to a real fishing rod. We gradually increase in difficulty, which allows for an easy to difficult process and develops the user’s patience. The counting device of this device adds interactivity, players are required to catch all the fish within a specified time, and the rotational acceleration of the fish pond can also express the process of fish getting scared, thus restoring the actual fishing situation.

CONCEPTION AND DESIGN

There is a lot of discussion about the making of fishing rods. During the making process, I always hold with my left hand and turn with my right hand when using the rod, but my partner Alyssa is opposite to me and holds it with her right hand. So we didn’t have a handle to hold the rod conveniently and didn’t fix it to the side of the pool so that it could be used smoothly by both left and right hands and achieved user-friendliness.

In the choice of hook, we chose the most convenient magnet. This makes it easy to hook small fish. Unlike real fishing, our fish can not bite the hook by themselves, so if the hook shape, then the rod control needs to be very precise, so we purchased small round magnets, and the magnet attached to the rope is a complete circle, with positive and negative poles, we placed the magnet by the mouth of the small fish is not exactly unipolar, so there will not be only one side can be caught.

In the selection of the main circuit elements. To achieve fish counting, we considered light sensor, tilt sensor and simply circuit switches. Each sensor has advantages and disadvantages. The original counting was inspired by the shooting machine in the game room, which counts when there is light passing through the light sensor. Another technology was inspired by the lid of a garbage can, which is reversed every time we throw garbage into it. However, since we can only use cardboard, which is not heavy enough to support the lid to reverse itself back to its original position, and since the tilt sensor is not accurate in counting according to our previous experience, we gave up this idea after thinking about it. For the last mere switch, we thought of making a structure with a tilted slope, which would generate an impact whenever a small fish fell in, making the two switches contact, but still had the same concern that it was difficult to speak about the paddle switch to return to its original position, so we finally decided to use the light sensor.

FABRICATION AND PRODUCTION

Firstly, I tried to use the light sensor to count the number of fish. To increase the interaction and to make users easy to understand, we decided to use the eight-digit LED, which can show the number on it. But this component is really hard to use and connect. Initially, I simply the circuit and only used o n e   LED and a buzzer to achieve the counting function.

 

After asking the professor for help, and searching the knowledge in the Arduino, we know that an eight-dight LED can be understood as eight common LEDs. Still, two positive electrodes replace the negative, called the common anode. So we reconnected the circuit,  and it worked well. 

I also add a button which can reset the number.

And then,  I add the servo motor, which can change the direction when the position is over or equal to 180. Firstly, we want to use a button to control the playing level, but when I was writing the code, I found a good way to change the speed; every time count+1, the speed will also add, so this can achieve the process of leveling up.

During user testing, we found that the light sensor was very unstable and there was a bug that the counter would keep counting as long as the fish was not moved.

The light sensor will record the resistance value of the current environment at each start-up and then have a fixed amount of change, and whenever the initial value plus the amount of change is exceeded, then it will count. But the amount of change selected is also very unstable, and the degree of stability is also related to the color of the small fish, we laid a layer of reflective paper under the basket, so that not only can increase the environmental brightness, but also can increase the decorative nature. What’s more, I increased the delay for each count and added a flag2 to determine if the fish was removed. I debugged the best time interval based on testing so that I wouldn’t have to put in a fish and count it multiple times.

And during user testing, it was suggested that a timing feature could be added. So I added the mills function to the code. But it counts every time from the beginning of the program. I found inspiration from the light sensor to add a variation based on the change of flag to determine whether the time reaches the specified value.

 


Here is my code:

#include 
#include "pitches.h"
Servo myservo;  //

int y = 0;  //resistor of light sensor
int y_n = 0; // the delta of light sensor
int count = 0;
int bottom = 0;       //reset button
int levelBottom = 0;  //stop button
int pos = 0;
int speed = 5;
int flag = 0;// to determine whether the device is running or not

int flag2 = 0;//prevent the counting function from running when one round doesn't finish

int music[] = { NOTE_C4, NOTE_B3, NOTE_E2, NOTE_E2, NOTE_E2, NOTE_E2, NOTE_D2, NOTE_G2, NOTE_E2 };
int noteDurations[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4 };
unsigned long startTime;
unsigned long endTime;

void setup() {
  // put your setup code here, to run once:
  pinMode(12, OUTPUT);
  pinMode(8, OUTPUT);   //8是右亮
  pinMode(9, OUTPUT);   //9右下亮
  pinMode(10, OUTPUT);  //10 上
  pinMode(11, OUTPUT);  //11中间
  pinMode(13, OUTPUT);  //13左下
  pinMode(7, OUTPUT);   //7下
  pinMode(6, OUTPUT);   //6右上
  pinMode(3, OUTPUT);   //time
  Serial.begin(9600);
  myservo.attach(5);
}

void loop() {
    
  // put your main code here, to run repeatedly:
  
  if (flag == 1){
    endTime = millis();
  }

  if (y_n == 0) {
    y_n = analogRead(A0);
    y_n = y_n + 120;
  }
  bottom = analogRead(A1);
  levelBottom = analogRead(A2);


  if (millis()- startTime >= 60000 && flag == 1 ) {
    digitalWrite(3, HIGH);
    tone(12, 500);
    delay(2300);
    noTone(12);
    digitalWrite(3, LOW);
    flag = 0;
    startTime = millis();
    // 
    
    
  }

  

  if ((bottom > 1000) && (flag == 0)) {
    flag = 1;  //maybe can remove
    startTime = millis();
    y_n = 0;    
  }

  if (levelBottom > 1000) {
    flag = 0;
    count = 0;
    y_n = 0;
  }



  pos = pos + speed;
  if (pos >= 180) {
    pos = 180;
    speed = speed * -1;
  } else if (pos <= 0) { pos = 0; speed = speed * -1; } if (flag == 1) { // Serial.print("Servo: "); // Serial.println(pos); myservo.write(pos); } //myservo.write(pos); // tell servo to go to position in variable 'pos' if (bottom > 1000) {

    count = 0;
    flag = 1;
    speed = 5;
  }
  y = analogRead(A0);
  //Serial.println(y);
  Serial.println(bottom);
  if ((((y > y_n)&& (flag == 1)))&&(flag2 == 0)) {
    //digitalWrite(8,High);
    flag2 = 1;
    if (count == 1) {
      tone(12, 300);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      delay(1000);
      //digitalWrite(8, HIGH);
      //digitalWrite(9, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 2) {
      tone(12, 400);
      digitalWrite(8, LOW);
      digitalWrite(10, LOW);
      digitalWrite(11, LOW);
      digitalWrite(13, LOW);
      digitalWrite(7, LOW);
      delay(1000);
      //digitalWrite(8, HIGH);
      //digitalWrite(10, HIGH);
      //digitalWrite(11, HIGH);
      //digitalWrite(13, HIGH);
      //digitalWrite(7, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 3) {
      tone(12, 500);
      digitalWrite(8, LOW);
      digitalWrite(10, LOW);
      digitalWrite(11, LOW);
      digitalWrite(9, LOW);
      digitalWrite(7, LOW);
      delay(1000);
      //digitalWrite(8, HIGH);
      //digitalWrite(10, HIGH);
      //digitalWrite(11, HIGH);
      //digitalWrite(9, HIGH);
      //digitalWrite(7, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 4) {
      tone(12, 600);
      digitalWrite(6, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      digitalWrite(11, LOW);
      delay(1000);
      //digitalWrite(6, HIGH);
      //digitalWrite(8, HIGH);
      //digitalWrite(9, HIGH);
      //digitalWrite(11, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 5) {
      tone(12, 700);
      digitalWrite(6, LOW);
      digitalWrite(10, LOW);
      digitalWrite(11, LOW);
      digitalWrite(9, LOW);
      digitalWrite(7, LOW);
      delay(1000);
      //digitalWrite(6, HIGH);
      //digitalWrite(10, HIGH);
      //digitalWrite(11, HIGH);
      //digitalWrite(9, HIGH);
      //digitalWrite(7, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 6) {
      tone(12, 800);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(11, LOW);
      digitalWrite(9, LOW);
      digitalWrite(10, LOW);
      digitalWrite(13, LOW);
      delay(1000);
      //digitalWrite(6, HIGH);
      //digitalWrite(10, HIGH);
      //digitalWrite(11, HIGH);
      //digitalWrite(9, HIGH);
      //digitalWrite(7, HIGH);
      //digitalWrite(13, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 7) {
      tone(12, 900);
      digitalWrite(10, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      delay(1000);
      //digitalWrite(10, HIGH);
      //digitalWrite(8, HIGH);
      //digitalWrite(9, HIGH);
      noTone(12);
      delay(800);
    }
    if (count == 8) {
      tone(12, 1000);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      digitalWrite(10, LOW);
      digitalWrite(11, LOW);
      digitalWrite(13, LOW);
      delay(1000);
      noTone(12);
      for (int thisNote = 0; thisNote < 9; thisNote++) { tone(12, music[thisNote], noteDurations); delay(400); noTone(12); flag = 0; } } count = count + 1; if ((speed >= 0) && (count > 1)) {
      speed = speed + 2;
    } else {
      speed = speed - 2;
    }


    if (count == 10) {
      count = 0;
      flag = 0;
      speed = 5;
    }

  } else {
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(11, HIGH);
    digitalWrite(13, HIGH);
    delay(100);
    flag2 = 0;
  }
  //delay(10000);
}

I use the flag to determine the state of the machine. If the flag is equal to 0, everything will stop, and when the flag is equal to 1, the machine will keep going. And all the functions are connected with flags, like the servo, LEDS, and times.


 

Some pictures of FABRICATION:

To make the little fish look better, we used sewing and placed magnets in the mouth of the fish. And, we have collected a lot of wrapping paper can be a good aesthetic addition.  For the design of the fishing rod, we first thought of the Nintendo LABO, then we found a tutorial on youtube to make the fishing rod, and according to our own needs to be that into.

 

CONCLUSIONS

Our goal is to make a relaxing game that develops the interest in fishing. Our device implements all the features we wanted. The audience can eventually recognize it well as a fishing device, but one problem is that some users will put the fishing rod directly into the hole instead of taking the fish off by hand. We designed the fish trap exactly according to the real fishing situation, so we may need to add more instructions. If I had more time, I might add some features to the fishing rod, such as the need to hang your own bait. And add a loop function for the whole setup. Our device needs to manually lift the lid to remove the minnow after each time. I think it is possible to make a conveyor belt-like design to completely realize the continuity of the whole process.

At the very beginning of the project, I had some struggles with the whole installation. But due to my previous programming experience, I had a lot of ideas about how to implement the functionality. For my most annoying circuit, I tried to write a note mark on each wire, so that I could clearly know which functions are controlled by different pinMode. And, I have a much clearer idea of what to do with each component. Especially the eight-digit LED, although it looks very complicated, but after really understanding it can be used easily.

I am very happy that my collaboration with Alyssa went very well. We both have our own strengths, she’s good at design and production and I’m good at coding, and we kept advising each other during the production process, and we ended up with all the features we originally envisioned, and made a great product. So I think teamwork is also a very important part of the project, when everyone gives full play to their own strengths and has a sense of responsibility, the project will often be perfect in the end.

Here are the video of our projects: (three situations)

ANNEX

Reference

Fishing Rod:  https://www.youtube.com/watch?v=YCUM22YYSE4 

https://www.youtube.com/watch?v=vxbFUu6fYkM

 

Leave a Reply

Your email address will not be published. Required fields are marked *