0

SkullGuy Halloween greeter and doorbell effect (Audio FX)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SkullGuy Halloween greeter and doorbell effect (Audio FX)

by subrosa on Mon Oct 13, 2014 11:50 pm

Hi All,

Figured I'd share a project I had kicking around for a while and finally finished.

Basically it's a skull that looks at you, says hi, and then beckons you to ring the doorbell. Yes, I'm cheating and using a single "eye" and an eye patch...maybe next year I'll push it a little further.

PIR sensor notices motion, activates the "eye" (pingpong ball with an adafruit webcam sticker for a pupil), then triggers the audio FX board to play a sound out the speaker, then the neopixel ring activates around my doorbell.

Control is from an Arduino Micro feed with 5v USB, only downside here is that I can't push the power usage too much further.

In the dark this looks really freaky, especially when I have the eye rotate into position from the back of the skull.

It's my first project using the Audio FX board, and I got to say it's awesome! All audio recorded and edited with Audacity in Linux, then exported to OGG format.

Any ideas for expansion/tweaking are welcome!
Attachments
FullSizeRender(1).jpg
FullSizeRender(1).jpg (132.37 KiB) Viewed 629 times

subrosa
 
Posts: 38
Joined: Sun Jun 01, 2014 5:33 am

Re: SkullGuy Halloween greeter and doorbell effect (Audio FX

by adafruit_support_bill on Tue Oct 14, 2014 6:01 am

Nice looking project - thanks for posting!

adafruit_support_bill
 
Posts: 66177
Joined: Sat Feb 07, 2009 10:11 am

Re: SkullGuy Halloween greeter and doorbell effect (Audio FX

by thebakedbaker on Mon Oct 27, 2014 2:12 pm

I would love to see this in action, can you post a video? Also, it'd be cool to see a little more about your exact setup/code. You'd probably get a lot more feedback and ideas for expansion/tweaking. It looks great, though, I love the neopixel ring around the doorbell.

thebakedbaker
 
Posts: 4
Joined: Mon Sep 22, 2014 9:57 pm

Re: SkullGuy Halloween greeter and doorbell effect (Audio FX

by subrosa on Mon Oct 27, 2014 3:58 pm

I'll need to sort out how to upload video, but it's coming.

Here is the code, it's very simple as most of the magic is in the effects (which is why I love Adafruit/Arduino so much!)

I removed the neopixel example header (to make this a little smaller), but the NeoPixel effect is from the strandtest code and I want to attribute it as such. I couldn't make anything "cooler".

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>
#include <Servo.h>

//Define NeoPixel ring
#define PIN            2
#define NUMPIXELS      16
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
//Define Servo for eye
Servo skullservo;  // servo in the skull

//starting position for skullservo
int pos = 0;
//Passive IR pin
int pir = 3;
//skull led
int skullled = 1;
//pin 7 is attached to the audio fx board (low fires)
int fx0 = 7;
int fx1 = 6;

void setup() {

  pinMode(skullled, OUTPUT);
  pinMode(pir, INPUT);
  pinMode(fx0, OUTPUT);
  pinMode(fx1, OUTPUT);
 
  //neopixel startup
  pixels.begin();
  pixels.setBrightness(60);
  pixels.show();
 
  //Start with the audio fx trigger HIGH (off)
  digitalWrite(fx0, HIGH);
  digitalWrite(fx1, HIGH);
 
}

void loop() {
 
  //turn off skullled
  digitalWrite(skullled, LOW);
 
  skullservo.attach(9);

  //set skull to initial position to back of head
  skullservo.write(170);


  if(digitalRead(pir) > 0){
   
    //delay(2000);
    //turn on light and look around a bit
    digitalWrite(skullled, HIGH);
    skullservo.write(5);
    delay(700);
    skullservo.write(30);
    delay(700);
    skullservo.write(20);
    delay(700);
    skullservo.write(5);
    delay(700);
    skullservo.write(30);
    delay(700);
    skullservo.write(15);
    delay(700);
    skullservo.write(25);
   
   
    //play a sound from fx0 pin 7
    digitalWrite(fx0, LOW);
    delay(500);
    digitalWrite(fx0,  HIGH);   
    delay(3500);
 
    skullservo.detach();
    //turn on neopixel ring for a bit,
    //cycle number set in function
    rainbowCycle(5);   
   

   //say goodbye as they leave
   digitalWrite(fx1, LOW);
   delay(500);
   digitalWrite(fx1,  HIGH);   
 
  for(int i=0;i<NUMPIXELS;i++){
  pixels.setPixelColor(i, 0);
  delay(50);
  pixels.show();
 
   skullservo.attach(9);
 
   digitalWrite(skullled, LOW);
   skullservo.write(170);
 

  }
 // How long do goblins linger?
  delay(60000);

  }




}
// Amazing ColorWheel effect from NeoPixel example lib

void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*12; j++) { // 12 cycles of the color wheel
    for(i=0; i< pixels.numPixels(); i++) {
      pixels.setPixelColor(i, Wheel(((i * 256 / pixels.numPixels()) + j) & 255));
    }
    pixels.show();
    delay(wait);
  }
}
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
   return pixels.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else if(WheelPos < 170) {
    WheelPos -= 85;
   return pixels.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  } else {
   WheelPos -= 170;
   return pixels.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  }
}

subrosa
 
Posts: 38
Joined: Sun Jun 01, 2014 5:33 am

Re: SkullGuy Halloween greeter and doorbell effect (Audio FX

by subrosa on Sat Nov 01, 2014 3:49 am

As promised...in action tonight. It was a big hit, all the kids loved it (well some only after they got candy).

https://www.youtube.com/watch?v=wR_aE1r ... e=youtu.be

subrosa
 
Posts: 38
Joined: Sun Jun 01, 2014 5:33 am

Re: SkullGuy Halloween greeter and doorbell effect (Audio FX

by adafruit_support_bill on Sat Nov 01, 2014 6:34 am

Awesome! Thanks for the video

adafruit_support_bill
 
Posts: 66177
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.