Scary Creepy Doll for Halloween!

Midterm Project.

Both Sofia and I did not have previous experience of Halloween holiday, so we just decided to create something scary and creepy to fit the topic of Halloween! As we know, people dressed up and pretended some character to scare others in Halloween. As a result, we came up with an idea that most of dolls looked so creepy even though it was expensive or elegant one. That was the reason why we decided to modify this doll!

First, we wanted to make its eyeballs move while people got closer to it. In consequence, we chose ultrasonic sensor as input to detect the distance between people and this doll. When get closer enough, the Arduino will be triggered and operated. Besides, we cut its head apart since we needed to add a servo in it in order to control the eyeballs of this doll. Then, we used stick attached to the eyeballs. Lastly, using servo with a component to lift up and put a stick down which caused eyeball movement. We met a lot of problems while constructing it because of the space of its head was too small. For instance, stick on eyeballs was easily be stuck by the servo.

Second, we desired it to have a sound with the eyeballs movement. So, at first, we used a SD card reader module trying to access to the SD card, but it did not work. And then, I tried to use dfplayer to read the audio files in SD card, and it worked! However, the sound quality was not as good as we thought. As a result, we change to another speaker which was smaller.

Lastly, when we made sure that all the sensors and mechanism were functioned, we soldered them in a small board. It reduced the space that we needed to use. And we started to construct it into original look while we got this, making it look pretty!

Here is the video :

 

 

/// MP3 PLAYER PROJECT
/// http://educ8s.tv/arduino-mp3-player/
//////////////////////////////////////////

 

#include “SoftwareSerial.h”
SoftwareSerial mySerial(10, 11);
# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]

# define ACTIVATED LOW

 

int trigPin = 12; //Trig Pin
int echoPin = 9; //Echo Pin
long duration, cm, inches;
boolean isPlaying = false;

int timer = 0;

void setup () {

mySerial.begin (9600);
Serial.begin(9600);
delay(1000);
playFirst();
isPlaying = true;

pinMode(trigPin, OUTPUT); //Define inputs and outputs
pinMode(echoPin, INPUT);

 

}

 

void loop () {

digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH); //
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

//pinMode(echoPin, INPUT); // 讀取 echo 的電位
duration = pulseIn(echoPin, HIGH); // 收到高電位時的時間

cm = (duration / 2) / 29.1; // 將時間換算成距離 cm 或 inch
inches = (duration / 2) / 74;

Serial.print(“Distance : “);
Serial.print(inches);
Serial.print(“in, “);
Serial.print(cm);
Serial.print(“cm”);
Serial.println();

 

 

if (inches > 1 && inches < 5)
{

timer = 1000;

} else {

timer –;
}
if (timer > 200)
{
play();
delay(15);
}
else {

pause();
//delay(15);

}

 

 

if (inches > 10 && inches < 15)
{
timer = 1000;

} else {

timer –;

}

if (timer > 200) {
playNext();
delay(15);
} else {
pause();
delay(15);

}

 

if (inches > 25 && inches < 30)
{
timer = 1000;

} else {

timer–;

}

if (timer > 200) {
playPrevious();
delay(15);
} else {
pause();
//delay(15);

}
}

 

void playFirst()
{
execute_CMD(0x3F, 0, 0);
delay(500);
setVolume(30);
//delay(500);
execute_CMD(0x11, 0, 1);
delay(500);
}

void pause()
{
execute_CMD(0x0E, 0, 0);
delay(500);
}

void play()
{
execute_CMD(0x0D, 0, 1);
delay(500);
}

void playNext()
{
execute_CMD(0x01, 0, 1);
delay(500);
}

void playPrevious()
{
execute_CMD(0x02, 0, 1);
delay(500);
}

void setVolume(int volume)
{
execute_CMD(0x06, 0, volume); // Set the volume (0x00~0x30)
delay(2000);
}

void execute_CMD(byte CMD, byte Par1, byte Par2)
// Excecute the command and parameters
{
// Calculate the checksum (2 bytes)
word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
// Build the command line
byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte
};
//Send the command line to the module
for (byte k = 0; k < 10; k++)
{
mySerial.write( Command_line[k]);
}
}

One Reply to “Scary Creepy Doll for Halloween!”

Leave a Reply

Your email address will not be published. Required fields are marked *