TEAM: Qingqing Zhou, Leticia Li, Youer Zhao

Concept

Because there will be ghosts on Halloween, carrying jack-o-lanterns can ward off evil spirits, so I came up with such an idea.

Untitled

When no one is around, the ghost roams, and when it detects that someone is approaching, the ghost becomes agitated and shakes, but when the people take out the jack-o '-lantern, the ghost screams and is dispersed.

Components

Ultrasonic sensor

An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound waves. An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back information about an object's proximity.

Untitled

Photoresistors

also known as LDR (light-dependent resistors), are components made of semiconductors. A photoresistor is sensitive to light. Its resistance decreases when lighting increases (Figure 1.15). Photoresistors have multiple uses, for example, automatic door opening.

Untitled

Initial experiment

Untitled

/*
 * HC-SR04 example sketch
 *
 * <https://create.arduino.cc/projecthub/Isaac100/getting-started-with-the-hc-sr04-ultrasonic-sensor-036380>
 *
 * by Isaac100
 */

const int trigPin = 9;
const int echoPin = 10;

float duration, distance;

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);
  distance = (duration*.0343)/2;
  Serial.print("Distance: ");
  Serial.println(distance);
  delay(100);
}

Visual Effects

https://www.youtube.com/watch?v=w4DXtVWdlYg

https://www.youtube.com/watch?v=2EwQSCZ0Hs8

Other Idea

Leticia: