Introduction: The Creepy Doll
Here at Mikamai, we often organise events and hackathons. After the last hackathon, someone left an old doll, and it was kinda creepy... so why not make it even creepier?
I decided to put two red LEDs instead of the eyes, and a vibration sensor to turn on the LEDs when you shake the doll. Everything is powered by an AtTiny85 and a single CR2032 battery.
Step 1: Materials and Tools
Materials:
- a doll
- an Arduino (Diecimila, Uno, Leonardo or Yún are ok)
- AtTiny85
- 8 Pin DIP Socket
- two 3mm red LEDs
- a stripboard
- a tilt sensor
- CR2032 battery holder
- CR2032 battery
Tools:
- A sharp cutter
- Hot glue gun
- A soldering iron and solder
- Needle and thread, to sew it back
- optional - a Dremel to drill the eyes
Step 2: Prototyping and Testing the Circuit
Using the AtTiny 85 is a great choice for those who are familiar with Arduino, because you have the possibility to use the Arduino IDE to program it. This means that you can prototype the circuit with Arduino before deploying it to the AtTiny.
So I wrote this code, and I built a simple testing circuit with Arduino.
<p>#import <Arduino.h><br></p><p>int led = 0; // LEDs pin int button = 2; // Tilt sensor pin int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by int storedVal = 0; // used to save the tilt sensor state</p><p>void setup() { pinMode(button, INPUT_PULLUP); // initialize the button pin a pullup input, so I don't have to use an external pullup resistor. pinMode(led, OUTPUT); // initialize the digital pin as an output. }</p><p>void loop() {</p><p> int sensorVal = digitalRead(2); // Read the sensor state</p><p> if (sensorVal != storedVal) { //if the sensor value has changed, blink the eyes storedVal = sensorVal; // store the sensor state fadeEyes(); // call the eyes led fade function } else { digitalWrite(led, LOW); // otherwise, turn the led off }</p><p> delay(10); // a small delay for debouncing the sensor }</p><p>void fadeEyes() {</p><p> for (int i = 0; i < 768; i++) { //cycle 3 times analogWrite(led, brightness); // set the brightness of led pin: if (brightness == 255) { // at maximum brightness, wait 5 seconds delay(5000); } // change the brightness for next time through the loop: brightness = brightness + fadeAmount;</p><p> // reverse the direction of the fading at the ends of the fade: if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount; }</p><p> // wait for 30 milliseconds to see the dimming effect delay(100);</p><p> }</p><p> digitalWrite(led, LOW); }</p>
The code is pretty simple: it waits for a changement in the tilt sensor state, and when it happens, it starts a little loop fading the leds brightness
When the code works on Arduino, you are ready to deploy it on your AtTiny85
Step 3: Moving to AtTiny85
Programming an AtTiny with an Arduno can be tricky, but fear not! I made a very simple tutorial on how to do that with the latest Arduino IDE and Arduino Uno/diecimila or Arduino Leonardo/Yun. Just follow these steps, and you can easily use this sketch on the AtTiny85
Step 4: Testing the AtTiny85 Based Circuit
Now we can move the programmed AtTiny on a new breadboard, following this scheme
There is no resistor on the LED because I'm using a 3.3V coin battery. The circuit should start working as soon as you plug the battry: when the tilt sensor is shook, the LED fades :)
Step 5: Making the Circuit
Now that everything is tested, we can make the circuit. I decided to use a stripboard because even if it's a little big, the result will be more stable and short circuit proof. Start placing the components on the stripboard and soldering them, the circuit is supersimple so this should be a very easy task.
I've put the LEDs in parallel, I know that I should have used a small resistor, but I was more focused on the simplicity of the project than on its life expectation, plus, it will be powered by a 3.3V battery, so I didn't really care about it :)
The only precaution was to put some tape on the led wires to avoid short circuits.
Now you can test the circuit alone. If everything is fine, you can move to the next step
Step 6: The Doll Surgery
With the cutter, remove some stitches from the doll and remove the head's stuffing. Than drill the holes on the eyes. I used a Dremel for this task, but you can even use the cutter. Now insert the circuit, starting from the eyes. When the led pupils are in the holes, pour a lot of hot glue from the inside of the head, so you will be sure that the LEDs will stay at their place. Then put some more stuffing, the circuit, some more stuffing, the tilt sensor and the rest of the stuffing. In this way you are sure that everything won't accidentally move and you will reduce the risk of short circuits to the minimum.
I suggest to use some velcro or a couple of buttons to close back the doll, so you can change the battery whanever you want