Lab Report: Collective Decisions by Molly He

Plan:

In the lab, we pick a simple algorithm to simulate the behavior of “cohesion”. Steps are as follow:

1. Trigger

We have five micro:bit as operating micro:bit in a square and another one micro:bit as controller. Each operating micro:bit will join a radio group with the controller. Once the controller micro:bit gives out a trigger to all operating micro:bit, they will switch to the mode “cohesion” and begin to move to a certain point.

2. Calculate

Each operating micro:bit will stick to a different individual mark. The computer vision system will determine the coordinates of each mark. After we get the coordinates of all five micro:bit, we will calculate the coordinates of the point which is the average point to all five micro:bit. Then we will sent the current position coordinates and average point position coordinates to five operating micro:bit through controller micro:bit.

3. Display

After five operating micro:bit get the coordinates, they will calculate the direction they need to head to. Then they will show an arrow towards the place the mark is on there 5Ă—5 LED.

4. Move

Operating micro:bit will move towards or away from the marker. After each move, we will get the new location coordinates of the operating micro:bit and send them through controller micro:bit. The operating micro:bit will then automatically calculate the distance away from the average point and compare it with previous distant. If they move towards the marker (distant is smaller), they show a happy face on their screen. If they move away from the marker (distant is larger), they show a sad face. Once they are in the position they wanted to be, their screen displays something else (a square or a circle, for example).

Code:

Important Variables:

previous_distance 

current_distance

cur=(x_cur, y_cur)

des=(x_des, y_des)

Logic:

void loop{
current_distance=dist(des,cur);

if (previous_distance>current_distance){
display(HAPPY);
}else{
display(SAD);
}

previous_distance =dist(des,cur);

The logic of our algorithm is not hard to figure out. The only problem we need to solve is how to repeatedly send out coordinates (information) from the controller micro:bit. 

Reflection:

We spent much time deciding on which behavior we were going to mimic. We were also hesitant to make out a clear logic line of how to realize our idea. At last, we didn’t have time to actually tinker the code of CV and put our idea into practice.

Final Paper&documentation by Molly (Partner: Yaming Xu)

This is the final paper. It is written by Diana Xu. Link: final paper

After exhibiting my project in IMA show, in the undergraduate research symposium, and in Montreal at ICRA, I have collected many comments and feedback:

1. So far so good:

1)It’s good to keep the piece “magical”, to see the ball moving top-down– To keep the sand table on the floor. People would be curious about the mechanism of why the ball is moving. Many of them would actually bend down and look underneath the sand table, which is an interesting interaction that could be photoed.

2)The appearance of the sand table is decent and beautiful, making it like artwork.

3)The slow movement of the ball relates to a sense of “Zen”. The audience would actually enjoy watching it without feeling impatient. They would stare with curiosity and interest. Some would even stay longer to wait for the reveal of the pattern.

2. Suggestions:

1) The pattern could be more precise so that the ball could run continuously. (After it has finished the pattern, the robot could run backward again to its starting point.) In this case, the whole piece could be a display that doesn’t need custody.

2) There could be various patterns to choose from. In this case, it may deviate from the point of us making the sand table but makes it a more flexible and intriguing art piece.

3) The robot could be with feedback: If the ball on the table is detached from the magnet below, it would know and get back to fetch the ball and push it forward.

4) To create depth in the sand, we could also try vibration/electromagnet/back and forth.

5) People awe of the magnificence created by the pufferfish. Yet, for now, people can’t tell the relationship of the piece with pufferfish: We could either carve the ball into a fish or use a big water tank, fill it with water and make the magnet draw at the bottom of the tank on the sand. Meanwhile, there could be a display (using TV or printed picture) of the actual pattern drawn by the pufferfish to inform people in a better way than a simple description in a verbal presentation or written form.

Biology Observation by Molly He (Partner: Diana Xu)

In this lab, we first learned about how to tell the difference between male and female flies. We also learned about the circadian rhythm.

This is the type of fly that is with the gene of Parkinson’s disease. There is a control group that is healthy.

 

This is when the flies are immobilized by CO2. This is also a board that emits CO2 to keep the flies asleep.

The left is the male, right female fly.

 

We are accounting for Monitor1, line 17-32. The red dotted ones are disease group.

 

We can see that there are some flies killed by us by accident that have all zero showings. For others, I lack the ability to use the computer tool to analyze the data. I could tell by naked eyes that most flies followed the circadian rhythm.

You know you have magic–Weiyi He–Marcela

  • CONCEPTION AND DESIGN:

The user would like to see their impact on the project real time, knowing what they are doing–Therefore, we used color detect to detect the motion of the user’s waving the wand, and show the trace on the screen real time. Moreover, the trace would disappear gradually, ensuring that the screen isn’t too messy.

We want the user to do certain gesture to be like performing a magic trick. How the user is to be informed is to indicate the desired gesture on the screen for them to follow–We add a text “follow me” that keeps circling on the screen. The user would naturally follow the circle with their wand. The speed of the text an adjusted to make it comfortable and easy to both for the user to follow and for the computer to detect.

