Showing posts with label alberto semper. Show all posts
Showing posts with label alberto semper. Show all posts

Wednesday, December 7, 2016

Final Project Process 5/5

A proximity sensor turns on when the viewer is close to the box and then the viewer can see clearly what's inside. A mystery black box on a wall which contains my DCF (Florida Department of Children & Families) papers when I was in foster care. I decided to only use the significant ones such as in one in 1999 that my birthmother didn't show up to the visit. One in 2000 that the visit with my brother and birthmother went really well. Lastly, in 2001 when my adoption was finalized.  In my experience as an adoptee, most people don't really know the foster system that well. Most people believe it's an orphanage of some-sort that the government runs which isn't true at all. The papers inside have a semi-gloss to them to represent self-identity and help the blue light bounce around inside the box. The blue light represents National Foster Care Month which is in May. It is symbolized with a blue ribbon. 










const int signalPin= 0; //yellow wire connects to analog pin A0
const int LEDPin= 12; //LED connects to digital pin 13
int signal;//this variable, signal, will hold the analog value read by the arduino

void setup() {
Serial.begin(9600); //sets the baud rate for data transfer in bits/second 
pinMode(signalPin, INPUT); //the infrared sensor signal line will be an input to the arduino
pinMode(LEDPin, OUTPUT); //the LED serves an output in the circuit
}

void loop() {
signal= analogRead(signalPin); //arduino reads the value from the infrared sensor
Serial.println(signal); //prints out analog value
delay(500); //delays the next analog reading by 500 ms or a half a second 

if(signal > 199){ //if the analog value is less than 200, the object is within a few inches
digitalWrite(LEDPin, HIGH);
}
else{
digitalWrite(LEDPin, LOW);
}
}

Saturday, December 3, 2016

Final Project Process 4/5

I was planning to link some led lights together using this tutorial how to wire multiple leds but some in put from my classmates saying one led was binding so I went to find a bigger one.

Found the big blue ones so hoping it will work well with my project on my foster care experience. 









it does. I'm just lucky

with changing the bulb, I will update the circuit digram required for the project.


I paper mached copies of my DCF (Department of Children's and Families) papers inside the box.
I found mirrors to reflect the led light so it can spend around inside the box. I guess you can read the mirrors as self reflection as this project is really about. 







Final Project Process 3/5

I soldered some connecting pins to the proximity sensor so I can plug it into the Arduino. Also I soldered some cables to a led bulb so I can extend the bulb into the box. and went ahead made the Fritzing Diagram of my project's circuit.














Mini Project 2 Process 5/5

Code for Mini Project 2

#include <WaveHC.h>
#include <WaveUtil.h>

SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the volumes root directory
FatReader file;   // This object represent the WAV file
WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time


#define playcomplete(x) ROM_playcomplete(PSTR(x))         // save RAM by using program memory strings

#define servo 7
#define redled 9
#define eyeleds 18
#define mouthleds 17
#define midmouthleds 16
#define outermouthleds 19

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println(F("Wave test!"));

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(redled, OUTPUT);
  pinMode(servo, OUTPUT);
  pinMode(eyeleds, OUTPUT);
  pinMode(outermouthleds, OUTPUT);
  pinMode(midmouthleds, OUTPUT);
  pinMode(mouthleds, OUTPUT);

  randomSeed(analogRead(0));


  if (!card.init()) {
    Serial.println(F("Card init. failed!")); return;
  }
  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);

  // Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++) {   // we have up to 5 slots to look in
    if (vol.init(card, part))
      break;                           // we found one, lets bail
  }
  if (part == 5) {                     // if we ended up not finding one  :(
    Serial.println(F("No valid FAT partition!"));  // Something went wrong, lets print out why
  }

  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  Serial.print(F(", type is FAT"));
  Serial.println(vol.fatType(), DEC);     // FAT16 or FAT32?

  // Try to open the root directory
  if (!root.openRoot(vol)) {
    Serial.println(F("Can't open root dir!"));      // Something went wrong,
  }

  // Whew! We got past the tough parts.
  Serial.println(F("Files found (* = fragmented):"));

  // Print out all of the files in all the directories.
  root.ls(LS_R | LS_FLAG_FRAGMENTED);
}


