Midterm Project: Chameleon by Eugene(Zhiqiu Wang)

Midterm Project: Chameleon by Eugene(Zhiqiu Wang)

Partner: Yijia Chen

 

Before launching into the midterm project, we had come across

In this half semester, we learnt the knowledge of how to use arduino to give instructions to components like LEDs and motors which is interactive. These projects all enriched my understanding upon the definition of interactive which is also the main theme of this course. And as for this midterm assignment, I was inspired by the chameleon in a film called Rango who is always good at adapting to different environment and this triggered my idea for my project. As we all know, there are countless brilliant idea and projects got their inspiration from the nature. And there are a lot of interaction exists in the wild animals, especially chameleons. Chameleons are famous for its adaptability because they can change their color according to the environment they are at. So I discussed with my partner and we quickly agreed on my idea. Since we are still green hand in this field so we decide to make something not very complex. Just like the chameleon, our project can also detect the outside environment and change to certain color. At first, we thought of apply it to decorative billboard which can change color or brightness according to the environment. Later, we realize that we can also use it to benefit those color-blind patients and help them to differentiate colors which is of great benefit to social benevolence. 

We bought LEDs belts and color sensors to build our project. For the target audience’ easier understanding of our project, we choose to use laser cut to make the cute monster-like surface for our project. And we also wrote ‘Feed me with the energy bar’ on the top of the box so as to let the audience know how to use it. For each side, we cut a lot of circles except the top so as to let the LEDs light through the box and energy bars are made of Legos of different colors.

We both believe that the most significant and challenging part of our project is the coding part. Since we haven’t learnt about the code used for the color sensor so we did quite a lot of research online and asked help from classmates and professors. It took us a long time to adjust the white balance of the color sensor because we only had one sensor so the result is not precise enough. At the same time, another obstacle is the loose connection of jumper cables. Every time an error exist, it took us very much time to examine where the problem came from.

 

Before the user test session, some of the jumper cables loosed and it took us a long time to fix it so we decided to fix them on the side board with tapes to avoid this situation happen again. 

During the user test, sometimes the sensor fail to reflect to the color bars and we finally found out it is because of the different angle of the bars when they are put in. So I made another support to maintain the color sensor at a certain position. And the final audience’ feedback in the course is actually quite good. Most of the students are surprised by how it functions and its cute appearance. Their interaction with the chameleon is quite fluent and they enjoy the process of change its color with energy bar very much. 

However, this version of chameleon is far away from the full version which can be actually used in our life. If more time permitted, we will have further understanding of color sensor which can enable it to give out more light. And we understood that even the smallest connection failure or coding error can lead to the final failure so we have to care for every small detail in the circuit. What’s more, any kind of interaction can bring convenience and happiness to people. By using our project, people save the time of changing the color personally. And the smiles seen on audience’ faces also show the charm of interaction. Most importantly, the social function embedded in those interactive technologies can really contribute to human race and help the unprivileged people tremendously. With more interactive projects created, I believe that the human being can be a more intelligent species and make the world a better place.

IMG_4058

Code:

#define LED_R 5 

#define LED_G 6 

#define LED_B 3 

#include <SoftwareSerial.h>

SoftwareSerial mySerial(8, 9);

byte rBuf[8] = {};

byte R[10] = {};

byte G[10] = {};

byte B[10] = {};

byte final_R = 0;

byte final_G = 0;

byte final_B = 0;

int hist_pos = 0;

byte buf = 0;

byte last = 0;

void setup()

{

  Serial.begin(9600);

  mySerial.begin(9600);

  pinMode(LED_R, OUTPUT);

  pinMode(LED_G, OUTPUT);

  pinMode(LED_B, OUTPUT);

}

void loop()

{

  if (mySerial.available() > 0) {

    buf = mySerial.read();

    if (buf == 90 && last == 90) {

      //read!

      //Serial.println(“head arrived”);

      while (mySerial.available() < 6) {

        //Serial.println(“wait for next 6 bytes”);

        delay(5);

      }

      mySerial.read();

      mySerial.read();

      R[hist_pos] = mySerial.read();

      G[hist_pos] = mySerial.read();

      B[hist_pos] = mySerial.read();

      mySerial.read();

      //Serial.println(“RGB arrived”);

      /*

      */

      hist_pos++;

      if (hist_pos == 10) {

        hist_pos = 0;

      }

      final_R = R[0];

      final_G = G[0];

      final_B = B[0];

      for (int i = 1; i < 10; i++) {

        if (R[i] > final_R) {

          final_R = R[i];

        }

        if (G[i] > final_G) {

          final_G = G[i];

        }

        if (B[i] > final_B) {

          final_B = B[i];

        }

      }

      Serial.print(“R=”);

      Serial.print(final_R);

      Serial.print(” G=”);

      Serial.print(final_G);

      Serial.print(” B=”);

      Serial.println(final_B);

      /*

        final_R = map(final_R, 75, 185, 0, 255);

        final_G = map(final_G, 120, 136, 0, 255);

        final_B = map(final_B, 70, 200, 0, 255);

        analogWrite(LED_R, 255 – final_R);

        analogWrite(LED_G, 255 – final_G);

        analogWrite(LED_B, 255 – final_B);

      */

      

      if (final_R > final_G && final_R > final_B) {

        Serial.println(“RED”);

        analogWrite(LED_R, 0);

        analogWrite(LED_G, 255);

        analogWrite(LED_B, 255);

      }

      else if (final_G > final_R && final_G > final_B) {

        Serial.println(“GREEN”);

        analogWrite(LED_R, 255);

        analogWrite(LED_G, 0);

        analogWrite(LED_B, 255);

      }

      else if (final_B > final_R && final_B > final_G) {

        Serial.println(“BLUE”);

        analogWrite(LED_R, 255);

        analogWrite(LED_G, 255);

        analogWrite(LED_B, 0);

      }

      

      delay(10);

    }

    last = buf;

  }

}

Leave a Reply