Dragon Guarding Treasure - Useless Box Mechanism

by Booo in Circuits > Arduino

558 Views, 3 Favorites, 0 Comments

Dragon Guarding Treasure - Useless Box Mechanism

FY3RTB3LUQYPRP5.png
Final concept .png
Sketches.png

This is my first ever arduino project and was made for a college assignment.

For this project, we had to create something with arduino that was interactive. Besides this, I wanted to create something that was fun while also challenging myself by crafting something that's 3D and looks nice.


Concept

For my concept, I decided I wanted to do something with a dragon. After some research and a show case of the professor, I got very interested in eye mechanism projects for the arduino. Which led me to a dragon that could open and close an eye while it is guarding it's hoard, but I wasn't sure how to really bring it together and make it interesting and interactive. After some puzzling and more research, I remembered the "useless box", this is a small box with a switch on the outside, that closes itself after you flip this switch. Being inspired by this, I wanted the dragon to close it's treasure chest by itself. I wasn't sure how to execute this yet and passed quite a few ideas for how the dragon would achieve this, from a moving claw or even tongue, but landed on the dragons tail in the end. To give it even more personality, I added variation to the speed that the tail and eye move.


All this eventually led me to my final concept: a sleeping dragon surrounded by its treasure hoard guarding a chest. Inside the chest, the gold shines brightly with the help of some LEDs, but once you reach your hand inside, the creature awakes! The dragon opens it's eye and the lights turn red, before it slams the chest shut, better luck next time!

Supplies

Arduino components.png

This is everything you'll need to make your own sleeping dragon! An additional visual representation of each component for the arduino is provided above, for easier identification if you wish to make one yourself.


Components needed for Arduino:

  • 1x Arduino Uno
  • 1x Breadboard for testing
  • 1x Solderable breadboard/Perfboard
  • 1x PIR motion sensor
  • 2x Mini servo
  • 4x 220Ohm resistor
  • 4x LED (I used orange, yellow and 2x red)
  • Jumper cables, mount may change based on the scale of your project


Materials:

  • Cardboard (a lot of cardboard)
  • Masking tape
  • Air dry clay
  • 1x Small hinge
  • 3x Wooden skewer
  • 1x Paperclip or (iron) wire
  • PVA glue
  • Napkins/toiletpaper
  • Joint compound/plaster
  • Acrylic paint
  • (Chocolate) coins
  • 3D printer filament


Tools/ equipment

  • Soldering kit
  • Hot glue gun
  • Exacto knife and/or scissors
  • 3D printer
  • Paint brushes
  • (Clay sculpting tools)
  • (Cutting mat)

Testing and Soldering

IMG_3517.png
IMG_3595.png
IMG_4639.png
IMG_4637.png
IMG_4748.png

I spent quite some time testing all sorts of different parts and combinations. I started simple with the lights and slowly added more to that, like the mini servo's and eventually the PIR motion sensor. Once I had my final circuit, I soldered it all together on a solderable breadboard.


Iterations / obstacles

I had some trouble coming up with a way to trigger the circuit. Initially I wanted to incorporate the switch button into my design by hiding it in some way inside or at the back of the treasure chest. After a lot of puzzling and a bit of testing, I came to the conclusion that this wouldn't work smoothly enough for what I had in mind, so I had to find another way. I came back to my ideas of using a light sensor or a pressure sensor, but since I wanted to add LEDs inside the chest and I preferred if the circuit activated after someone reached into the chest and not by just opening it, I let go of those option too. I did some more research and found out about PIR motion sensors, which was just what i needed.


Further on in my process I was thinking of adding a DFP Mini MP3 Player, which would play a dragons breathing sound while in rest and once activated, a dragons roar or rumbling. Unfortunately I had to scrap this idea due to time constraints, but I think it would've added a lot to the experience.

Final Circuit

Scherm­afbeelding 2024-03-29 om 15.22.19.png

With all the testing done, I had my final circuit and code. I added 5 different sequences for the movement of the eye and tail, to give the dragon a bit more personality.


#include <Servo.h>


int pirPin = 12; //pin of PIR Sensor


int servoPin1 = 11; //pin of tail Servo
int servoPin2 = 10; //pin of Lid Servo


int ledPin1 = 9;
int ledPin2 = 3;
int ledPin3 = 5; //red LED for in the chest
int ledPin4 = 6; //LED for inside the eye


int motionStatus = 0; //variable if PIR sensor detects motion or not
int pos = 0; //position servo


int action = 1;


Servo tailServo;
Servo lidServo;


void setup() {
  Serial.begin(9600); //initialize serial monitor 
  pinMode(pirPin, INPUT); //the Pir Sensor gives information, hence input


  tailServo.attach(servoPin1);
  tailServo.write(0); //starting position of the tail servo


  lidServo.attach(servoPin2);
  lidServo.write(90); //starting position of the lid servo


  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);


  delay(2000); //PIR sensor needs time to callibrate, ideally 10 seconds to a minute


