FINAL PROJECT: Phase 3

For Phase 3 I made a 3D modeling the vessel to hold the light. It will be a 2 tier structure in the general shape of a ladybug. I will use the photoresistors as the antennae of the bug so they can be visible yet remain unaffected by the glow of the LED. The LED will be underneath a shield shaped like a ladybug, with holes like a ladybug's spots for the light to shine through.  I will complete this AND will work on building the capacitance switch during this week. Printing the ladybug and assembling will be the final step in completing the project, which will be stage 4. Here is a rough sketch:


3D Model:


In terms of hardware, I've created the capacitance switch and linked it to the "buzzing" sound to imitate a sort of "purr". Here is a video of it in action:


And here is the code: (It may change by next week but this is mostly finalized)


#include <MedianFilter.h>
#include <CapacitiveSensor.h>

MedianFilter test(20,0);

CapacitiveSensor capSensor = CapacitiveSensor(4,2);

int threshold = 50;
bool pass = false;

int ledPin = 13;
int photocellInput = 0;
int soundPin = 9; 

void setup()  {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(soundPin, OUTPUT);
}
 
 
void loop()  {
photocellInput = map(analogRead(0),0,1023,0,254); 
     if(photocellInput < 30){
      digitalWrite(ledPin, HIGH);
      }
      else {
      digitalWrite(ledPin, LOW);
      }

      
 long sensorValue = 
  capSensor.capacitiveSensor(30);
  test.in(sensorValue);
  sensorValue = test.out();

Serial.println(sensorValue);

if (sensorValue > threshold)
  {
    if( pass == false) {
      pass = true;
      tone(soundPin, 20);
    }
  }
else {
      pass = false;
      noTone(soundPin);
    }
  
 
      

delay(10); //reading delay 
}



Comments

Popular posts from this blog

PROJECT 1 (2.0!) : LOCK BOX (For 3/26/19)

Project one observations