Halloween Zoetrope
![Captura de pantalla 2021-11-02 a las 12.49.45.png](/proxy/?url=https://content.instructables.com/FLO/D5PD/KVGOEPIP/FLOD5PDKVGOEPIP.png&filename=Captura de pantalla 2021-11-02 a las 12.49.45.png)
Hello everyone, we are a group of three students of engineering in Elisava university. We wanted to design a Halloween zoetrope with a sensor that moves when it feels something close. If you want to see more about this project, keep reading!
Supplies
Electrical components:
- (1) Arduino UNO
- (1) 5 volt DC
- (3) LED
- (3) 10 resisters, one for each LED
- (1) 330 resisters for the motor
- (1) transistor, NPM
- (1) Diode (1N4004)
- (1) Computer that we will use like a battery
For the structure:
- (2) 600 x 1000 x 4 mm cardboard
- (2) 500 x 650 mm gold card
- glue
- scissors
- knive
- pencil
Blueprints
![Captura de pantalla 2021-11-02 a las 12.53.57.png](/proxy/?url=https://content.instructables.com/FMA/09VB/KVGOEPK3/FMA09VBKVGOEPK3.png&filename=Captura de pantalla 2021-11-02 a las 12.53.57.png)
![Captura de pantalla 2021-11-02 a las 12.55.07.png](/proxy/?url=https://content.instructables.com/FCE/LC54/KVGOEPK4/FCELC54KVGOEPK4.png&filename=Captura de pantalla 2021-11-02 a las 12.55.07.png)
Here are the measurements for the structure. We cut ours on a lazer cutter but if you don't have one you can print them and cut them out with a scalpel.
Structure
![Captura de pantalla 2021-11-02 a las 12.57.47.png](/proxy/?url=https://content.instructables.com/FK6/MQ96/KVGOEPKQ/FK6MQ96KVGOEPKQ.png&filename=Captura de pantalla 2021-11-02 a las 12.57.47.png)
![Captura de pantalla 2021-11-02 a las 12.57.32.png](/proxy/?url=https://content.instructables.com/F3P/YK64/KVGOEPKR/F3PYK64KVGOEPKR.png&filename=Captura de pantalla 2021-11-02 a las 12.57.32.png)
After cutting the pieces, assemble the structure.
Slot the stand together and then fit the top circle to lock it into place.
Print the animation you want and glue that to the outer disk.
Arduino
![Captura de pantalla 2021-11-02 a las 13.18.23.png](/proxy/?url=https://content.instructables.com/F5J/0YG2/KVGOER2R/F5J0YG2KVGOER2R.png&filename=Captura de pantalla 2021-11-02 a las 13.18.23.png)
The circuit above has three major components: the motor control, distance sensor and LED candle.
The motor control consists of a transistor, diode and 220 ohm resistor led by the arduino that varies the voltage based on the distance sensor. Be careful to orientate the diode correctly as it is polar.
The distance sensor can be programmed to different distances if you want to change it to fit your space, simply change the ___ variable to the distance you want it to activate, it is currently set to 50cm.
As you move within range, the motor will turn on and as you move in closer it increases the speed, giving it the effect of a haunted Victorian toy!
Alongside this an LED that flickers like a candle will turn on at the same distance as the motor.
The code can be copy and pasted from here
Code:
*/ ---------------------------------------------------------------- //
Halloween Zoetrope!
This code starts a motor and a flickering led when in a specified range. As you get closer, the motor speeds up. We’ve used this for a spooky zoetrope but you can use this code for a variety of purposes.
Written by Julia, Paula and Tom!
Version 1.0 - 30/10/2021
// ---------------------------------------------------------------- /*
// defines variables
//Distance Sensor
#define echoPin 2 // attach pin Echo of HC-SR04
#define trigPin 3 //attach pin Trig of HC-SR04
long duration; // variable for the duration of sound wave travel
int distance; // variable for the distance measurement
int range = 50; // variable for the activation range in cm
//Motor
int speed; // controls the motor speed
int motorPin = 5;
//candle
const int pin = 6; // Led +
long random_led;
long random_time;
int difer_time();
void setup() {
//Sensor setup
pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT
Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed
Serial.println("Ultrasonic Sensor HC-SR04 Test"); // print some text in Serial Monitor
Serial.println("with Arduino UNO R3");
//Motor Setup
pinMode(motorPin, OUTPUT);
//Candle Setup
pinMode(pin, OUTPUT);
randomSeed(analogRead(A3));
Serial.begin(9600);
}
int min_led = 200;
int max_led = 1024;
void loop() {
//sensor
// Clears the trigPin condition
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin HIGH (ACTIVE) for 10 microseconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration * 0.034 / 2; // Speed of sound wave divided by 2 (go and back)
// Displays the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
//MOTOR
if (distance <= range){
speed = map(distance, 0, range, 255, 30) ;
} else{
speed = 0;
}
analogWrite(motorPin, speed);
//Candle start --------------------------------------
random_led = random(min_led, max_led); // random number to shine led
random_time = difer_time(random_led); // convert stranght to time
analogWrite(pin, random_led); // set pin to value PWM
delay(random_time); // set delay depending of the stranght
}
int difer_time(int s){
int a, b, wait;
b = map(s, min_led, max_led, 1, 100); // remap streinght to 100%
// 3 stages of random speed. If more light then longer delay
if (b > 80){
wait = random(80, 100); // max strenght
}
else if (b > 20 && b < 60){
wait = random(20, 80); // midle strenght.
}
else{
wait = random(1, 20); // led almost turned of, time very short.
}
// In Arduino ID I use Tracer window to see values as lines
Print(80); Print(40); Print(20); // print base line
Print(b); Print(wait); Print(s); // print values to the screen
Serial.println(""); // make new line.
return wait;
}
void Print(int d){
// Print function is alowing make code above shorter
Serial.print(d); Serial.print(" ");
}
//candle end --------------------------------------------------
Motorizing the Zoetrope
![Captura de pantalla 2021-11-02 a las 13.41.51.png](/proxy/?url=https://content.instructables.com/F8J/OU1J/KVGOESJ2/F8JOU1JKVGOESJ2.png&filename=Captura de pantalla 2021-11-02 a las 13.41.51.png)
Now glue the arduino and the bread board to the underside of the disk. Fit the motor into place so it cannot move. Wire up and glue the LED to the outside so it can light up a spooky dark room!!
Be careful when fitting the top to the motor, its hard to get the balance right so make you you place it in the middle.
The Final Result
![Captura de pantalla 2021-11-02 a las 13.41.42.png](/proxy/?url=https://content.instructables.com/FMO/Z37M/KVI3SMXD/FMOZ37MKVI3SMXD.png&filename=Captura de pantalla 2021-11-02 a las 13.41.42.png)
Now with it all together plug it in!
As with all projects something will go wrong, it is likely the cables so check it's all in the right place!
Best of luck and Happy Halloween!