Materials,
9 volt Battery,
Neo Pixels, 9, with plastic cover
PIR sensor
Arduino board
Wires
Breadboard
Teapot
Step 1. Get out all your materials. Hook up your senors and Neopixel to the Arduino and breadboard using schematics from adafruit.
Step 2. Upload code to Arduino. And paint Plastic cover for Neopixels
#define PIN 6
#define N_LEDS 9
//int ledPin = 13; // choose the pin for the LED
int inputPin = A0; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = LOW; // variable for reading the pin status
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
pinMode(inputPin, INPUT); // declare sensor as input
Serial.begin(9600);
}
void loop() {
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
chase(strip.Color(0, 0, 255)); // Blue
// digitalWrite(ledPin, HIGH); // turn LED ON
//if (pirState == LOW) {
// we have just turned on
Serial.println(“Motion detected!”);
// We only want to print on the output change, not state
// pirState = HIGH;
// }
} else {
// digitalWrite(ledPin, LOW); // turn LED OFF
// if (pirState == HIGH) {
// we have just turned of
Serial.println(“Motion ended!”);
// We only want to print on the output change, not state
// pirState = LOW;
// }
}
//chase(strip.Color(255, 0, 0)); // Red
//chase(strip.Color(0, 255, 0)); // Green
// chase(strip.Color(0, 0, 255)); // Blue
}
static void chase(uint32_t c) {
for (uint16_t i = 0; i < strip.numPixels() + 4; i++) {
strip.setPixelColor(i , c); // Draw new pixel
strip.setPixelColor(i – 4, 0); // Erase pixel a few steps back
strip.show();
delay(200);
}
}
Step 3. Thread Neopixels through spout
Step 4. Place everything inside teapot
Step 5. Cover teapot and shake to make the Neopixels light up!