void pulseServo(uint8_t servopin, uint16_t p) {

 digitalWrite(servopin, HIGH);
 delayMicroseconds(600);
 while (p--) {
   delayMicroseconds(4);
 }
 digitalWrite(servopin, LOW);
  delay(18);
}

uint8_t pumpkinstate = 0;

void loop() {
   int distsensor, i;
   long time;
   /*
   for (i=0; i<50; i++) {
     pulseServo(servo,0);
   }
   for (i=0; i<50; i++) {
     pulseServo(servo,400);
   }
   return;
   */
   distsensor = 0;
   for (i=0; i<8; i++) {
     distsensor += analogRead(0);
     delay(5);
   }
   distsensor /= 8;

   Serial.print(F("Sensor = ")); Serial.println(distsensor);
 
   if (distsensor <= 50) {
     digitalWrite(eyeleds, HIGH);
   }
   if (distsensor > 50) {
     digitalWrite(eyeleds, LOW);
     pumpkinstate = 1;
     // nobody there. one out of 200 times play one of the scary sounds (once every few minutes)
     i = random(5);
     //Serial.println(i);
     if (i == 0) {
       i = random(5);
       if (i == 0) {
           playcomplete("die1.wav");
       } else if (i == 1) {
           playcomplete("");
       } else {
           playcomplete("adult1.wav");
       }
     }
   } else if ((distsensor > 30) && (distsensor < 40)) {
     if (pumpkinstate <= 1) {    // play "hello children"
        playcomplete("life1.wav");
     } else {
       i = random(9);            // more often
       //Serial.println(i);
       if (i == 0) {
         i = random(3);
         if (i == 0) {
           playcomplete("");
         } else if (i == 1) {
           playcomplete("himself1.wav");
         } else {
           playcomplete("");
         }
       }
     }
     pumpkinstate = 2;
   } else if ((distsensor > 10) && (distsensor < 20)) {
     if (pumpkinstate <= 2) {    // play "hello children"
       playcomplete("stare1.wav");
     } else {
       i = random(5);            // more often
       //Serial.println(i);
       if (i == 0) {
         i = random(4);
         if (i == 0) {
           playcomplete("");
         } else if (i == 1) {
           playcomplete("hearty1.wav");
         } else {
           playcomplete("");
         }
       }
     }
     pumpkinstate = 3;
   } else if (distsensor < 5) {
     if (pumpkinstate <= 3) {    // play "hello children"
        playcomplete("meh1.wav");  
     } else {
       i = random(4);            // more often
     //Serial.println(i);
     if (i == 0) {
       i = random(3);
       if (i == 0) {
           playcomplete("last1.wav");
       } else if (i == 1) {
           playcomplete("");
       }
     }
     
   }
    pumpkinstate = 4;
 }
}



void ROM_playcomplete(const char *romname) {
  char name[13], i;
  uint8_t volume;
  int v2;

  for (i=0; i<13; i++) {
    name[i] = pgm_read_byte(&romname[i]);
  }
  name[12] = 0;
  Serial.println(name);
  playfile(name);
  while (wave.isplaying) {
   volume = 0;
   for (i=0; i<8; i++) {
     v2 = analogRead(1) - 512;
     if (v2 < 0)
        v2 *= -1;
     if (v2 > volume)
       volume = v2;
     delay(5);
   }
   if (volume > 200) {
     digitalWrite(outermouthleds, HIGH);
   } else {
     digitalWrite(outermouthleds, LOW);
   }
   if (volume > 150) {
     digitalWrite(midmouthleds, HIGH);
   } else {
     digitalWrite(midmouthleds, LOW);
   }
   if (volume > 100) {
     digitalWrite(mouthleds, HIGH);
   } else {
     digitalWrite(mouthleds, LOW);
   }
   //Serial.print(F("vol = ")); Serial.println(volume, DEC);
  }
  file.close();
}

