FINAL PROJECT UPDATE

OUR FINAL PROJECT HAS RUN INTO A LOT OF PROBLEMS.  FIRST OFF WE COULD NOT FIGURE OUT HOW TO GET ONE LED TO LIGHT UP AT A TIME. THAT WAS A MAJOR ISSUE, BECAUSE WE WERE USING THE DIMMING IN OUR CODE, WE HAD MORE THEN ONE LED STAY ON AT ONE TIME. SO WE … Continue reading FINAL PROJECT UPDATE

OUR FINAL PROJECT HAS RUN INTO A LOT OF PROBLEMS.  FIRST OFF WE COULD NOT FIGURE OUT HOW TO GET ONE LED TO LIGHT UP AT A TIME. THAT WAS A MAJOR ISSUE, BECAUSE WE WERE USING THE DIMMING IN OUR CODE, WE HAD MORE THEN ONE LED STAY ON AT ONE TIME.

SO WE DECIDED TO TAKE THE DIMMING SECTION OUT OF OUR CODE.

float RGB[3];
int ldrPin = 0;     // LDR in Analog Input 0 to read the ambient light
int ambientLight;   // variable to store the value of the ambient light
int redLed   = 11;  // red LED in Digital Pin 11 (PWM)
int greenLed = 10;  // green LED in Digital Pin 10 (PWM)
int blueLed  = 9;   // blue LED in Digital Pin 9 (PWM)

void setup(){
  pinMode(redLed,OUTPUT);  // tell arduino it’s an output
  pinMode(greenLed,OUTPUT);// tell arduino it’s an output
  pinMode(blueLed,OUTPUT); // tell arduino it’s an output
 
  // set all the outputs to low
  digitalWrite(redLed,LOW);
  digitalWrite(greenLed,LOW);
  digitalWrite(blueLed,LOW);
}

void loop(){
  for (float x=0;x<PI;x=x+0.00001){
    RGB[0]=255*abs(sin(x*(180/PI)));           // calculate the brightness for the red led
    RGB[1]=255*abs(sin((x+PI/3)*(180/PI)));    // calculate the brightness for the green led
    RGB[2]=255*abs(sin((x+(2*PI)/3)*(180/PI)));// calculate the brightness for the blue led
    ambientLight=analogRead(ldrPin); // read an store the ambient light
    if(ambientLight>600){ // start only if the ambient light is very low
      //  write the brightness on the leds
      analogWrite(redLed,RGB[0]);
      analogWrite(greenLed,RGB[1]);
      analogWrite(blueLed,RGB[2]);
    }
    else{
      digitalWrite(redLed,LOW);
      digitalWrite(greenLed,LOW);
      digitalWrite(blueLed,LOW);
    }
    for(int i=0;i<3;i++){
      if(RGB[i]<1){
        delay(100);
      }
      if(RGB[i]<5){
        delay(50);
      }
      if(RGB[i]<10){
        delay(10);
      }
      if(RGB[i]<100){
        delay(5);
      }
    }
    delay(1);
  }

}AND WE TOOK OUT THE END PARTS OF THE CODE.

THE LEDS ARE ON PINS 9, 10, 11

20150430_143643 20150430_143726

The delay we put in was 25,000 milli seconds…which equals 25 seconds.

The void loop is the part of the code we added, and altered…

we changed the analogwrite to digital write….

20150430_143859

20150430_153031

20150430_153036 20150430_153046

BILLS OF MATERIALS

3 LEDS GREEN RED AND BLUE

9 VOLT BATTERY

9 VOLT BATTERY HOLDER

BREADBOARD

ANDUINO MICROCONTROLLER

220 ohm resistor.

ALSO LEARNED THAT THE OHM IS THE SMALLEST,  THEN IT’S KILLO, THEN IT’S MEGA. …… IT’S IMPORTANT TO KNOW THE DIFFERENT RESISTORS.

THE LINK TO CHECK FOR WHAT KIND OF RESISTOR IS

http://www.dannyg.com/examples/res2/resistor.htm

For this project we really had to study forward voltage , anday the current of electricity so that our LED would not burn out.

THE ELECTRICITY GOES THROUGH THE  RESISTOR BEFORE GOING TO THE LEDS……THIS PREVENTS THE LED FROM BURNING OUT. IT CONTROLS THE BRIGHTNESS OF THE LED ALSO.

