Posts Tagged ‘ arduino ’

PCOMP Final final project

After numerous revisions it’s finally finished.

physical computing

More or less. Working with small parts is very difficult especially with 30 gauge wire which is barely a thread and breaks easily which is one of the main problems I encountered with this project.

physical computing

The code is working great. But I may have crossed some wires that make the white array and yellow array stay on all the time. But the effect is there. I’m at a point where I don’t want to touch it anymore for fear that it may not work by noon today. I am honestly not satisfied with my work but the important part is I learned a lot with this project in terms of building and fabrication which I really need to work on.

Right now it’s all packed up in a box for transportation to the ITP floor. Thank you for a wonderful experience in Physical Computing.

physical computing

PCOMP Final final project

After numerous revisions it’s finally finished.

physical computing

More or less. Working with small parts is very difficult especially with 30 gauge wire which is barely a thread and breaks easily which is one of the main problems I encountered with this project.

physical computing

The code is working great. But I may have crossed some wires that make the white array and yellow array stay on all the time. But the effect is there. I’m at a point where I don’t want to touch it anymore for fear that it may not work by noon today. I am honestly not satisfied with my work but the important part is I learned a lot with this project in terms of building and fabrication which I really need to work on.

Right now it’s all packed up in a box for transportation to the ITP floor. Thank you for a wonderful experience in Physical Computing.

physical computing

PCOMP Finals update

Dropped Processing. Dropped Temp sensor. Long live the Ultrasonic sensor.

I gave in and picked up the ultrasonic sensor. A quick jab at the library and pasted the same values I had for the temp and got it working.

PCOMP UPDATE

I initially used a central ground to reduce the cabling and copper tape to for the wiring. This was a mess. I switched to a thinner wire which meant re-soldering everything.

PCOMP UPDATE

Disaster strikes! A part of my arcylic falls off. Crazy glue to the rescue.

The good thing is that it works. Sort of.

PCOMP UPDATE

Still a way to go but a lot closer now.

PCOMP UPDATE

PCOMP UPDATE

Pampanga Lantern Weekend update

I decided not to fly out for Thanksgiving and instead work on my Physical Computing final project. I initially started out Thanksgiving by going through the Muppet Show episodes and getting the Open CV code to work.

My classmate Adria Navarro-Lopez suggested to use the OpenCV library instead of the Open Kinect to make things easier but sadly it was not. I got help from Lisa Park on installing the library and went to work. I got the OpenCV library to detect faces using the example of detecting faces and went through the code and send it out to the arduino via serial.

Processing code for face detection for some reason it only works on Processing 2.0a1 and not 2.0a4:

import processing.serial.;
import hypermedia.video.
;
import java.awt.Rectangle;

Serial myPort;
OpenCV opencv;

// contrast/brightness values
int contrastvalue    = 0;
int brightness
value  = 0;
String facesFound [];

void setup() {
  size(320, 240);
  println(Serial.list());
  //  String portName = Serial.list()[0];
  myPort = new Serial(this, Serial.list()[0], 9600);
  opencv = new OpenCV(this);
  opencv.capture(width, height);
  opencv.cascade( OpenCV.CASCADEFRONTALFACEALT );
}

public void stop() {
  opencv.stop();
  super.stop();
}

void draw() {

  // grab a new frame
  // and convert to gray
  opencv.read();
  opencv.convert( GRAY );
  opencv.contrast( contrastvalue );
  opencv.brightness( brightness
value );

  // proceed detection
  Rectangle[] faces = opencv.detect( 1.2, 2, OpenCV.HAARDOCANNY_PRUNING, 40, 40 );

  // display the image
  image( opencv.image(), 0, 0 );

  // draw face area(s)
  noFill();
  stroke(255, 0, 0);

  for ( int i=0; i<faces.length; i++ ) {
    rect( faces[i].x, faces[i].y, faces[i].width, faces[i].height );
  }
  //count number of faces and send to arduino
  println(faces.length);
  //facesFound=faces.length;
  // myPort.write(facesFound);
  myPort.write(faces.length);
}

/*
 
Changes contrast/brigthness values
 */
void mouseDragged() {
  contrastvalue   = (int) map( mouseX, 0, width, -128, 128 );
  brightness
value = (int) map( mouseY, 0, width, -128, 128 );
}

The main problem I encountered was stabilizing the response of the arduino, The LED would flicker in response and not exactly the way I wanted. But the code was running the way I wanted it. It was the same problem my media controller group had encounted with the blue LED.

Arduino code for receiving:

//arduino code for lantern
//Melissa dela Merced mdm532@nyu.edu