void playfile(char *name) {

   if (!file.open(root, name)) {
      Serial.println(F(" Couldn't open file")); return;
   }
   if (!wave.create(file)) {
     Serial.println(F(" Not a valid WAV")); return;
   }
   // ok time to play!
   wave.play();
}

Final Project Process 2/5

After Thanksgiving break, that Monday , I used the spray booth to finish the wooden box. It took two cans of spray paint to cover the box but it was worth it. Took a few hours to dry completely. 

Project idea: Since most of my work is about my adoption or at least some aspects of it. Why not continue the same route. My work this semester has been mainly on my crazy birthparents and I really want to stay away from that with this project. I'm thinking about doing something on the foster care system. I know people know of it but really don't have much exposure to it. maybe do an educational piece about it and how my experience was?












Final Project Process 1/5

To be honest, I'm not sure what to do for the final project but I do like working with the proximity sensor that i used for my mini project two. I also like playing around with the small led lights we have so possibly incorporate those into the project.

I need case so I asked Dad for help since his good at handyman kind of jobs and I'm not. I told my father the dimensions I wanted and how the box should look like. He fixed my dimensions since I off a little bit so I used his plans that he drew out. Helped him cut the wood and assemble everything together all under a few hours.









Tuesday, November 15, 2016

Mini Project 2 Process 4/5





#include <ArduinoPins.h>
#include <FatReader.h>
#include <FatStructs.h>
#include <mcpDac.h>
#include <SdInfo.h>
#include <SdReader.h>
#include <WaveHC.h>
#include <Wavemainpage.h>
#include <WavePinDefs.h>
#include <WaveUtil.h>

#include <WaveHC.h>
#include <WaveUtil.h>

SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the volumes root directory
FatReader file;   // This object represent the WAV file
WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time


#define playcomplete(x) ROM_playcomplete(PSTR(x))         // save RAM by using program memory strings

#define servo 7
#define redled 9
#define eyeleds 18
#define mouthleds 17
#define midmouthleds 16
#define outermouthleds 19

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println(F("Wave test!"));

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(redled, OUTPUT);
  pinMode(servo, OUTPUT);
  pinMode(eyeleds, OUTPUT);
  pinMode(outermouthleds, OUTPUT);
  pinMode(midmouthleds, OUTPUT);
  pinMode(mouthleds, OUTPUT);

  randomSeed(analogRead(0));


  if (!card.init()) {
    Serial.println(F("Card init. failed!")); return;
  }
  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);

  // Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++) {   // we have up to 5 slots to look in
    if (vol.init(card, part))
      break;                           // we found one, lets bail
  }
  if (part == 5) {                     // if we ended up not finding one  :(
    Serial.println(F("No valid FAT partition!"));  // Something went wrong, lets print out why
  }

  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  Serial.print(F(", type is FAT"));
  Serial.println(vol.fatType(), DEC);     // FAT16 or FAT32?

  // Try to open the root directory
  if (!root.openRoot(vol)) {
    Serial.println(F("Can't open root dir!"));      // Something went wrong,
  }

  // Whew! We got past the tough parts.
  Serial.println(F("Files found (* = fragmented):"));

  // Print out all of the files in all the directories.
  root.ls(LS_R | LS_FLAG_FRAGMENTED);
}


void pulseServo(uint8_t servopin, uint16_t p) {

 digitalWrite(servopin, HIGH);
 delayMicroseconds(600);
 while (p--) {
   delayMicroseconds(4);
 }
 digitalWrite(servopin, LOW);
  delay(18);
}

uint8_t pumpkinstate = 0;

