Skip to content →

Date archive for: October 2015

p-comp / midterm – rgb light to cmyk pigment

for the p-comp midterm me and Nilomee decided to make a RGB to CMYK converter, in which you pick the light color and get the correspondent color pigment. In simple steps, we wanted the whole mechanism to work in this order:

  1. set the amount of red, green and blue you want;
  2. save this color;
  3. convert this color from RGB color mode to CMYK;
  4. put the percentage of each of the colors of the CMYK mode inside a recipient;
  5. mix the colors;
  6. print them on a paper.

Also developing the process in this order, we chose to work with three potentiometers and a RGB LED light so that the user can pick separately the amount of each color(red, green and blu). Once the user had set the color, he/she would click on a button to save the value of each channel.

pcomp-midterm-01

After we had the RGB value, it was time to convert it do CMYK. We searched over the internet for formulas that would easily convert them and we didn’t find any that was clear to the program or that gave precise values (they would only point if any of the channels were present or not). So we decided to figure out by ourselves the formula, which started very confusing because the RGB works with a range of amounts (0-255) and the CMYK works with percentage (0-100) that are independent of each other. Also, it was confusing to know when the shade of a color got lighter/darker due to the opposite behaviours each of them have on the two color modes and what was the exact correspondency between those systems (which colors on RGB generate colocr channels of the CMYK and vice-versa).

After some brain melting, we decided to use 255 as the value that represent 100% on the CMYK and to create the exceptions. If all the channels of the RGB are 0, we have 100% in all CMYK channels(black) and if we have 255 in all RGB channels, all colors are 0% (white). And we found the proportion between the color correspondency between RGB to CMYK. The colors are not exactly the same, but they are as close as possible

CMYK > RGB

C = G + B

G and B have the same proportion and we know they have to be on their maximum value to get 100% cyan.

100C = 255G + 255B

––

RGB > CMYK

B = C + M

And to have Blue, you have cyan and magenta at 100% and 0% of yellow or black.

255B = 100C + 100M + 0Y + 0K

So not only we mapped the potentiometer values (0-1023) to the RGB colors (0-255), but we also mapped the RGB colors(0-255) into CMYK correspondents(0-100).

//RGB LED declare
int pin1 = 11; //red
int pin2 = 10; // green
int pin3 = 9; // blue

// switch button
int switchPin1 = 7;

// RGB color combinationl
int colorRed;
int colorGreen;
int colorBlue;

// CMYK color combination
int colorC;
int colorM;
int colorY;
int colorK;
void setup() {
Serial.begin(9600);
//RGB LED individual pins as output
pinMode(pin1, OUTPUT); //RED
pinMode(pin2, OUTPUT); //GREEN
pinMode(pin3, OUTPUT); //BLUE

//switch button as input
pinMode(switchPin1, INPUT);
}

void loop() {
//map potentiometer1 to output Red's value
int pot1 = analogRead(A0);
int pot1converted = map(pot1, 0, 1023, 0, 255);
analogWrite(pin1, pot1converted);

//map potentiometer2 to output Green's value
int pot2 = analogRead(A1);
int pot2converted = map(pot2, 0, 1023, 0, 255);
analogWrite(pin2, pot2converted);

//map potentiometer3 to output Blue's value
int pot3 = analogRead(A2);
int pot3converted = map(pot3, 0, 1023, 0, 255);
analogWrite(pin3, pot3converted);

//if button is pushed, save the RGB combination
if (digitalRead(switchPin1) == 1) {
Serial.println("ON");
int colorRed = pot1converted;
int colorGreen = pot2converted;
int colorBlue = pot3converted;

Serial.print("RGB color = ");
Serial.print(colorRed);
Serial.print(",");
Serial.print(colorGreen);
Serial.print(",");
Serial.println(colorBlue);

colorC = (map(colorBlue, 0, 255, 0, 100) + map(colorGreen, 0, 255, 0, 100)) / 2;
colorM = (map(colorBlue, 0, 255, 0, 100) + map(colorRed, 0, 255, 0, 100)) / 2;
colorY = (map(colorRed, 0, 255, 0, 100) + map(colorGreen, 0, 255, 0, 100)) / 2;
if (colorRed == 0 && colorGreen == 0 && colorBlue == 0) {
colorC = 100;
colorM = 100;
colorY = 100;
colorK = 100;
}
if (colorRed == 255 && colorGreen == 255 && colorBlue == 255) {
colorC = 0;
colorM = 0;
colorY = 0;
colorK = 0;
}
Serial.print("CMYK color = ");
Serial.print(colorC);
Serial.print(",");
Serial.print(colorM);
Serial.print(",");
Serial.print(colorY);
Serial.print(",");
Serial.println(colorK);
delay(1000);

}
}

