0

$USD

$USD
PROJECTS HalloweenArduino

How to Make A Terrifying Halloween Gadget

DFRobot Oct 12 2016 3283

First, Let me show you what I did!!!

This is a simple but fun application for Halloween. All you need is a mask, a stepper motor, a micro-controller, a motor driver, a MP3 module and some wires as well as batteries. 

How to Make A Terrifying Halloween Gadget - DFRobot


I used following materials, of course you could find the alternatives.

            DFRduino UNO R3 - Arduino Compatible
            TMC260 Stepper Motor Driver Shield For Arduino
            Bipolar Stepper Motor with Planet Gear Box (18kg.cm)
            DFPlayer - A Mini MP3 Player For Arduino
            Gravity: Digital PIR (Motion) Sensor For Arduino

            Building the electronic circuit

            1. Schematic circuit diagram:

            The DFRduino UNO R3 (the same as arduino uno) controls the movement of stepper motor. The sensor here can detect human body. If there is anyone passing by, the stepping motor’s movement will be triggered and a facial mask will be released, with MP3 music played accordingly. After for a while, the stepping motor will re-launched and take the mask back to its original place. 

            How to Make A Terrifying Halloween Gadget - DFRobot

            During the connection, beware that both the micro-controller and the motor driver shield should be supplied with power. It is better to connect the MP3 with 1K electric resistance to reduce the noise.

            How to Make A Terrifying Halloween Gadget - DFRobot

            2. Drawing the 3D model:

            You need to  3D print a wheel. Please note that the wheel will be short of motive power if it was too big. Meanwhile, the wheel cannot be too small either as this will reduce the creeping effect by slowing down the speed of the mask falling down. 


            3. Decorating the facial mask

            You can make a creepy face by yourself, or you can buy one from Ebay. You can also install LEDs in its eyes to make it creepier. 

            How to Make A Terrifying Halloween Gadget - DFRobot

            4. Installation

            Hang the mask in the place you want. Place a pulley wheel on top of it so that the DFRduino UNO and the motor driver can be easily installed. The speaker will sound better if you insert soft mats in between the mask and the player. Meanwhile, put the sensor to the place where people would come in. 



            Beware that both the motor driver shield and DFRduino Uno shall be supplied with power. The motor driver shield needs relatively large current. 

            Now, it's done! Do you know how to make one now?


            Code

            #include <SPI.h>
            #include <TMC26XStepper.h>
            #include <SoftwareSerial.h>
            #include <DFPlayer_Mini_Mp3.h>
            //we have a stepper motor with 200 steps per rotation,CS pin 6, dir pin 4, step pin 5 and a current of 300mA
            TMC26XStepper tmc26XStepper = TMC26XStepper(200, 6, 4, 5, 800);
            void setup() {
              Serial.begin(9600);
              Serial.println("==============================");
              Serial.println("TMC26X Stepper Driver Demo App");
              Serial.println("==============================");
              //set this according to you stepper
              Serial.println("Configuring stepper driver");
              //char constant_off_time, char blank_time, char hysteresis_start, char hysteresis_end, char hysteresis_decrement
              tmc26XStepper.setSpreadCycleChopper(2, 24, 8, 6, 0);
              tmc26XStepper.setRandomOffTime(0);
              tmc26XStepper.SPI_setCoilCurrent(100);
              tmc26XStepper.setMicrosteps(128);
              tmc26XStepper.setStallGuardThreshold(4, 0);
              Serial.println("config finished, starting");
              Serial.println("started");
              mp3_set_serial (Serial);        //set Serial for DFPlayer-mini mp3 module
              mp3_set_volume (30);
              pinMode(3, INPUT);
            }
            void loop() {
              if (digitalRead(3) == 1)
              {
                tmc26XStepper.SPI_setSpeed(250);   //Set 120 RPM per minute
                tmc26XStepper.SPI_step(-1000);       //Set the running steps to 200 steps
                tmc26XStepper.spi_start() ;         //Motor starting
                delay(100);
                mp3_play (1);                      //play mp3
                delay (5000);
                tmc26XStepper.SPI_setSpeed(250);   //Set 120 RPM per minute
                tmc26XStepper.SPI_step(1000);       //
                tmc26XStepper.spi_start() ;
                delay(100);
              }
            }