void loop() {
   int distsensor, i;
   long time;
   /*
   for (i=0; i<50; i++) {
     pulseServo(servo,0);
   }
   for (i=0; i<50; i++) {
     pulseServo(servo,400);
   }
   return;
   */
   distsensor = 0;
   for (i=0; i<8; i++) {
     distsensor += analogRead(0);
     delay(0.01);
   }
   distsensor /= 8;

   Serial.print(F("Sensor = ")); Serial.println(distsensor);
 
   if (distsensor <= 500) {
     digitalWrite(eyeleds, HIGH);
   }
   if (distsensor > 500) {
     digitalWrite(eyeleds, LOW);
     pumpkinstate = 1;
     // nobody there. one out of 200 times play one of the scary sounds (once every few minutes)
     i = random(20);
     //Serial.println(i);
     if (i == 0) {
       i = random(3);
       if (i == 0) {
           playcomplete("meh1.wav");
       } else if (i == 1) {
           playcomplete("die1.wav");
       } else {
           playcomplete("adult1.wav");
       }
     }
   } else if ((distsensor > 300) && (distsensor < 400)) {
     if (pumpkinstate <= 1) {    // play "hello children"
        playcomplete("meh1.wav");
     } else {
       i = random(60);            // more often
       //Serial.println(i);
       if (i == 0) {
         i = random(3);
         if (i == 0) {
           playcomplete("meh1.wav");
         } else if (i == 1) {
           playcomplete("himself1.wav");
         } else {
           playcomplete("last1.wav");
         }
       }
     }
     pumpkinstate = 2;
   } else if ((distsensor > 100) && (distsensor < 200)) {
     if (pumpkinstate <= 2) {    // play "hello children"
       playcomplete("die1.wav");
     } else {
       i = random(50);            // more often
       //Serial.println(i);
       if (i == 0) {
         i = random(3);
         if (i == 0) {
           playcomplete("adult1.wav");
         } else if (i == 1) {
           playcomplete("hearty1.wav");
         } else {
           playcomplete("stare1.wav");
         }
       }
     }
     pumpkinstate = 3;
   } else if (distsensor < 50) {
     if (pumpkinstate <= 30) {    // play "hello children"
        playcomplete("stare1.wav");  
     } else {
       i = random(3);            // more often
     //Serial.println(i);
     if (i == 0) {
       i = random(2);
       if (i == 0) {
           playcomplete("meh1.wav");
       } else if (i == 1) {
           playcomplete("adult1.wav");
       }
     }
     
   }
    pumpkinstate = 4;
 }
}



void ROM_playcomplete(const char *romname) {
  char name[13], i;
  uint8_t volume;
  int v2;

  for (i=0; i<13; i++) {
    name[i] = pgm_read_byte(&romname[i]);
  }
  name[12] = 0;
  Serial.println(name);
  playfile(name);
  while (wave.isplaying) {
   volume = 0;
   for (i=0; i<8; i++) {
     v2 = analogRead(1) - 512;
     if (v2 < 0)
        v2 *= -1;
     if (v2 > volume)
       volume = v2;
     delay(5);
   }
   if (volume > 200) {
     digitalWrite(outermouthleds, HIGH);
   } else {
     digitalWrite(outermouthleds, LOW);
   }
   if (volume > 150) {
     digitalWrite(midmouthleds, HIGH);
   } else {
     digitalWrite(midmouthleds, LOW);
   }
   if (volume > 100) {
     digitalWrite(mouthleds, HIGH);
   } else {
     digitalWrite(mouthleds, LOW);
   }
   //Serial.print(F("vol = ")); Serial.println(volume, DEC);
  }
  file.close();
}

void playfile(char *name) {

   if (!file.open(root, name)) {
      Serial.println(F(" Couldn't open file")); return;
   }
   if (!wave.create(file)) {
     Serial.println(F(" Not a valid WAV")); return;
   }
   // ok time to play!
   wave.play();
}


Everything works so far. crossing my fingers..