down below is some videos of me and calye practicing our game

UPDATE ON THE JC NIGHT LIGHT SINGING GAME

HEY EVERYONE,  SO THE FINAL BUILD OF OUR FINAL PROJECT IS COMING ALONG GREAT! I STARTED TO THINK OF OUR FINAL PROJECT AS SOMETHING BEING ENTERED INTO A SCIENCE FAIR. MEANING OUR PROJECT HAS TO STAND ALONE, SO WE MUST HAVE A WAY OF EXPLAINING WHAT OUR PROJECT IS, AND THE RULES TO FOLLOW. SO … Continue reading UPDATE ON THE JC NIGHT LIGHT SINGING GAME

HEY EVERYONE,  SO THE FINAL BUILD OF OUR FINAL PROJECT IS COMING ALONG GREAT!

I STARTED TO THINK OF OUR FINAL PROJECT AS SOMETHING BEING ENTERED INTO A SCIENCE FAIR. MEANING OUR PROJECT HAS TO STAND ALONE, SO WE MUST HAVE A WAY OF EXPLAINING WHAT OUR PROJECT IS, AND THE RULES TO FOLLOW.

SO I TOOK A CARDBOARD COVER, AND CALYE AND MYSELF COVERED IT WITH COLORFUL PAPER, INSIDE, AND OUT.

20150419_131311 20150419_131318

ON THE INSIDE IS WHERE I WROTE THE RULES, AND OBJECTIVE OF OUR SINGING GAME.

I ALSO CREATED A LOGO FOR OUR GAME, AND TAPED THE TITLE OF OUR GAME ONTO THE EDGE OF THE CARDBOARD

20150419_145338 20150419_145338 20150419_145351 20150419_154214

 

So when it came down to the globes I ordered….they never came in the mail as of yet….so we had to have a backup plan. I took a clear container, that was large enough so that the arduino and the breadboard can fit side by side.

Then we also decided that the breadboard and arduino should be tilted to the side, so that the LEDs are facing sideways to shine out, instead of facing upwards to shine up.

Then decided ok…well what is the arduino going to stand on….wwe can’t just have an empty container. So I came up with the idea of using Cotton balls as almost a stand.

The cool think about cotton balls, is that their very easy to adjust in regards to height,  and width. You can smash it down, of fluff it up, stretch it.

Then decided to get a bunch of packs of clear beads…..were going to cover the arduino and breadboard with the beads…..because their clear the LEDs will be able to shine through them .

So the cotton balls are the stand, and th beads are the fillers that’s covering the arduino and breadboard.

Here are some pictures below.

20150419_124715 20150419_124800

So let’s go back to the objective of the game…. To start the game, each player must randomly select  a paper from the JC green bowl.

Each paper…has a color and a artist on it.

20150419_124816 20150419_124851

So in the code, we discovered that the ambient light variable is a main focus of the code. So I decided to look up what AMBIENT LIGHTNING means-  Available light in an environment

The LED lights are suppose to automatically come on when the environment is dark. So the Ambient light is whats going to affect that, right now as you see highlighted in the code below. The ambient is set at 600 so me and my partner Calye is going to adjust it, to see the difference that it makes.  But so far we tried the code and it wentry through without error.

Now we just have to figure out the ambient light number we want to use, and adjust the delay to 25 seconds.

15 seconds for each person to sing , and 10 seconds for people to guess the artist and song.

