Mike Rigsby
Published © GPL3+

Ghosty Table

When someone passes by, this 3d printed ghost table lights up and squeals!

IntermediateFull instructions providedOver 2 days1,909
Ghosty Table

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Relay (generic)
https://www.amazon.com/gp/product/B00VRUAHLE/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
×1
ultrasonic transducer
×1
LED (generic)
LED (generic)
https://www.amazon.com/16-4ft-Flexible-Lights-Lumens-Non-waterproof/dp/B00HSF64JG/ref=pd_sim_60_5?_encoding=UTF8&pd_rd_i=B00HSF64JG&pd_rd_r=QKF1CVRX8DBDS9EEZ2M1&pd_rd_w=OtAle&pd_rd_wg=dlVfy&psc=1&refRID=QKF1CVRX8DBDS9EEZ2M1
×1

Story

Read more

Schematics

Schematic

Code

Arduino Sketch

C/C++
const int pingPin=7;//ping input-output
long duration;

int light=9;//voltage to led
int sound=5;//sound pin

int val=0;



void setup () {
  pinMode(light, OUTPUT);
  pinMode(sound,OUTPUT);
  
  
  digitalWrite(light,HIGH);
  digitalWrite(sound,HIGH);
  delay(1000);
  digitalWrite(sound,LOW);
  delay(5000);
  digitalWrite(light,LOW);
  delay(2000);

 
  
}

void loop () {
  
delay(200);
  
    
  
  pinMode (pingPin,OUTPUT);//start of ultrasonic test
  digitalWrite (pingPin,LOW);
  delayMicroseconds (2);
  digitalWrite (pingPin,HIGH);
  delayMicroseconds(5);
  digitalWrite (pingPin,LOW);
  pinMode (pingPin,INPUT);//listen for pulse back
  duration=pulseIn (pingPin,HIGH);
  
 
 
  if (duration<8000) {

     
delay(50);
pinMode (pingPin,OUTPUT);//start of ultrasonic test
  digitalWrite (pingPin,LOW);
  delayMicroseconds (2);
  digitalWrite (pingPin,HIGH);
  delayMicroseconds(5);
  digitalWrite (pingPin,LOW);
  pinMode (pingPin,INPUT);//listen for pulse back
  duration=pulseIn (pingPin,HIGH);

  if (duration<8000) {


    
      digitalWrite (light,HIGH);//turn on lights
      digitalWrite(sound,HIGH);//turn on sound
      delay(200);
      digitalWrite (sound,LOW);//turn sound off
      delay(20000);//stay on 20 seconds
      digitalWrite (light,LOW);
      
      
      
     
    }
    
  }
  
}
    
  
  

Credits

Mike Rigsby

Mike Rigsby

13 projects • 35 followers
I am an author and a maker. Current projects include Santa's Shop and Little Friend (ultracapacitor powered robot) on hackaday.io.

Comments