Saturday, November 12, 2016

Mini Project 2 Process 3/5

Let's see if this 5th attempt is the one that works.


Still need to find a speaker for the project.

I have decided to have the mirror say bizarre things because I think it is excepted to have  a magic mirror say nice things or rude things.

Since I really can't come up with any good ones. I took inspiration from fortune cookies.

the-40-best-fortune-cookie-sayings-that-will-leave-you-bemused-befuddled-or-beguiled



Mini Project 2 Process 2/5

Since the main component of this project is about movement why not let the movement involve the viewer. I'm keep thinking about a magic mirror for some odd reason.  Have the mirror tell you you're fabulous or have it say bizarre things...
stole my brother's mirror for the project..

soldered the sonar sensor


Mini Project 2 Process 1/5

Movement....

I know I want to use an infrared or sonar sensor for this project because I will use one or the other for the final project. Possible thinking about using the wave shield since I spent so much time building one that works...

Monday, October 10, 2016

Mini Project 1 Process 4/5 10.6.16

I found the music that I was looking for after a few hours. Took out the intro and went straight to where the walking around music begins.


#define NOTE_B0  31
#define NOTE_C1  33#define NOTE_CS1 35#define NOTE_D1  37#define NOTE_DS1 39#define NOTE_E1  41#define NOTE_F1  44#define NOTE_FS1 46#define NOTE_G1  49#define NOTE_GS1 52#define NOTE_A1  55#define NOTE_AS1 58#define NOTE_B1  62#define NOTE_C2  65#define NOTE_CS2 69#define NOTE_D2  73#define NOTE_DS2 78#define NOTE_E2  82#define NOTE_F2  87#define NOTE_FS2 93#define NOTE_G2  98#define NOTE_GS2 104#define NOTE_A2  110#define NOTE_AS2 117#define NOTE_B2  123#define NOTE_C3  131#define NOTE_CS3 139#define NOTE_D3  147#define NOTE_DS3 156#define NOTE_E3  165#define NOTE_F3  175#define NOTE_FS3 185#define NOTE_G3  196#define NOTE_GS3 208#define NOTE_A3  220#define NOTE_AS3 233#define NOTE_B3  247#define NOTE_C4  262#define NOTE_CS4 277#define NOTE_D4  294#define NOTE_DS4 311#define NOTE_E4  330#define NOTE_F4  349#define NOTE_FS4 370#define NOTE_G4  392#define NOTE_GS4 415#define NOTE_A4  440#define NOTE_AS4 466#define NOTE_B4  494#define NOTE_C5  523#define NOTE_CS5 554#define NOTE_D5  587#define NOTE_DS5 622#define NOTE_E5  659#define NOTE_F5  698#define NOTE_FS5 740#define NOTE_G5  784#define NOTE_GS5 831#define NOTE_A5  880#define NOTE_AS5 932#define NOTE_B5  988#define NOTE_C6  1047#define NOTE_CS6 1109#define NOTE_D6  1175#define NOTE_DS6 1245#define NOTE_E6  1319#define NOTE_F6  1397#define NOTE_FS6 1480#define NOTE_G6  1568#define NOTE_GS6 1661#define NOTE_A6  1760#define NOTE_AS6 1865#define NOTE_B6  1976#define NOTE_C7  2093#define NOTE_CS7 2217#define NOTE_D7  2349#define NOTE_DS7 2489#define NOTE_E7  2637#define NOTE_F7  2794#define NOTE_FS7 2960#define NOTE_G7  3136#define NOTE_GS7 3322#define NOTE_A7  3520#define NOTE_AS7 3729#define NOTE_B7  3951#define NOTE_C8  4186#define NOTE_CS8 4435#define NOTE_D8  4699#define NOTE_DS8 4978#define NOTE_SIL 0#define COR 140#define NEG 400#define BLA 350#define TBLA 1050#define SJUAV 420#define FEM 700#define COX 280
int piezo = 9;int boton = 7;void setup() {                  pinMode(piezo, OUTPUT);  pinMode(boton, INPUT);  digitalWrite (piezo, LOW);  }  void loop(){              pokemonIntro();        while(1) {    mainTheme();    } }  void mainTheme() {    int longit, ii;  int musica[] = {    NOTE_G5, FEM, NOTE_B5, COX, NOTE_D6, TBLA, NOTE_F4, FEM,   NOTE_SIL, COR, NOTE_F5, COX, NOTE_F6, FEM,  NOTE_F6, COR, NOTE_E6, COR, NOTE_DS6, COR, NOTE_D6, FEM, NOTE_SIL, COX,  NOTE_F5, FEM, NOTE_F5, COR, NOTE_E5, COR, NOTE_DS5, COR, NOTE_D5, FEM,  NOTE_SIL, COR, NOTE_C5, BLA, NOTE_B4, BLA, NOTE_C5, BLA  };               longit = sizeof(musica)/sizeof(int);  for (ii=0; ii< longit ; ii = ii+2 ) {    tone(piezo,musica[ii],musica[ii+1]);     delay(musica[ii+1]);    noTone(piezo);  }   }   void pokemonIntro() { int longit, ii;   int music[] = {NOTE_G4, COR, NOTE_B4, COR, NOTE_D5, COR, NOTE_FS5, COR, NOTE_G5, COR,    NOTE_SIL,SJUAV, NOTE_G5, COR, NOTE_SIL, FEM, NOTE_G5, COR, NOTE_G5, COR, NOTE_G5, COR, NOTE_SIL, BLA, NOTE_G5, COR, NOTE_SIL, BLA, NOTE_G5, COR,    NOTE_SIL,BLA, NOTE_F5, COR, NOTE_F5, COR, NOTE_F5, COR, NOTE_F5, COR, NOTE_F5, COR, NOTE_FS5, COR   };      longit = sizeof(music)/sizeof(int);      for(ii=0; ii< longit ; ii = ii +2) {   tone(piezo, music[ii], music[ii+1]);   delay(music[ii+1]);   noTone(piezo);   }  }



   Found my childhood fanny pack that I use to where all the time so I'm using that as my casing..

