Mood-O-Lantern

by priverco5614 in Circuits > Arduino

41 Views, 1 Favorites, 0 Comments

Mood-O-Lantern

WhatsApp Image 2024-11-08 at 12.15.10_fa67272c.jpg

Do you ever get bored of one single pumpkin face during Halloween? Worry not! Let us introduce to you, Mood-O-Lantern! Mood-O-Lantern is a face-changing lantern that changes it's eyes and mouth randomly at three different positions each to form 9 different faces. For the very least, you don't have to worry about having the same Halloween pumpkin for 9 years straight! And...It won't go bad because it's made of our good old plastic! Mood-O-Lantern is cheap, low-cost and can be made easily by anyone, so grab on and make one yourself~

Supplies

Tools:

  1. Hot glue gun
  2. Flat plastic cover/Cardboard
  3. Scissors
  4. Penknife

Electronics

  1. Jumper Wires
  2. Servo motor x2
  3. Arduino microcontroller
  4. LED light
  5. Resistor 220 Ohm
  6. Push Button Switch x 3
  7. Buzzer (Optional)

Materials

  1. Orange and Black paper
  2. One lantern of your choice

Project Showcase Video

Mood-O-Lantern : Instructables Halloween Contest 2024 Submission

This video is a Parody Commercial Video for Mood-O-Lantern, only available nowhere!

Setting Up Circuit

Screenshot 2024-11-06 003517.png
WhatsApp Image 2024-11-05 at 22.40.59_6a7771ea.jpg

Connect the components to the circuit based on this arrangement, you can test it out on tinkercad first for the code or you can connect directly to the Arduino microcontroller.

Add Arduino Code

Add the following code to the Arduino microcontroller and test if the circuit is working, for this code:

  1. Button 1 triggers the first motor servo
  2. Button 2 triggers the second motor servo
  3. Button 3 triggers both motor servos at the same time
  4. Each trigger randomly chooses between three different angles, 0, 90 and 180 for the motor servo
  5. There will be situations where the random selection repeats, this can be changed by modifying the code

#include <Servo.h>


Servo myServo1;

Servo myServo2;


const int button1 = 2;

const int button2 = 4;

const int button3 = 8;

const int buzzer = 6;

const int led = 7;

int pickedIndex;


int angles[3] = {0, 90, 180};


int lastButtonState1;

int lastButtonState2;

int lastButtonState3;

int currentButtonState1;

int currentButtonState2;

int currentButtonState3;


void setup() {

 pinMode(button1, INPUT_PULLUP);

 pinMode(button2, INPUT_PULLUP);

 pinMode(button3, INPUT_PULLUP);

 pinMode(buzzer, OUTPUT);

 pinMode(led, OUTPUT);

 

 myServo1.attach(3);

 myServo2.attach(5);

 myServo1.write(0);

 myServo2.write(0);


 currentButtonState1 = digitalRead(button1);

 currentButtonState2 = digitalRead(button2);

 currentButtonState3 = digitalRead(button3);


 Serial.begin(9600);

}


void loop() {

 digitalWrite(led, LOW);

 lastButtonState1 = currentButtonState1; 

 lastButtonState2 = currentButtonState2;

 lastButtonState3 = currentButtonState3;

 currentButtonState1 = digitalRead(button1);

 currentButtonState2 = digitalRead(button2);

 currentButtonState3 = digitalRead(button3);


 if(lastButtonState3 == HIGH && currentButtonState3 == LOW) {

  pickedIndex = random(0,3);

  Serial.println(angles[pickedIndex]);

  Serial.println("Happy Halloween!");

  digitalWrite(led, HIGH);

  myServo1.write(angles[pickedIndex]);

  myServo2.write(angles[pickedIndex]);

  delay(5000);


 }else if(lastButtonState1 == HIGH && currentButtonState1 == LOW) {

  pickedIndex = random(0,3);

  Serial.println(angles[pickedIndex]);

  Serial.println("Button 1 is pressed.");

  myServo1.write(angles[pickedIndex]);

  delay(5000);

 }

 else if(lastButtonState2 == HIGH && currentButtonState2 == LOW) {

  pickedIndex = random(0,3);

  Serial.println("Button 2 is pressed.");

  Serial.println(angles[pickedIndex]);

  myServo2.write(angles[pickedIndex]);

  delay(5000);

 }

 else {

  //myServo1.write(0);

  //myServo2.write(0);

  Serial.println("No buttons pressed");

 }

}

Preparing Mood-O-Lantern Faces

WhatsApp Image 2024-11-05 at 22.39.15_8ac24cc0.jpg
WhatsApp Image 2024-11-05 at 22.39.14_409beaef.jpg
WhatsApp Image 2024-11-05 at 22.39.13_ad336d4e.jpg
WhatsApp Image 2024-11-05 at 22.39.13_7b009a95.jpg
WhatsApp Image 2024-11-05 at 22.39.13_4f1dd307.jpg
WhatsApp Image 2024-11-05 at 22.39.12_eb54ea75.jpg

For this motor servo, 180 is the maximum rotation degree it can achieve, thus if you are looking for more faces, other motor servo or motor can be considered. Both the eyes and mouths are atttached to a cylinder like card to be attached to a round plastic cover connected to the motor servo.

Assembling

WhatsApp Image 2024-11-05 at 23.00.53_b625dd27.jpg
WhatsApp Image 2024-11-05 at 23.00.52_b7569a7d.jpg
  1. I first remove the eyes and mouth part of the pumpkin based on the face of the pumpkin.
  2. I then attached the motor servo to a reused plastic cover. One motor servo is placed on top of the pumpkin while the other motor servo is placed at the base. Each motor servo rotates independently to create randomized faces with more variations.
  3. I created orange colored cylinders using orange paper attached on cards to be placed around the plastic covers. The cylinder is filled with eyes and mouths of Mood-O-Lantern before putting it back inside the pumpkin.

P.S I used tape because I ran out of glue...Suggest to not use tape.