Once we had the CMYK values, we started to test the ink dripping – this was definitely the trickiest part of the process and that we ended up spending more time than we could. We wanted to make a treadmill in which you would have each color hanging in recipients above it. A small recipient would be over the treadmil’s belt; it would stop below each color recipient and wait for the color to drip the right amount before moving on to the next color.

pcomp-midterm-02At first, we wanted this part of the machine to be fully automated: once you pick your color on the LED, it would start to move the recipient to the first color, count how many drops of ink felt and then move on to the other color. But then we saw that it would demand a bigger time to: analyze the rhythm in which the ink dripped and also what kind of mechanism would we use to stop/star tthe dripping.

 

After talking with Jeff and Pedro (one of the residents), we saw that we had some possibilities to do so: use a syringe + mechanism to press it, use a dropper + solenoid, use a peristaltic pump or leave the recipients dripping and control the time they stay under each color.

Because of time and budget limitations, we experimented the dropper and the control time options. We tried using the dropper of the ink itself and it was made of a plastic that was too rigid, so it wouldn’t vary that much when pressed with a solenoid or a servo motor. So we moved on and tried to work with time duration and the dripping. Calculating how many drops per second was not that precise to translate it in time duration because the pace would vary according to the volume of the flask.

In the end, we decided that the more manageable alternative to do so was to leave all recipients continually dripping (with a recipient below the treadmill) and the user controls how much time the pot stays below each color ( ideally counting the drops) by pressing a button to make the recipient over the threadmill move.

 

#include 

int switchPin = 3;

Servo myServo;
int angle = 0;
int buttonState = 0;

void setup() {
  Serial.begin(9600);
  pinMode(switchPin, INPUT);
  myServo.attach(6);

}

void loop() {

  buttonState = digitalRead(switchPin);
  if (buttonState == HIGH) {
    Serial.println("ON");
    angle = angle + 30;
    myServo.write(angle);
    Serial.print("angle =");
    Serial.println(angle);
    delay(1000);
    if (angle > 180) {
      angle = 0;
    }
  }
}


To make the treadmill, we used two servo motors and tested several sizes of gears attached to the servos, that had a belt over them. We opted to get bigger gears to have a bigger distance between the recipients, so we started prototyping for the final version – and that’s when things got tangled. I think that the part that demanded knowlegde that neither me or Nilomee have was the fabrication part. We perceived to build it, but there were some measurements and pieces placement that we didn’t think it through that much and once we had the final pieces, it wouldn’t fit.

 

However, for the purpose of illustration and delightment, here’s a picture of our little frankenstein:

IMG_0540

It was great working with Nilomee, I think we were able to colaborate and build up this project a lot due to our different interests/background. We definitely need to get better on our fabrication skills – which means we did the right thing of taking intro to fabrication on the 2nd session. Right on time for the final =)

One Comment

icm / week08 – sound & video

for this week, I wanted to explore a little bit of what we were introduced in class: video and sound on p5. I also had a class this week about synthesizer sounds that we were questioned how to make the sound of the ocean on a digital software – and you can do it (as similar as possible, obviously is not the same thing) but raising the volume up and down a white noise.

so I decided I wanted to make a beach in which the water level would vary according to the person’s movement (captured by the webcam) and the closer the water leve is from the shore, the louder is the white noise.

I had some issues with the video capture, because it is not that smooth and I couldn’t perceive a pattern on how the user’s movement( left > right / back > forth ) was affecting the tide. It was a good exercise and I hope to explore more the sound usage on p5.

Here’s the sketch, move around and have some calming (but fun) time!

Leave a Comment

cws / midterm

cws-midterm_001For the midterm acoustic experiment I decided to make a sound installation that uses phase shifting to affect the spacial perception of the user. It consists on two sound sources that emit some kind of rhythmic sounds and their rhythm are slightly of one another.

I decided to use brass bells because of the resonance they have created the effect of phase shifting. Combining a little bit of what we learned at p-comp, I programmed two servo motors to dictate the pace, making the wooden cylinders hit delicately on the brass – in a way that people would stand being in between both.

I started prototyping the structure with cardboard, to see how the motor + wood + bell would work in a way that could be hanging from the ceiling. The laser cutter for sure was of great help and after I got the “enclosure” right, I did some final tweaks on the assemblage, specifically on the pace of each of the sound sources.