will update later with photos..






Thursday, October 6, 2016

Mini Project 1 Process 3/5 10.6.16

I found a speaker in the studio that works better than the piezo speaker so I'm using it. I accidentally dropped it then the wire came loose so I soldering it back together.

Instead of the Gameboy startup beep, I decided to use the Pokemon walking around music since the music is longer and nostalgia reasons. I just need to find a casing for it now.

Tuesday, October 4, 2016

Mini Project Process 2/5 10.4.2016

So I thought changing the numbers around would make  Gameboy sound but that didn't work so I decided to see what actually made the sound so I opened up a Gameboy.

The base code for an alarm:

float sinVal;
int toneVal;
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
for (int x=0; x<180; x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));

// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
delay(2);
}
}

I opened the Gameboy up which I never have done before. Didn't realize I have played with sensors most of my life looking at the components of it. Found the speaker but still can't find what component makes the noise. I conclude that it's programmed into cpu itself. So I'm changing the sound to something else but sticking to the concept of nostalgia. 

Semester Proposal - Alberto Semper

https://prezi.com/2o13mm2rmty_/semester-project/

Sensor Presentation - Alberto Semper

https://prezi.com/rvefcsdi8esz/sensor-explanation/

Monday, October 3, 2016

Mini Project Process 1/5 10.3.2016

For the first mini project and the assignment being about "Signal", I thought of the first piezo alarm project. I first thought of sound when told the assignment was about signal. The gameboy startup sound brings nostalgia to me when I hear the sound. I use to play my gameboy as a child for hours and use to have the sound stuck in my head all the time. I'm not sure hiow I can achieve the sound without using the gameboy itself.

Project 28 in class assignment

Project 28