Arduino Controlled Object Following Halloween Skull

by procrastination in Circuits > Arduino

206 Views, 2 Favorites, 0 Comments

Arduino Controlled Object Following Halloween Skull

thumbnail.PNG
skull.PNG
20241110_141444.jpg
20241110_141455.jpg
20241110_141505.jpg
20241110_141449.jpg
Arduino Controlled Object Following Halloween Skull

This project takes a $5 skull from Target and makes it a much more interesting Halloween decoration!

Supplies

For this build, I mostly used parts that I already had on hand. The design could be simplified and consolidated if I had used different micro-controllers. Here is the list of items that went into the build.

Material Supplies:

  1. Plastic Skull
  2. Convex Lens
  3. Acrylic Base
  4. Wood Piece for mounting
  5. Glue gun
  6. Glue sticks
  7. Acrylic Paints and brushes
  8. Gauze bandage
  9. Drill and bits
  10. Box cutter

Motion Following Electronics:

  1. 1 Arduino Uno
  2. 2 Ultrasonic Sensors
  3. 1 HS-422 Servo
  4. 2 UV LED
  5. 2 30-100 Ohm resistors
  6. Many Jumper Wires

LCD Screen:

  1. Arm Mbed LPC1768
  2. µLCD-144-G2
  3. SD Card

Wire Up the Hardware

lcd-circuit-diagram.PNG
arduino-circuit-diagram.PNG
resistor-specs.PNG

Using the circuit diagrams above, wire up the hardware as shown onto a breadboard. If you are going to mount this directly, make sure to use long wires to give yourself plenty of slack.

When the jumper on the back is removed, the ultrasonic sensor acts like an HC-SR04 with a trigger and echo pin. When the jumper is in place, you use 9600 baud UART to communicate with the sensor. We will be using it in the HC-SR04 mode.

To calculate the resistor size, I used the values given from the product page and entered them into a LED calculator. It doesn't need to be exact though. Anything around the calculated size will work. It will just change the brightness and longevity of the LEDs.

You should power your circuit from an external power supply, as trying to use the Servo with the USB connection can damage your Arduino. I used a power adapter to power the Arduino UNO in addition to the USB port.

Prepare the SD Card

eye-bigger.gif
Format GIF1.PNG
Format GIF2.PNG
Format GIF3.PNG

This LCD is a bit strange in the way that it stores data. You need to use their software, as specified on the datasheet because it requires an unformatted uSD card with the RAW image and video files. You can download their IDE here. Specifically, you need to use the Graphics Composer 3 software tool.

Find a GIF you want to play on the screen. I used the eye GIF that I have attached here. Next open up Graphics Composer 3 and perform the following steps:

  1. Click add to find the GIF on your computer.
  2. Change the screen size to 128x128
  3. Save to generate a file required by the program. It should look like this:
// Movie - "eyes.gif" Size 128x128
// Width = 128
// Height = 128
// Frames = 13
// Usage: eyes.gif(x, y);
#constant eyes.gif $media_SetSector(0x0000, 0x0000); media_Video

The sector and offset need to correspond to the values in main.cpp for:

uLCD.set_sector_address(0x0000, 0x0000);
  1. Finally, flash the data to your SD card.

When you start the mbed, it should play the file specified. For more details on the LCD, check out this wiki page.

Write the Software

Skull Testing

The object following code comes from this instructable. The latest software that I used can be found here. The code for the LCD is only the main function. To get all of the libraries needed go to the GitHub page linked above.

Install the Arduino IDE and copy in the code for the motion following. Connect the Arduino UNO to your computer via USB and flash the software.

Depending on your setup, you will want to modify the variable for the max distance it detects in motionfollow.ino

int threshold = 50; //Sensor threshold in inches

I used 50 inches and it worked well for me.

For the MBED micro-controller, I used keil's online editor and compiler. Download the project, import it into keil and upload it to the MBED.

If your flashed the SD card correctly, you should see your image playing and the skull should be following you.

Prepare the Skull

20241028_204708.jpg
20241029_101830(1).jpg

Cut out a large circle in the back of the skull to give access to the head cavity where you can mount the electronics.

Using your box cutter, cut a circular hole in the forehead of the skull to fit the Convex Lens, with enough room to mount the LCD screen behind it vertically or horizontally. Hot glue the lens onto the hole as well as the LCD behind it.

Cut two small slots in the eye cavity to route the wires from the ultrasonic sensors to the inside of the skull. Hot glue the ultrasonic sensors to the face and where the wires go into the eyes.

Drill two small holes to mount the UV LEDs under the eye cavity. I didn't make them to fit the LED, but just made it so they could shine up through it. I routed and attached them to the inside of the skull.

Drill two small holes through the bottom of the skull in the mouth area. Attach the servo to the skull with a zip tie routed through these holes and around the servo.

Finally, attach the servo to the acrylic base and the base to the piece of wood to give it extra stability.

I placed all of the electronics on breadboards to test, hot glued all of the connections to keep them stable and then mounted everything in the skull cavity. It became quite the ordeal. If I was doing this over again, I would probably make a PCB or leave the electronics out of the skull.

Finish the Skull (Optional)

20241110_141449.jpg
20241110_141505.jpg
20241110_141455.jpg
20241110_141444.jpg

At this point, you should have a working object following skull. To hide the ultrasonic sensors, attach the gauze bandage around the eyes. Some gauze materials will impact the Ultrasonic sensors, so it will require some experimentation. The paint can't be too thick, as it will also interfere with the sensors. You can go back and poke holes in the paint if it is an issue.

Paint blood coming from the eyes and forehead. To make it even more lifelike, paint the skull to give it depth and texture.