Then, when I got both objects assemble that I’ve realized a big problem over this installation: the servo motors were too close from the bells (and therefore the ears) and created a distinguished noise that was overlapping the resonance made with the hit.

Due to my limitations/lack of knowledge over prototyping, I believe this project can still go on as be my final project. I think there were some great points in this midterms: using non-digital oscillators to create a manipulated sound effect, being able to imagine a final enclosure to it and testing what I’ve imagined to see that it kind of work. I feel that I want this project to evolute to feel more like an installation, to think better about materials, sound sources and assemblage.

Leave a Comment

icm / week 07 – DOM + arrays

Hi there! Long time no see because I was really confused about functions, objects (constructor forms) and arrays – and DOM as well. but now I think I’m understanding them bette,r just need to practice more and watch some of Shiffman’s videos to catch up =)

So I kind of figured out how arrays work and I wanted to use them with the DOM exercise. I decided to create a gradient canvas in which the user can control the amount of red, blue and green on the screen and that this gradient value would vary with the width of the canvas.

 

I think it’s still confusing how DOM elements and the sketch integrate and they behave differently so sometimes I didn’t know how to fix some issues (ie if I put an html text, it won’t reload but will keep on writing over the last text, kind of messy).

It was nice to exercise a bit and get introduced to DOM, but it would be great if we could do some of the examples in class, going step by step.

You can check my sketch here.

Leave a Comment

cws / week05 – (finally) building a microphone

so this week’s assingment was to build a microphone. if you look at the videos and tutorials around the web it seems pretty easy, but it actually required a lot of testing to make sure that it is working. I decided I wanted to make a small microphone and therefore I got small ceramic magnets and found the rest of the material’s on the shop (although this made me think that I might haven’t got the exact materials/thought it might not make the mic work).

My first prototype was this one:

cws_week05_01

After putting all the components together, I connected it to the oscilloscope and it didn’t get any vibrance from the microphone. I had some help from one of my colleagues, who gave me some useful tipis such as: the coil can’t go crazy around the straw, the straw has to be fixed to the top surface (they were loose one from the other) and the magnet part had to be stable.

So I did a second version, trying to make a bigger area of contact (connected through tape) and to stabilize the lower part. The problem was that because of the eletric magnet field / magnets attraction the needle wouldn’t be centered the way I wanted to. Also, this one did not work:

cws_week05_02

 

And then I did my third and last shot – that worked!! I redid the coil wrap around the straw, I glued the needle + washer structure on the bottom of the cup and glued the straw to the plastic film. This worked! I was very glad/relieved/proud that I saw some vibrance variation on the oscilloscope (although I don’t get why the signwave is increasing, instead of ending on the same level as the beggining of it). Here’s a picture and some videos:

cws_week05_03

Leave a Comment

icm / friday workshop

Last friday all of icm classes got together to understand how to communicate between arduino and p5, followed by the one button design challange =)

I was paired with Zoe and we decided to do a slot machine haiku from which we could get reflections over ITP stuff.

week05_02

We were able to make the serial communication between them, but we weren’t able to figure out which part of the code on the p5 was placed on the wrong place – so the program didn’t actually worked the random combinations part of it. Despite that, it was definitely fun to do it and see everybody together working on small creative applications.

week05_01

One Comment

p-comp / week 04

this week i took the time to review all the concepts we were taught during class. obviously the quizz was the kick start for that, but i’m glad it was because i really want to be comfortable with the electrical part of the circuit. i was also able to make all the labs and understand how the circuit and code are working together.

so for this assignment, i decided to work with servo motors to make a thread reel to move. if i had more time, i’d definitely try to make a structure so that you can let the thread roll around freely. i felt like it was much clear for me to build it by myself after i had reviewed all the content, so i was able to put the servo motors with a photocell. the software read the photocell values and mapped it, giving a correspondent value within angles (0-180).

and the code for this circuit:

 
#include 
Servo servoMotor1;
Servo servoMotor2;

int photoValue = 0;
int servoPin1 = 3;
int servoPin2 = 5;
int servoAngle = 0;
int libraryInstance = 0;

void setup() {
  Serial.begin(9600);
  servoMotor1.attach(servoPin1);
  servoMotor2.attach(servoPin2);
}

void loop() {
  int photoValue = analogRead(A0);
  Serial.println(photoValue);
  int servoAngle = map(photoValue, 150, 980, 0, 180);
  servoMotor1.write(servoAngle);
  servoMotor2.write(180 - servoAngle);

}

Leave a Comment