void loop(){
  for (float x=0;x<PI;x=x+0.00001){
    RGB[0]=255*abs(sin(x*(180/PI)));           // calculate the brightness for the red led
    RGB[1]=255*abs(sin((x+PI/3)*(180/PI)));    // calculate the brightness for the green led
    RGB[2]=255*abs(sin((x+(2*PI)/3)*(180/PI)));// calculate the brightness for the blue led
    ambientLight=analogRead(ldrPin); // read an store the ambient light
    if(ambientLight>600){ // start only if the ambient light is very low
      //  write the brightness on the leds
      analogWrite(redLed,RGB[0]);
      analogWrite(greenLed,RGB[1]);
      analogWrite(blueLed,RGB[2]);
    }

JC NIGHT LIGHT SINGING GAME….FINAL PROJECT UPDATE.

OK so our original idea to use the acrylic cover won’t work, because it came in the mail, and it’s entirely too small. Never fear….. A new one has been ordered. http://m.instructables.com/id/Mood-Lamp-with-Arduino/?ALLSTEPS BILLS OF MATERIALS FINALIZED 9 volt battery Arduino board breadboard 1 Red Led, 1 Blue Led, 1 green Led 1 LDR ( light … Continue reading JC NIGHT LIGHT SINGING GAME….FINAL PROJECT UPDATE.

OK so our original idea to use the acrylic cover won’t work, because it came in the mail, and it’s entirely too small. Never fear….. A new one has been ordered.

http://m.instructables.com/id/Mood-Lamp-with-Arduino/?ALLSTEPS

BILLS OF MATERIALS FINALIZED

  • 9 volt battery
  • Arduino board
  • breadboard
  • 1 Red Led, 1 Blue Led, 1 green Led
  • 1 LDR ( light dependent resistor )
  • Jumper wires
  • 120k resistor
  • snow globe or mood lamp cover ( house the project )

FZQ5LN2H4AGKY1Y.MEDIUM

20150417_153451

above is a picture of what came in the mail..entirely to small…it fit in the palm of my hand. Theirs no way an arduino can fit in side

So one of the issues me and my partner was trying to figure out was how do we combine all of the codes.

we want our project to come on automatically when it is dark, and light up every 20 seconds with a different LED light.  (Red, Blue, Green) ……..

So we finally found a code that can do all of what we need. But we will have to adjust the delay, and a few other things.

// The brightness of the leds follows these equations:
// Red = sin(x)
// Green = sin(x + PI/3)
// Blue = sin(x + 2PI/3)
// for x from 0 to PI
// —————————————————

float RGB[3];
int ldrPin = 0;     // LDR in Analog Input 0 to read the ambient light
int ambientLight;   // variable to store the value of the ambient light
int redLed   = 11;  // red LED in Digital Pin 11 (PWM)
int greenLed = 10;  // green LED in Digital Pin 10 (PWM)
int blueLed  = 9;   // blue LED in Digital Pin 9 (PWM)

void setup(){
  pinMode(redLed,OUTPUT);  // tell arduino it’s an output
  pinMode(greenLed,OUTPUT);// tell arduino it’s an output
  pinMode(blueLed,OUTPUT); // tell arduino it’s an output
 
  // set all the outputs to low
  digitalWrite(redLed,LOW);
  digitalWrite(greenLed,LOW);
  digitalWrite(blueLed,LOW);
}

void loop(){
  for (float x=0;x<PI;x=x+0.00001){
    RGB[0]=255*abs(sin(x*(180/PI)));    // calculate the brightness for the red led
    RGB[1]=255*abs(sin((x+PI/3)*(180/PI)));    // calculate the brightness for the green led
    RGB[2]=255*abs(sin((x+(2*PI)/3)*(180/PI)));// calculate the brightness for the blue led
    ambientLight=analogRead(ldrPin); // read an store the ambient light
    if(ambientLight>600){ // start only if the ambient light is very low
      //  write the brightness on the leds
      analogWrite(redLed,RGB[0]);
      analogWrite(greenLed,RGB[1]);
      analogWrite(blueLed,RGB[2]);
    }
    else{
      digitalWrite(redLed,LOW);
      digitalWrite(greenLed,LOW);
      digitalWrite(blueLed,LOW);
    }
    for(int i=0;i<3;i++){
      if(RGB[i]<1){
        delay(100);
      }
      if(RGB[i]<5){
        delay(50);
      }
      if(RGB[i]<10){
        delay(10);
      }
      if(RGB[i]<100){
        delay(5);
      }
    }
    delay(1);
  }
}

The Set up looks like this

FZXY3X8H4I7W07T.MEDIUM

 

FZAXUHTH4AGE6VD.LARGE

 

That’s a simple sheet of paper over the lights

 

 

FWC7OMLH4AGE773.MEDIUM FEKVRMIH4AGM5I3.MEDIUM FZ10A4WH4AG0A5G.MEDIUM

 

Below is a picture of the new item that was ordered to house our night lamp.

Matney Ocean Wave Light Projector

so our arduino and breadboard will go inside here……

319iNCLt+vL

For back up I’m also ordering this, to house our arduino

31f-3-qUZhL

Below is a video demonstrating our project,  the only difference is we want our housing to be in a globe form, something easy to transport,  so we can use for our singing game.

 

 

JC night light singing game….

requires 3-4 people

only 3 people can play at once, the 4th person can be used as score keeper.

strip of paper are placed in a bowl Folded up. Each paper has a color & artist written on it.

Each person has a different artist and color. What ever color is stated on their paper, belongs to them ( that’s how they know it will be their turn)

Whatever artist is on the paper,  they have to randomly choose a song , that is sung by that artist and sing it.

They have 15 seconds to sing, and everyone has 5 seconds to guess the artist and song title.

If no one guess the correct answer the person singing gets 10 points.  If someone guess the right answer then that person gets the 10 points.

that’s why the delay of the color to change is 20 seconds. 15 seconds to sing, and 5 seconds to guess the answer.

So at this point….oon Tuesday the actual build will be put together. We already have made the corrections to the code.

 

FINAL PROJECT

Arduino Night Light This project creates an automated night light. The lights will turn on automatically when the room is dark, and off when the room is light. Components Needed: 1x Arduino 1x Breadboard 3x 220 Ohm Resistors 1x 10K Ohm Resistor 3x LED’s Wires Components can be found at http://egrobotics.com/store/ This Project uses and … Continue reading FINAL PROJECT

Arduino Night Light
This project creates an automated night light. The lights will turn on automatically when the
room is dark, and off when the room is light.

Components Needed:

1x Arduino
1x Breadboard
3x 220 Ohm Resistors
1x 10K Ohm Resistor
3x LED’s
Wires

Components can be found at http://egrobotics.com/store/
This Project uses and Arduino Board and LDR Add-on Kit

www.EGRobotics.com

Code:

void setup() {
Serial.begin(9600);
pinMode(3, OUTPUT);
}
void loop() {
int sensorValue = analogRead(A0);
if (sensorValue < 200) { // To change the point at which the light turns on change this value.
digitalWrite(3, HIGH);
}
else {
digitalWrite(3,LOW);
}
}FNY33E8H7430JFA.MEDIUM

night light pt 2 night light

Arduino Capacitive Sensor

Professor Dawn asked us to create a circuit, using foil or some kind of resistant materials. Also it was key to use the Capacitive Sensor code. The Arduino library didn’t have the Capacitive code in its library,  so it needed to be downloaded,  using the links from the Arduino website,  I posted it below. http://arduino.cc/en/Guide/Libraries … Continue reading Arduino Capacitive Sensor

Professor Dawn asked us to create a circuit, using foil or some kind of resistant materials. Also it was key to use the Capacitive Sensor code.

The Arduino library didn’t have the Capacitive code in its library,  so it needed to be downloaded,  using the links from the Arduino website,  I posted it below.

http://arduino.cc/en/Guide/Libraries

I had to learn how to import zip library.

ImportLibraryFromZIPFile

 

After making sure the Arduino has the Capacitive sensor added in the library. I searched different circuits I can try and create on my own. So I challenged myself to do :

A Pencil drawing into a capacitive sensor for Arduino

My bill of materials were really simple.

  • Arduino uno
  • breadboard
  • paperclip (must be bare, not coated in plastic )
  • A pencil
  • A paper
  • 3 Wires
  • scotch tape (optional )
  • 1 megaohm resistor
  • 1 led light

The circuit is suppose to work by attaching a wire to a paperclip,  attaching the paperclip to the paper, and wherever you write on the paper it’s suppose to react to your touch and the Led should light up. Whatever you write you must make sure that all the words are in a straight line and connected.  You can see what I drew below.

20150401_155453

 

20150401_152624

 

As you notice it goes in a straight line, from where the paper clip is attached to where the pencil drawing begins.

So what I’ve learned from pencils is that  Pencil lead is actually graphite, a form of carbon.

Graphite can conduct electricity due to the vast electron delocalization within the carbon layers. ( a phenomenon called aromaticity). These valence electrons are free to move, so are able to conduct electricity. However,  the electricity is only conducted within the plane of the layers.

So now we’ve learned why the pencil can be used. The next step was coding.

For this you can check out the two videos I made. I had to install the zip import into the library,  which simply means we added Arduino into the library, I ran into trouble because I had downloaded the capacitive sensor, but it wasn’t actually in the library.  So what happened was the code was verifying,  but it would not upload.  So when I went back and checked to see if I saw capacitive sensor in the library,  I went back and corrected it.

So this is the original code I was tackling with

// Pin for the LED
int LEDPin = 13;
// Pin to connect to your drawing
int capSensePin = 2;
// This is how high the sensor needs to read in order
//  to trigger a touch.  You'll find this number
//  by trial and error, or you could take readings at 
//  the start of the program to dynamically calculate this.
int touchedCutoff = 60;

void setup(){
  Serial.begin(9600);
  // Set up the LED
  pinMode(LEDPin, OUTPUT);
  digitalWrite(LEDPin, LOW);
}

void loop(){
  // If the capacitive sensor reads above a certain threshold,
  //  turn on the LED
  if (readCapacitivePin(capSensePin) > touchedCutoff) {
    digitalWrite(LEDPin, HIGH);
  }
  else {
    digitalWrite(LEDPin, LOW);
  }
  
  // Every 500 ms, print the value of the capacitive sensor
  if ( (millis() % 500) == 0){
    Serial.print("Capacitive Sensor on Pin 2 reads: ");
    Serial.println(readCapacitivePin(capSensePin));
  }
}

// readCapacitivePin
//  Input: Arduino pin number
//  Output: A number, from 0 to 17 expressing
//          how much capacitance is on the pin
//  When you touch the pin, or whatever you have
//  attached to it, the number will get higher
//  In order for this to work now,
// The pin should have a 1+Megaohm resistor pulling
//  it up to +5v.
uint8_t readCapacitivePin(int pinToMeasure){
  // This is how you declare a variable which
  //  will hold the PORT, PIN, and DDR registers
  //  on an AVR
  volatile uint8_t* port;
  volatile uint8_t* ddr;
  volatile uint8_t* pin;
  // Here we translate the input pin number from
  //  Arduino pin number to the AVR PORT, PIN, DDR,
  //  and which bit of those registers we care about.
  byte bitmask;
  if ((pinToMeasure >= 0) && (pinToMeasure <= 7)){
    port = &PORTD;
    ddr = &DDRD;
    bitmask = 1 << pinToMeasure;
    pin = &PIND;
  }
  if ((pinToMeasure > 7) && (pinToMeasure <= 13)){
    port = &PORTB;
    ddr = &DDRB;
    bitmask = 1 << (pinToMeasure - 8);
    pin = &PINB;
  }
  if ((pinToMeasure > 13) && (pinToMeasure <= 19)){
    port = &PORTC;
    ddr = &DDRC;
    bitmask = 1 << (pinToMeasure - 13);
    pin = &PINC;
  }
  // Discharge the pin first by setting it low and output
  *port &= ~(bitmask);
  *ddr  |= bitmask;
  delay(1);
  // Make the pin an input WITHOUT the internal pull-up on
  *ddr &= ~(bitmask);
  // Now see how long the pin to get pulled up
  int cycles = 16000;
  for(int i = 0; i < cycles; i++){
    if (*pin & bitmask){
      cycles = i;
      break;
    }
  }
  // Discharge the pin again by setting it low and output
  //  It's important to leave the pins low if you want to 
  //  be able to touch more than 1 sensor at a time - if
  //  the sensor is left pulled high, when you touch
  //  two sensors, your body will transfer the charge between
  //  sensors.
  *port &= ~(bitmask);
  *ddr  |= bitmask;
  
  return cycles;
}

Here is a diagram of the actual  circuit built 
FMF6PSVH2MYDFQV.MEDIUM

Here are some more pictures of my circuit 
20150401_152616

20150401_151140

After my code was uploaded,  I still couldn't get it to work. I checked to make sure the Led was working,  

20150401_152906

As you see my LED was working. 

I think their some theory is the way the wires are set up. 

One wire is in 5v that's your power, the 2nd wire is in pin 2, instead of going in the ground pin, this is how the wires are set up according to the code. So I will do more trouble shooting.  But the code is correct and went through,  that's half the battle I believe.  

Below is a video of how the circuit is suppose to work I hope you enjoy.