void loop() {
  motionStatus = digitalRead(pirPin);
  
  analogWrite(ledPin1, random(120)+135); //flickering/candle light LEDs for in the chest
  analogWrite(ledPin2, random(120)+135);
  delay(random(100));


  if (motionStatus == HIGH) //action sequence, starting with action 1 up to 5, from 5 back to 1
  {
    if (action > 5 ) {
      action = 1;
    }
      if (action == 1) {
        action1();
      }
      else if (action == 2) {
        action2();
      }
      else if (action == 3) {
        action3();
      }
      else if (action == 4) {
        action4();
      }
      else if (action == 5) {
        action5();
      }


      action += 1;
  }
  
}


void action1() {
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);


  lidServo.write(20);
  delay(1000);
  tailServo.write(178);
  delay(500);
  tailServo.write(50);
  delay(1000);
  lidServo.write(90);
  delay(1000);


  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
}


void action2() {
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);


  lidServo.write(50);
  delay(100);
  tailServo.write(178);
  delay(250);
  tailServo.write(50);
  delay(100);
  lidServo.write(90);


  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
  analogWrite(ledPin1, random(120)+135);
  analogWrite(ledPin2, random(120)+135);
  delay(random(100));
}


void action3() {
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);


  for(pos = 90; pos > 20; pos -=1) {
    lidServo.write(pos);
    delay(100);
  }
  tailServo.write(178);
  delay(250);
  tailServo.write(50);
  delay(150);
  lidServo.write(90);


  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
  analogWrite(ledPin1, random(120)+135);
  analogWrite(ledPin2, random(120)+135);
  delay(random(100));
}


void action4() {
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);


  lidServo.write(50);
  delay(100);
  tailServo.write(155);
  delay(250);
  tailServo.write(50);
  delay(100);
  lidServo.write(90);
  delay(250);
  lidServo.write(50);
  delay(150);
  tailServo.write(155);
  delay(250);
  tailServo.write(50);
  delay(100);
  lidServo.write(90);
  delay(250);
  lidServo.write(50);
  delay(100);
  lidServo.write(90);


  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
  analogWrite(ledPin1, random(120)+135);
  analogWrite(ledPin2, random(120)+135);
  delay(random(100));
}


void action5() {
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(ledPin3, HIGH);
  digitalWrite(ledPin4, HIGH);


  delay(250);
  lidServo.write(50);
  delay(100);
  tailServo.write(178);
  delay(2500);
  for(pos = 178; pos > 90; pos -=1) {
    tailServo.write(pos);
    delay(100);
  }
  lidServo.write(90);
  tailServo.write(50);


  digitalWrite(ledPin3, LOW);
  digitalWrite(ledPin4, LOW);
  analogWrite(ledPin1, random(120)+135);
  analogWrite(ledPin2, random(120)+135);
  delay(random(100));
}

Moveable Parts

IMG_4353.png
Moveable parts.png

Tail

For the tail of the dragon, I wanted something that could move smoothly, but was also strong yet light enough to close the chest. So, I opted for 3D printing the tail. Making the tail with cardboard, paper marche or clay is also definitely an option, but it might not have the same durability I achieved with the 3D model and it would've taken more time.

I edited the 3D model, however, the model ended up having a small problem: it had some unintentional empty space inside the base. With a bit of help from a teacher I managed to print it after all, though smaller than I would have liked. The 3D model is linked below, but if you want to make this dragon yourself and have access to a better model, use that instead.


Eye

The eye I made by using air-dry clay. I shaped a ball roughly the size that i wanted, hollowed it out a bit and with a knife I cut a slit down the middle. The slit down the middle is to let light from a LED through later on. Then I rolled out a bit of clay to create the upper eyelid, shaped it the way I wanted and add some details. After I placed them in the position I wanted them to be in the end and I pierced both parts with a small skewer from one side to the other, making sure the clay doesn't dry on the skewer so the eye can still move. I made sure to leave enough space between the eyeball and the eyelid, so they don't get stuck when moved.


Painting

I painted both parts the color that I wanted them to be. For the eye, I painted the inside of the eyelid black and the outside the color of the dragon.


Attaching to the servo's

(See picture above)

I attached the servo to the tail using two small skewers cut to size and hot glue, making sure it's really secure. For the eye I used a small pice of wire, looped through the very last hole of the servo (don't glue it to the servo, this part should be able to move) The other side I attached to the top of the lid with glue and a small piece of cardboard because it kept sliding off.

Downloads

Making the Treasure Chest

Chest measurements.png
Scherm&shy;afbeelding 2024-03-30 om 10.59.12.png
Scherm&shy;afbeelding 2024-03-30 om 11.21.15.png
Chest.png
Scherm&shy;afbeelding 2024-04-04 om 14.12.31.png

For making the treasure chest I loosely followed this video: DIY Chest from recycled cardboard


Making the base