The magic wand and a piece of music from Harry Potter are used. When the user has done the right trick, a parchment with the sentence “Time for magic!” would appear, and a music clip indicating that the user has triggered a magical phenomenon would be played. We want to create a magical atmosphere, especially related to Harry Potter. I am a big fan of Harry Potter, so are many millennials. They would relate to this experience deeply.

The final part of the project is that a robot would move and draw a pattern related to Harry Potter on sand using magnetic balls. However, due to the time limit, we weren’t able to figure it out. Choosing this robot is because the magnetic ball drawing on the sand without seeing a robot driving it (actually it is running underneath the sand table) is a magical scene. It connects to the topic of magic well. 

  • FABRICATION AND PRODUCTION:

The most significant step is to track the motion of the user well. It occurs that the lighting, the background, the area being tracked and the color itself are all factors that influence the successfulness of color tracking. We at first used a simple method of loading pixels and comparing the color code to spotify the desired color that appears in certain pixels. Then, we find out that it isn’t precise enough during the User test. Therefore, we switch to another method using the OpenCV library.

In the User test, we find out that if the strokes are kept on the screen, the interface would be messy and the user would feel lost of what they are doing. Therefore we make the stroke to vanish after a certain time. In addition, the “follow me” text used to be a green circle that goes slower. It was not tempting for the user to follow. Therefore, we change the circle into the text and adjust the speed. The adaptations worked well later on.

We at first wanted the user to perform a much more complicated magic gesture than drawing a circle. However, we found out that restricting the area to detect and count the pixels is hard. Therefore, it only becomes drawing a circle, which still serves as performing a magic trick. Moreover, we at first wanted to map the user’s drawing in the air onto the drawing on the sand. However, the procedure is too complicated for us, thus we switched to drawing a square that is pre-coded, which still serves as drawing a pattern on the sand with a magnetic ball that creates a magical sense.

  • CONCLUSIONS:

The part of the user’s drawing certain gesture that triggers the robot to move gives the user a feeling that they are interacting with the computer. They input the gesture and receive the feedback of both the computer showing “Time for magic” with a sound effect and the car starting suddenly. The whole interaction helps the user to realize an impossible dream that they may know magic. Although it doesn’t include much profundity, arousing the user to think hard, it includes fun, which already fulfills the meaning of interaction.

The audience interacted with my audience in an expected way to perform the magic trick. They learn the scene to be about Harry Potter because of the wand, music, and parchment. Nevertheless, they expect more to happen other than the moving of a robot that seems to be unrelated to Harry Potter.

If we have more time, we will first add a spell for the user to speak out when they are doing the trick with their wand. It would be more like a magic trick when adding this “nonsense”. For the robot drawing on the sand part, I would choose another way to realize the goal of “doing magic”. I would replace the robot with probably a fog machine, a carpet that flows, or Quidditch (Those are elements mentioned in the class review). Those are options that take fewer efforts and the concept of Harry Potter could be emphasized more. 

Our biggest problem with this project is that we didn’t expect the workload well and picked on a harder goal that wouldn’t be accomplished within such a short period of time. We should have been more aware of our ability and time limit to make sure the completion of the project. Meanwhile, I’m still proud of what we have accomplished: the mastery of OpenCV, if statement and pixel manipulation.

To create a magical world where happiness is all around, we should work hard to make people believe that they have the magic to make the world a better place.

  • CODE & Video:

Processing:

Arduino:

/* Encoder Library – TwoKnobs Example

   http://www.pjrc.com/teensy/td_libs_Encoder.html

   This example code is in the public domain.

*/

#include <Encoder.h>

int state = 0;

// Change these pin numbers to the pins connected to your encoder.

//   Best Performance: both pins have interrupt capability

//   Good Performance: only the first pin has interrupt capability

//   Low Performance:  neither pin has interrupt capability

Encoder knobLeft(2, 11);

Encoder knobRight(3, 12);

//   avoid using pins with LEDs attached

const int motor_l_E = 9;

const int motor_l_A = 8;

const int motor_l_B = 7;

const int motor_r_E = 5;    //flipped this pin because it has PWM

const int motor_r_A = 6;

const int motor_r_B = 4;

void setup() {

  Serial.begin(9600);

  Serial.println(” Encoder Test:”);

  pinMode(motor_l_E, OUTPUT);

  pinMode(motor_l_A, OUTPUT);

  pinMode(motor_l_B, OUTPUT);

  pinMode(motor_r_E, OUTPUT);

  pinMode(motor_r_A, OUTPUT);

  pinMode(motor_r_B, OUTPUT);

  motorStop();

  pinMode(13, OUTPUT);

}

