Introduction: SpotLight Interactive Nightlight

The SpotLight is an interactive nightlight powered by Arduino, taking on a cute pug-based form factor. The light has three interactive features:


1) Insert a coin into the back of the SpotLight to turn the lights on and off.

2) Pet the SpotLight to make the lights turn a soothing blue color.

3) Talk to the spotlight. A non-threatenging, higher pitched noise will make its eyes turn green. A low growl will make them turn red.

Supplies

1. Arduino board. In this project I'm using the Uno.

2. Two RGB leds (https://www.adafruit.com/product/159)

3. A photoresistor (https://www.adafruit.com/product/161)

4. A microphone (https://www.adafruit.com/product/1713)

5. Resistors: (6) 2.2kΩ resistors, (2) 1.5kΩ resistor

6. A case. I found the Pug piggy-bank (Puggy Bank?) at a salvation army. Get creative and find your own unique case to make this creation your own!

Step 1: Circuitry

This is the circuitry diagram. The major components are as follows:


Input

1) Microphone - bottom left of the image, used to listen to audio frequencies

2) Photocell (top middle-left) - used to detect if you are petting the dog

3) On/Off switch. This is shown as a button in the diagram (top left), but we use tinfoil in the final project to create an open circuit which can be closed by a coin. This is effectively the same as a button which closes the circuit when pushed down.

Output

Two RGB leds, with identical wiring.

Step 2: Code

The source code for this project is available here:

https://github.com/mathisonian/spot-light-nightlig...

Make sure that the pins you are using on your arduino match up correctly with the pins used in code. Depending on how you've wired things up you may have to change these value:

https://github.com/mathisonian/spot-light-nightlig...

This code uses a Fast Fourier Transform (FFT) to convert the audio waveform that is received by the microphone into a frequency spectrum. This allows us to listen to frequencies and change the color of the LEDs based on that. The code is set up to turn the lights red when the low end of the frequency spectrum is dominant and green when the high end is. Try playing with these parameters and see what you can do!

Step 3: The Case

First thing - find yourself a case!

This dog came from the salvation army, but I'm sure you can find other interesting objects to turn into a nightlight. Since the dog is hollow it allows us to put the electron components directly inside the body.

I used a drill to create holes in the dog eyes and a small one behind the left ear to place to photo cell. I also made a whole behind the right ear so that the microphone could better pick up sounds; the microphone is mounted inside the head near that hole. Use hot glue to fix those components in place.


To create the coin operation, connect the wires which are shown in the schematic as connecting to a button and instead connect each side to separate swaths of tinfoil. Place the two pieces of tin foil just far enough apart so that a coin (e.g. a quarter) can touch both of them simultaneously, closing the circuit.

Step 4: Enjoy

Have fun with your new creation! If you have any problems following these instructions feel free to leave an issue on the GitHub repository, or tag me on twitter @mathisonian.