Final Progress

While the Infrared senors are on their way, I worked a bit on the P5 part of the project.

Sketch

I created a simple welcome screen and and ambience controller with 9 options. Each options is basically a image which acts as a button as well. Clicking on any will cause the following on P5 and Arduino

  • A visual on the screen in correspondence to the chosen ambience
  • An Audio played on computer speakers
  • RGB tape lights around adjusting according the chosen ambience in terms of there color and blink rates

There is a back button on top left of each ambience to exit from it.

I tried to follow OOP. I made two classes one for the button and one for the main app and but them in the separate files. Button handles representing the images and buttons while app handles the transition between the pages and rendering of animation for each ambience. Then they both are combined in sketch.js.

The communication from P5 to Arduino will be about the light control and the display on the LCD. While the the communication from Arduino to back would be in from of distance sensor readings. I am planning on using it as way to communicate by gestures. The idea is the sensor will be at a fixed place so the reading will be constant. If a hand is placed in front of it for two seconds, everything will pause, and if a hand in waved in front of the P5 will trigger a different ambience. Also something I can add is the heat sensor and have the light take some input form it but I don’t think that I can generate enough of temp difference in the room to see it’s effects.

Here is the part of P5 code I am most proud of

chill() {
    background(0);

    let pulse = 150 + sin(this.t) * 60;

    noStroke();
    fill(180, 220, 255, 80);
    ellipse(width / 2, height / 2, pulse);

    for (let i = 0; i < 8; i++) {
      let x = width / 2 + sin(this.t + i) * (100 + i * 10);
      let y = height / 2 + cos(this.t + i) * (80 + i * 8);

      fill(255, 255, 255, 80);
      circle(x, y, 6);
    }
  }

I use of sign function have a motion that is not exactly repetitive was the most hard but fun part. I had the idea of using sin but how it to make it work was proved to be very tricky

I used AI for coming up with Animations for the ambience on screen. I will refine it later to match the lights, but only when I am working with lights. Other than that I used AI to tidy up the code.

Leave a Reply