void loop() {

if (Serial.available() > 0) { // Checks whether data is comming from the serial port

    state = Serial.read(); // Reads the data from the serial port

  }

  //  if (newLeft != positionLeft || newRight != positionRight) {

  //    Serial.print(“Left = “);

  //    Serial.print(newLeft);

  //    Serial.print(“, Right = “);

  //    Serial.print(newRight);

  //    Serial.println();

  //    positionLeft = newLeft;

  //    positionRight = newRight;

  //  }

  //  // if a character is sent from the serial monitor,

  //  // reset both back to zero.

  //  if (Serial.available()) {

  //    Serial.read();

  //    Serial.println(“Reset both knobs to zero”);

  //    knobLeft.write(0);

  //    knobRight.write(0);

  //  }

  if (state == ‘1’) {

    

//   goStraight();

    Serial.println(“go!”);

    digitalWrite(13, HIGH);

  forward( 1000) ;

  rotate(300);

    forward( 1000) ;

  rotate(180);

    forward( 1000) ;

  rotate(180);

    forward( 1000) ;

//  forward( 1000) ;

//  forward( 1000) ;

//  forward( 1000) ;

  motorStop();

  delay(20000000);

    state=0;   

}else{

    Serial.println(“stop!”);

  motorStop();

  digitalWrite(13, LOW);

}

}

void forward( int steps) {

  digitalWrite(motor_l_A, HIGH);

  digitalWrite(motor_l_B, LOW);

  digitalWrite(motor_r_B, LOW);

  digitalWrite(motor_r_A, HIGH);

  long newLeft, newRight;

  knobLeft.write(0);

  knobRight.write(0);

  int spd = 150;

  while ( abs(knobLeft.read()) < steps ) {

    newLeft = knobLeft.read();

    newRight = -knobRight.read();

    int dif =  (newLeft – newRight) /2;

    Serial.print(“Left = “);

    Serial.print(newLeft);

    Serial.print(“, Right = “);

    Serial.print(newRight);

    Serial.print(“, dif = “);

    Serial.print(dif);

    Serial.println();

    Serial.println();

    analogWrite(motor_l_E, spd + dif);

    analogWrite(motor_r_E, spd – dif);

  }

  motorStop();

}

void back( int steps) {

  digitalWrite(motor_l_A, LOW);

  digitalWrite(motor_l_B, HIGH);

  digitalWrite(motor_r_B, HIGH);

  digitalWrite(motor_r_A, LOW);

  long newLeft, newRight;

  knobLeft.write(0);

  knobRight.write(0);

  int spd = 150;

  while ( abs(knobLeft.read()) < steps ) {

    newLeft = knobLeft.read();

    newRight = -knobRight.read();

    int dif =  -(newLeft – newRight) /2;

    Serial.print(“Left = “);

    Serial.print(newLeft);

    Serial.print(“, Right = “);

    Serial.print(newRight);

    Serial.print(“, dif = “);

    Serial.print(dif);

    Serial.println();

    Serial.println();

    analogWrite(motor_l_E, spd + dif);

    analogWrite(motor_r_E, spd – dif);

  }

  motorStop();

}

void motorStop() {

  digitalWrite(motor_l_A, LOW);

  digitalWrite(motor_l_B, LOW);

  digitalWrite(motor_r_B, LOW);

  digitalWrite(motor_r_A, LOW);

  analogWrite(motor_l_E, 0);

  analogWrite(motor_r_E, 0);

}

void rotate( int steps) {

  digitalWrite(motor_l_A, HIGH);

  digitalWrite(motor_l_B, LOW);

  digitalWrite(motor_r_A, LOW);

  digitalWrite(motor_r_B, HIGH);

  long newLeft, newRight;

  knobLeft.write(0);

  knobRight.write(0);

  int spd = 150;

  while ( abs(knobLeft.read()) < steps ) {

    newLeft = knobLeft.read();

    newRight = -knobRight.read();

    int dif =  (newLeft – newRight) /2;

    Serial.print(“Left = “);

    Serial.print(newLeft);

    Serial.print(“, Right = “);

    Serial.print(newRight);

    Serial.print(“, dif = “);

    Serial.print(dif);

    Serial.println();

    Serial.println();

    analogWrite(motor_l_E, spd + dif);

    analogWrite(motor_r_E, spd – dif);

  }

  motorStop();

}

Recitation 10: Media Controller by Molly (Weiyi He)

How tech is used in my project:

  1. Motion detect (color dependent): The movement of the wand is detected and appears on the screen. The user knows that he is drawing something in the air. There is a tag “follow me” moving in a circle on the screen, indicating the user to draw a similar circle. The motion detect and display gives the user a reason and meaning to draw and to follow the pattern of drawing.
  2. Bluetooth connection: When the user has drawn the gesture correctly, a car would be triggered to draw a pattern underneath the sand table. The trigger process is wireless, making the user feel that it is “magic”.
  3. Drawing robot: A magnetic ball on the sand table would be driven to create the drawing on the sand. The drawing process is both the combination of “zen” and creativity.