Ghost Toy

by marsal15 in Circuits > Arduino

143 Views, 0 Favorites, 0 Comments

Ghost Toy

FZFWCN3KVKYN20A.jpeg

We are 3 students of third year of industrial design engineering in Elisava, a university in Barcelona. At the beginning of the course we were asked from the subject of UATEA (Academic uses in specific terminology in English I) to design a project for Halloween using the arduino. This could be developed as we wanted and use the material we wanted, the only condition was the proposed theme (Halloween) and use the electronic elements that we had learned in class.

We had two sessions to do it, in which each group worked on their own and if doubts arose we had our teacher to help us.

Supplies

modulo-HC-SR04-arduino.jpg
towerpro-servo-sg90.jpg
unnamed.jpg
815k0WXLkQL._SL1500_.jpg

MATERIALS

-Fibrapan sheet 1000mm x 600mm x 3mm

-Black paint sprai

-10 Squares

-40 Screws

-Cardboard 250mm x 130mm x 2mm

-Rope 500mm

-Dummy

-Transparent plastic vinyl

-Thick screw (pulley)

-3 coffee sticks

-Duct tape

-Silicone

TOOLS

- Bandsaw (cutting of the plate)

- Tape sandpaper (edge adjustment)

- Battery drill (holes and collar screws)

-Silicone gun

ELECTRONIC PARTS

-Arduino

-Servomotor

-Ultrasonic sensor

-Stepper motor

PROTOTYPE

Captura de pantalla 2021-11-04 134540.png

Our project is based on a box with a doll (ghost woman) inside that by means of a presence sensor drops this being hung by the neck with a rope. When the ultrasonic sensor is activated, the lower opening is uncovered, causing the doll to fall by its own weight and frighten whoever has passed in front of it. A few moments later the motor of the pulley is activated and picks up the doll into the box, then the lower door closes and the pulley undoes the rope just roger, leaving the rope of the doll released and the ghost woman accommodated in the lid ready for the next person to be frightened.

CONSTRUCTION GUIDE

IMG-20211101-WA0021.jpg
IMG-20211101-WA0026.jpg
IMG-20211101-WA0030.jpg
IMG-20211101-WA0032.jpg

1- Engrave the measures of our box in the fiberpan sheet.

2- Cut the sheet with a band saw

3- Sand the sides of the different pieces.

4- Make a hole in the centre of the drawer plate where the rope will pass through.

5- Make holes with the drill where the joints will be made.

6- Join the sides, the surface, the drawer and the lower opening with brackets and screws.

7- Cut the excess screws with a piece of sandpaper.

8- Cut out the cardboard that will make the lower opening and attach three coffee sticks (in the shape of a T) to the servo motor with duct tape to make it move stably.

9- Paint the box with black spray

10- Fix with a silicone gun the different electrical elements in their respective place.

11- Attach the big screw to the stepper motor to make it work as a pulley.

12- Place the rope, one end around the neck of the doll and the other end around the screw.

13- Place the plastic vinyl on the tube-shaped box to guide the doll when it goes up so that it does not get stuck on the sides.

14- Decorate the box with the Halloween theme.

Code

Captura de pantalla 2021-11-04 135408.png

//Motor servo

#include <Servo.h>

int cm = 0;

long distancia, duracio; // Els valors de distncia i duració seran decimals

int posicion1 = 90; //Indiquem les dues posicions on s'anirà movent el servo

int posicion2 = -90;

Servo miServo; //al pin 13

//Motor Pas a Pas

#define Pecho 6 //Echo al pin 6

#define Ptrig 7 //Trig pin 7

int IN1 = 0;   // pin digital 0 d'Arduino a IN1 de modulo controlador

int IN2 = 1;   // pin digital 1 d'Arduino a IN2 de modulo controlador

int IN3 = 2;   // pin digital 2 d'Arduino a IN3 de modulo controlador

int IN4 = 3;   // pin digital 3 d'Arduino a IN4 de modulo controlador