const int bluePin=11;
const int greenPin=10;
const int whitePin=9;
const int yellowPin= 6;
const int redPin= 5;

int value = 0;

void setup(){
  Serial.begin(9600);

  pinMode(redPin, OUTPUT); //red LED
  pinMode(yellowPin, OUTPUT); //yellow LED
  pinMode(whitePin,OUTPUT); // white LED
  pinMode(bluePin,OUTPUT); // blue LED
  pinMode(greenPin,OUTPUT);//green LED
}
void loop(){
 // if (Serial.available){
    int input = Serial.read();
  if (input == 0);
  {
    digitalWrite(bluePin, LOW);
    digitalWrite(redPin, LOW);
    digitalWrite(yellowPin, LOW);
    digitalWrite(whitePin, LOW);
    digitalWrite(greenPin,LOW);
  }

  if (input ==1){
    digitalWrite(bluePin, HIGH);
    /   Serial.write(input);
     for(value=0; value <=255; value++){
     analogWrite(bluePin, value);
     delay(10);
     }
/
  }
  /* else{
   digitalWrite(bluePin, LOW);
   digitalWrite(redPin, LOW);
   digitalWrite(yellowPin, LOW);
   digitalWrite(whitePin, LOW);
   digitalWrite(greenPin,LOW);
  
   }/
  if (input ==2){
    digitalWrite(bluePin,HIGH);
    digitalWrite(whitePin,HIGH);
  }
  /
else {
   digitalWrite(redPin, LOW);
   digitalWrite(yellowPin, LOW);
   digitalWrite(whitePin, LOW);
   }*/
}
void establishContact() {
  while (Serial.available() <= 0) {
    Serial.println(“hello”);   // send a starting message
    delay(300);
  }
}

I’ll still work on this code next week. I probably just need a capacitor or something on the LEDs to smooth out the signals.

I took advantage of the O’Reilly book sales, I picked up a number of books, namely Making things Talk by NYU Professor Tom Igoe, Arduino Cookbook and the Making Arduino Bots and Gadgets. In between coding, I would either finish drilling the LED holes in my template and reading the three books. Insert the Steve Jobs bio by Walter Issacson for a little inspiration.

I even went through learning using the matrix if that would help.

pcompLED

I went through figuring the resistor array that I would have to build and found this great web site to even design the array for you.

 

But that didn’t help. So right before the Stanford-Notre Dame game on Saturday night, I went for the temp sensor. Using the temp sensor was stable and works like a charm. But the weather has been great today so the LED remains at the great weather reading.

In this scenario I’m using a RHT03 Humidity and Temperature Sensor from Sparkfun . The RHT03 is similar to the DHT22 sensor so I installed the library made by github user nethoncho and it releases the temperature in celcius.

More to come.

pcompLED

Final Project for Physical Computing

Thinking of a final project is hard. Like I need ice cream to get through this hard. At first I wanted to make a robot hand being controlled by a glove. than I listed the parts I would need and that posed a significant technical problem in itself.

I wanted the glove and the robot hand separate from each other. So how do I make two arduinos talk to each other? Given the time I had and the current knowledge I have of arduinos that was a pretty big task I have there. Not to mention the type of motor I wanted to use for the robot. It would a be cross between the servo and the stepper motor of at least 6 to control. Note that these just make up the hand and the the arm, the arm is a different story but I think I could get through it by using a solenoid. But after testing the flex sensor (I know I should’ve learned from my stupid pet trick) it’s a pain to configure.

So on to the next challenge. I wanted to make an array of grass/ rice field swaying to the wind. I would use microphones to sense the wind/ noise and they would move accordingly. The mic or at least the one I was using is a pain. I couldn’t get a stable range and according to the internet I shoudl order another type of mic instead.

So now on to the real one. Somewhat similar to my ICM project but in a physical sense. I’ll be illuminating an array of LEDs based on the room/ outside temperature. Inspired by my MUJI Ultrasonic Aroma diffuser and relaxing thing it gives me.

I wanted to make one for the weather. Using a humidity and temperature sensor that I can detach from the unit so I can stick it outside my window if needed will give the outside temp and give me visual display using LEDs. I can’t seem to wrap my head around the entire farenheit scale and keep referring to my celcius range to decide what to wear.

In the event that I run out of time working with the thermmo sensor I’ll import the sensor data through processing and send them to the LED lamp.

While at work I saw the cd spindle case and thought that it would be a perfect enclosure for the lamp. I’ll use a frosting paint inside so I can diffuse the light better.

cd spindle

What are your thoughts about it?

Graffiti in a can/ media controller

