Pcomp Week 7 : Midterm Project

I couldn’t come up with any satisfying idea regarding my midterm project until a week before the presentation. I first thought about something that moves linearly using a servo motor and gears but, to be honest, it wasn’t that intriguing. So I rethought from the beginning and tried to figure out what kind of physical interaction that I am usually fascinated with. As I mentioned earlier in one of the ICM postings, I am keen on the interactions like Light Kinetics. In this project, a user can roll, touch or flick lights. It makes impossible interactions with lights be possible. I also wanted to make something like it and finally, came up with an idea of blowing out lights.

The concept was simple: A user can turn off bulbs by blowing out them. Then, I associated it with blowing out the candles on birthday cake and it was again, associated with making wishes. I don’t know whether people make secret wishes when they blow out the birthday candles in other countries, at least we do so in Korea, so I determined to add the story to my project.

these are the sketches I imagined at the beginning:

At the end of the day, I chose the round one at the end of the to give more bithday-like feeling.

I also looked for sensors which can recognise blowing input, and there was actually a wind sensor:  Unfortunately, though, I was already too late to order one online, and couldn’t find any places that I was able to get it from. For an alternative, I considered making a DIY blow sensor like this using a piezo by amplifying the analogue signal with a 2N3904 transistor. However, the formula and the schematic were hard to understand so, I bought a microphone amplifier module instead. Although it works responding to sound input, it would also work as a wind sensor.

Here are the test code and results on the mic. amplifier:

For the light control, I first thought to use shift registers to control more than 20 bulbs but soon realised that I can’t control the brightness with the registers. It’s only possible to simply turn them off and on. As I wanted to turn on and off the lights gradually, I changed the plan. Each light doesn’t have to be uniquely controlled and bulbs in a line should be turned on and off at the same time. Therefore, I connected each low to a PWM pin on Arduino board. The following is the test on a circuit that has multiple analogue outputs on a pin.

And then, tested the serial fading out and in. I fixed the bulbs on a disposable dish for temporary to see the result more accurately. I had ordered a specific type of bulbs for this project, though they hadn’t delivered yet so just used any LEDs that I had.

I initially made them re-light when the user failed to blow out them at first breath, but it turned out to be a bit hard to blow out all of the LEDs if it was like so:


So it changed. The user can now blow out two lines of lights at one short blowing.

Waiting for the bulbs, I worked on the serial communication part and the computer screen part. Followings are the code on the Arduino side:

#define G1 3
#define G2 5
#define G3 6
#define G4 9
#define G5 10
#define G6 11

int b[6] = {255, 255, 255, 255, 255, 255};

boolean blow[3] = {false, false, false};
boolean micOpen = true;
boolean reset = false;

int micValue = 0;
int part = 0;

void setup() {
  pinMode(G1, OUTPUT);
  pinMode(G2, OUTPUT);
  pinMode(G3, OUTPUT);
  pinMode(G4, OUTPUT);
  pinMode(G5, OUTPUT);
  pinMode(G6, OUTPUT);

void loop() {
  analogWrite(G1, b[0]);
  analogWrite(G2, b[1]);
  analogWrite(G3, b[2]);
  analogWrite(G4, b[3]);
  analogWrite(G5, b[4]);
  analogWrite(G6, b[5]);

  if(micOpen) {
    micValue = analogRead(A0);
  if(micOpen && micValue>500) {
    blow[part] = true;
    micOpen = false;
  if(blow[0]) blowout1();
  if(blow[1]) blowout2();
  if(blow[2]) blowout3();

  if(Serial.available()) {
    char fromSerial = Serial.read();
    if(fromSerial == 'R') {
      reset = true;

  if(reset) resetCandles();

void blowout1() {
  if(b[0]>0) b[0]--;
  if(b[0]<200 && b[1]>0) b[1]--;
  if((b[0]+b[1])==0) {
    blow[0] = false;
    micOpen = true;

void blowout2() {
  if(b[2]>0) b[2]--;
  if(b[2]<200 && b[3]>0) b[3]--;
  if((b[2]+b[3])==0) {
    blow[1] = false;
    micOpen = true;

void blowout3() {
  if(b[4]>0) b[4]--;
  if(b[4]<200 && b[5]>0) b[5]--;
  if((b[4]+b[5])==0) {
    blow[2] = false;

void resetCandles() {
  if(b[5]<255) b[5]++; for(int i=4; i>=0; i--) {
    if(b[i+1]>50 && b[i]<255) b[i]++;

  if((b[0]+b[1]+b[2]+b[3]+b[4]+b[5])==(255*6)) {
    reset = false;
    part = 0;
    micOpen = true;

The full code of P5 sketch is available here: https://alpha.editor.p5js.org/yeony102/sketches/Bk52P6jab

Fabrication started after I got the bulbs. I tried to find a white and symmetrically round box, but the best I managed to get was a blue oval shape one.

Connecting wire was the trickiest part. When I connected them with jumper wires, the lights were really unstable:

So I had to change them to alligator clips for more stable connection, though, I had to fix them again after I first put them into the box because of their volume.

And now it works!

I hope that they stay connected firmly until the presentation!

Leave a Reply

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