1) I cut out the following pieces from cardboard:

  • 1x 15 cm x 10 cm (bottom)
  • 2x 15 cm x 8 cm (front and back)
  • 2x 10 cm x 8 cm (sides)
  • 2x 10 cm x 5,5 cm, cut like a half circle (sides from the lid)
  • 1x 15 cm width, the length should be able to wrap around the half circle sides of the lid.

2) Glue the pieces together with a hot glue gun.

3) I used a small hinge instead of a longer piece of cardboard, because my first chest didn't close all the way and the cardboard was too stiff to open and close smoothly. I simply glued the hinge on the backside with hot glue.

4) Cover all the edges with masking tape.

5) Cut strips of cardboard that are roughly 2 cm in width and glue them on the chest.

6) Cut a hole on the right side of the chest, around 1/3 from the bottom side.(this is where your PIR sensor and LED wires will go through). Glue a small piece of cardboard above the hole, to both cover it up and to avoid making the PIR sensor react to the movement of opening the chest.

7) Mix PVA glue with water, I used a 1:1 ratio. Separate the napkins, cover the chest with them using the glue mix.

8) Once dry, cover the chest in a thin layer of plaster and carve a wood pattern in it while still wet.


Painting

8) Paint the chest fully black, let dry.

9) Paint the chest again with a brown color, but don't get into all the little crevices.

10) Dry brush the chest with a lighter brown paint to bring out the details

11) Paint the inside of the chest.


Details

I made a small locket for the chest with air-dry clay. I painted this black once dry, airbrushed them with a golden paint and glued them on the treasure chest.

Making the Dragon

Dragon process.png
Dragon head.png

Making the base

1) Cut out the "spine" of the dragon from a big piece of cardboard, this is basically the middle of your dragon and will determine the height. Form it in the shape you want.

2) Cutting long strips of cardboard, glue them on the top side of the middle piece and the bottom side, making half circles and creating the base shape of the dragon.


The head

3) For the head, cut two identical pieces roughly in the shape you want the head to be. Cut a third piece for in the middle, making it slightly higher at the top, without the spikes and a little longer on the end so it'll be easier to connect it to the neck.

4) Glue 2 small scrap pieces of cardboard on top of each other. Do this twice.

5) At the end of the nose, sandwich the thick scrap pieces of cardboard between the side pieces and the middle piece of the head (see picture) and glue together.

6) Taking two short strips of cardboard and fit them between the side pieces and the middle piece to determine the width of the head, glue them.

7) For the top of the head, cut a piece of cardboard to size. Mark where the middle piece of the head would touch this top piece and cut out a hole, so it'll fit as a lid on top of the head.

8) Cut out a hole where the eye will be, make it bigger than the eye will eventually be (I ended up cutting a lot more out). Also cut a hole in both the middle piece and the other side of the head where the wires from the LED and Servo will eventually go through.

9) Cut out some pieces of cardboard to give the face some shape, this doest have to be perfect but it'll be a good base for the clay later on.

10) Attach the head to the rest of the body with glue.


Finishing up the body

11) With the base of the dragon done, I filled the inside with old newspaper. This isn't necessary but I wanted a little more support.

12) Cover the whole dragon with thin pieces of cardboard or thick paper, cover any ridges with some tape (An alternative for this step is covering the whole dragon with tape and covering it with a thin layer of paper marche afterwards).

13) Cut cardboard in the shape of scales in various sizes and cover the spine with them.

14) Cover the whole dragon with a thin layer of plaster/joint compound, let dry.


Adding the eye

To add the eye to the dragon, I placed the skewer where the eyelid and eyeball are on, on the outside of the face and glued it on. I pulled the LED wires through the holes I made before and placed it just behind the opening of the pupil. I glued the servo for the eyelid in place, just to make sure it wouldn't move around when the dragon is picked up.


Adding the tail

To add the tail, I first had to determine the right position. so it would be able to reach the chest and close it properly. After I did that, I made a small tube of cardboard to hide the servo, and I glued the cardboard on the dragon.


Details

With air-dry clay, I added some final details. For the face, I covered the skewer of the eye, gave the dragon it's under eyelid and added the lip line with some teeth poking out. Besides that, I made some claws and covered any holes around the tail without hindering it's movement.


Painting

I painted the dragon green, with it's belly, the scales along its back and the spikes on its head a slightly lighter green. For the teeth and nails I used a beige color. I also painted some of the wires so they wouldn't be as noticeable, but make sure you can still see which wire is which.


And with that, the dragon is complete!

Final Result

IMG_5375.png
instructablevideo

Conclusion

I learned a lot of new things during this project, it was my first time using the arduino, 3D printing and soldering. These are some skills that I think will come in handy and that I'll definitely use again. Looking back, this project took a lot of time, way more than I initially thought it would take. Along the way I constantly had to adjust and make changes or fix things, which isn't a problem of itself but this in combination with deadlines from other classes made the last few weeks/days really stressful and the final product incomplete and things to break (the eyelid servo stopped working as you can see in the video). This also caused me to not be as happy with the end result as I had hoped.

But all in all, I unexpectedly had a lot of fun during this project and I surprised myself with what I can do.


Thank you for reading!