Inspired by “Picasso’s Drawing with Light” we wanted to make something similar but instead of taking pictures, we would be using live video.

http://www.life.com/embed/index/gallery/id/24871/size/large/isHd/0

While Picasso used a slow shutter speed and a quick hand with a flashlight to create the images. We used arduino and processing to create our own “graffiti can”.

Initially we wanted to only use an accelerometer to track the movement on the screen but that proved to be very challenging since there was a a lot of computational math involved in converting the acceleration of the sensor to actual X and Y points on the screen.

After consulting ITP Resident Greg Borenstein he suggested that we should just track a light pointed at the camera in processing to create the images instead of the accelerometer. This was a last minute code change which changed our approach completely. But using examples in processing, it shortened the time to buld the code.

graffiti can
Here we are building the code and can at the same time.

graffiti can

Adria testing the serial connection.

graffiti can

Serial input coming in.

graffiti can

Wiring for the red can.

graffiti can

We opted for a smaller breadboard to make things lighter and compact inside.

graffiti can

This might have worked better in another manner, but I mounted the arduino uno and the breadboard back to back on a strip of corrugated cardboard to make things easier to dismantle and attack by just screwing them.

graffiti can

One slight problem, the 9V power connector was sticking out.

graffiti can

But eventually everything fit but cramming it all in.

graffiti can

We used alligator clips to be able to quickly attach and detach the board from the super bright LED if we had to make any changes.

Getting the bluetooth to work was very tricky, because in order for the bluetooth to work, the BT chip must be disconnected while uploading the code for the arduino and attaching it afterwards. The BT will not pair with the computer unless the sketch was running. It took a bit of wrangling but it eventually worked.

We became ambitious and worked on a second can.

graffiti can

We also started using an external USB camera to make the video resolution a bit better. But, like the BT it was a challenge to get these two to work as well.

graffiti can

Adria here with last minute changes to can.

graffiti can

Crunch time! Need to fit everything inside working!

graffiti can

Red vs Blue

Thank you Veronika and Lisa for the documentation photos and videos!

Graffiti Can Members

Adria Navarro-Lopez
Veronika Dubrovskaya
Melissa dela Merced
Joseph McCagherty

Serial Part deux

There’s always something interesting when programming a microcontroller and the instructions don’t exactly tell you when to switch from one program to another. It was quite challenging at first but just read carefully between the lines, it’s all there.


This reminds me of the first word that was on the original Macintosh in 1984.

Serial conenction

Hooked up the arduino to the mac via USB and using Processing to show a visual reference to the connection which I’m manipulating via the potentiometer.

Servo and Tone

I think I’ve just made my own Theremin Machine. Or at least something to annoy the neighbors.

Stupid Pet trick

As part of every student in physical computing is to complete the stupid pet trick and mine is the “belly monitor”.

After some unusual ideas deliberated over in class, I’ve ended up with a belly monitor that monitors your eating limit. Since this varies from person to person, I’ve decided to proceed with a two inch velcro bench to attach the device.

I first thought of using a flex sensor and that didn’t work. The numbers the felx sensor was giving me is just too random for my taste and it kept falling off the female connector even when I taped it together. Soldering is not a good idea since it may melt the sensor.

I ended up using a large force sensor which I have duct taped to the velcro belt procured from Home Depot.

stupidpetrick

Now that the sensor thing has been sorted out I wanted a portable power source. I connected a 9V battery and that wasn’t giving me power or should I say consistent readings as compared to a USB connection

stupidpetrick

So I dropped that idea.

stupidpetrick

I went back to USB power and decided that a sound once you reached your limit would be funny. So I installed a tone beeper thingy or an audio transducer. This now tells you if the device is activated and will slowly increase in tone as you reach the upper limit.

IMG_2803

I decided to use a smaller breadboard since I wanted it to be as small as possible. There’s still space for a battery connection but at the moment this is what I have.

Using the code below, it gave life to my stupid pet trick.

//belly monitor
//Melissa A. dela Merced mdm532@nyu.edu

const int ledPin = 7;
const int redLED=8;
int analogValue=0;
int brightness = 0;
int flex = analogRead(A1);

void setup(){

Serial.begin(9600);
int flex = analogRead(A1);
pinMode(redLED,OUTPUT);

}

void loop(){
flex = analogRead(A1);
analogValue = analogRead(A1);
brightness = analogValue/2;
Serial.println(flex);

flex = map(flex,0, 200, 255, 0); //sensor
flex = min(flex,400);
flex = max(flex,0);

analogWrite (redLED,flex);
int frequency = map(flex, 0,255,100,1000);
tone (5, frequency,10);

}