int demora = 2; //Hem de definir una demora per tal que es vagi movent el motor pas a pas de modul a modul


void setup() {

 // put your setup code here, to run once:

 pinMode(Pecho, INPUT); //defineix el pin 6 com entrada (echo)

 pinMode(Ptrig, OUTPUT); //defineix el pin 7 com a sortida (triger)

 miServo.attach (13);

 pinMode(IN1, OUTPUT);  // tots els pins com a sortida

 pinMode(IN2, OUTPUT);

 pinMode(IN3, OUTPUT);

 pinMode(IN4, OUTPUT);

}


void loop() {

 // put your main code here, to run repeatedly:

 digitalWrite (Ptrig, LOW);

 delayMicroseconds(10);

 digitalWrite(Ptrig, HIGH); //genera el pulso de triger de 10ms

 delayMicroseconds(10);

 digitalWrite(Ptrig, LOW);

 duracio = pulseIn(Pecho, HIGH); //con esto sabemos cuanto tiempo estuvo en alto(HIGH)

 distancia = (duracio / 2) / 29; //  calcula la distancia en centimetros


 if (distancia > 10 || distancia <= 0) { //si la distancia es major a 500cm o menor a 0cm

  miServo.write(posicion2);

 }


 if (distancia <= 10 && distancia >= 1) { //si la distancia es menor o igual a 10cm i major o igual a 1cm

  miServo.write(posicion1);        //mou el servo a la posició 1

  delay(2000);

  for (int i = 0; i < 5120; i++) // 512*4 = 2048 Mentre la i no sigui igual a 512 el motor pas a pas s'anirà movent.

  {

   digitalWrite(IN1, HIGH); // pas 1

   digitalWrite(IN2, LOW);

   digitalWrite(IN3, LOW);

   digitalWrite(IN4, LOW);

   delay(demora);


   digitalWrite(IN1, LOW); // pas 2

   digitalWrite(IN2, HIGH);

   digitalWrite(IN3, LOW);

   digitalWrite(IN4, LOW);

   delay(demora);


   digitalWrite(IN1, LOW); // pas 3

   digitalWrite(IN2, LOW);

   digitalWrite(IN3, HIGH);

   digitalWrite(IN4, LOW);

   delay(demora);


   digitalWrite(IN1, LOW); // pas 4

   digitalWrite(IN2, LOW);

   digitalWrite(IN3, LOW);

   digitalWrite(IN4, HIGH);

   delay(demora);

  }

  miServo.write(posicion2); //Quan es pari el motor pas a pas el servo passarà a la posició 2.

  delay(10000);

  for (int i = 0; i < 3584; i++) // Mentre la i no sigui igual a 512 el motor pas a pas s'anirà movent però aquesta vegada es mourà cap a l'altre direcció.

  { digitalWrite(IN1, LOW); // pas 1

   digitalWrite(IN2, LOW);

   digitalWrite(IN3, LOW);

   digitalWrite(IN4, HIGH);

   delay(demora);


   digitalWrite(IN1, LOW); // pas 2

   digitalWrite(IN2, LOW);

   digitalWrite(IN3, HIGH);

   digitalWrite(IN4, LOW);

   delay(demora);


   digitalWrite(IN1, LOW); // pas 3

   digitalWrite(IN2, HIGH);

   digitalWrite(IN3, LOW);

   digitalWrite(IN4, LOW);

   delay(demora);


   digitalWrite(IN1, HIGH); // pas 4

   digitalWrite(IN2, LOW);

   digitalWrite(IN3, LOW);

   digitalWrite(IN4, LOW);

   delay(demora);

  }


 }

}

Results

WhatsApp Image 2021-11-04 at 17.27.21.jpeg
WhatsApp Image 2021-11-04 at 17.27.15.jpeg

Conclusions

This project has allowed us to experiment with different electronic elements in a dynamic way and that has meant that we have learned while having fun. Although we have not achieved all the actions we wanted to achieve with this project, we believe that the result has been satisfactory considering the time we had available. On the other hand, the theme was a lot of fun to execute.