This project was a side project while working on a giant spider with a friend. However while he was working on fibreglassing the spider I decided to learn coding and the Arduino. I never intended to this to be an Instructable in the first place so what follows is more of a deconstructable but I think that it gets the stages sorted. Please bear with me if this is a little choppy as it's my first go at this.
Below are 2 videos of the skull working. The top shows the eyes triggering and then following. The bottom shows it in daylight showing how it works. Apologies for the lack of steadicam :-)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts List
1x Resin life size skull – the more realistic in size the better.
1x PIR Motion Sensor HC-SR501
1x I2C 16ch Servo Driver Board (PCA9685)
UV Portable Handheld UV light (Strip)
Table Tennis Balls.
2x 3mm low profile LED (red – straw hatted)
Voltage Regulator LM2596
2x HC-SR04 Ultrasonic Modules
5V 2A Mains AC Adapter
2x Futaba S3003 Servos
8Ch 5V relay module
Arduino Uno (R3) with breakout board (Nokia 5110)
1 tight fitting box.
1x9V PP3 battery and connector
1x DC power plug / socket 12v 5.5x2.1mm
Step 2: Skullduggery
Well - actually more like skullcuttery. The resin skull is important as it will be built well enough to take what we're about to do to it. The first step is to remove the bottom portion of the rear of the skull and half the rear. As you can see from the photo it's not a precise art. The idea is to maintain the shape of the top of the skull and the sides, but leave as much open to get to the insides as possible. This was done with a dremel equivalent with a cutting disk on it. Be aware that there will be a very large amount of dust produced by the cutting so respiratory protection is a definite must. Some form of dust extraction would also be good.
The skull I was using had all the bones at the back of the eye present too so these have to be removed. You meed to be sure that you chop as much as possible from the back of the eyes but wthout getting too close to the front to spoil the effect of the boney ridge. Don't worry about the light coming through the back of the skull, this will be dealt with later.
I also highlighted parts of the skull with UV reactive make-up. This will help it to stand out when everything is in its final position.
Step 3: Eye See You
We now need to start sorting out the eyeballs. For this we need the ping pong balls. The eyes don't need to be too detailed as they will be internally illuminated. All you really need is a pupil and the outline of some veins in the eye. Black will be best even for the veins. A standard Sharpie works well here as it absorbs very nicely into the surface of the ball.
Once the eyes are coloured in, they need two holes making. I made both of them with a 3mm bradawl. One hole needs to be at the back opposite to the pupil. the other half way between them.
Secure the eyes to a worksuface so that the middle hole is pointing upwards. Take the circular adapter that comes with the servo set and glue this directly over the hole in the eyeball. For this I used Gorilla Glue. The reason being that it expands when curing and so it goes through the hole in the bottom of the eyeball and helps secure it. Remeber to dampen all the adhesive surfaces first to aid in the curing process. Leave overnight to cure.
Step 4: Soldering On
Time to break out the soldering iron and try not to get those fumes in the eyes. Firstly, carefully take apart the UV light and solder two flyleads instead of the switch. Reassemble with batteries and check that it lights when the ends are connected. Next solder up the voltage converter to the PP3 battery clip and then run a lead to one side of the 12v socket and the other to the other side via a longer cable that is cut in half and the ends stripped.
Solder a set of flyleads per LED and connect them in parallel at the plug half of the 12v set. Don't try these in series, it's more hassle than it's worth trying to stop the cable being tangled in the back of the skull. Put them into the back of the eyes and glue them in.
Step 5: Servoing Up
Put the now set eyes on the spindles of the servos and offer them up to the eyeholes in the skull. Mark the location of the servos so the eyes are as dead centre as you can get them. I used wax pencil as it's very good and easily removable. Remove the eyeballs and glue the servos in the skull. I like epoxy for these but I would suggest gluing one at a time and clamping until dry. N.B. make sure that the glue does not get attached to the clamp. Had to bodge fix one of the servos with Gorilla Glue as managed to glue to the clamp rather than the skull. Oops.
Step 6: Wiring Loom / Coding / Test Bed
There is a lot of 5v power required for this - total mA well within the limits of what the Arduino can provide but it's lacking in the power points. Fortunately the breakout board has an ample amount of 5v and ground pins.
There is nothing complex with the wiring, The SDA and SCL connections are on pins A4 and A5 respectively. There is no need for a direct PWM connection from the board as this is all taken care of by the servo board itself.
It's worth using a good colour scheme in cabling if you have the ability to do so to be able to quickly identify the cables, especially the Trigger / Echo pins from the ultrasonics. You will get some very difficult to pin down errors if you get one right and one wrong. It's always useful if you get stuck to use the Serial.println code to return back to the computer what the ultrasonics are seeing. I used distance1 / distance2 to show what the ultrasonics were seeing; if one doesn't return a value, switch cables and try again. I would also suggest labelling the ultrasonics so you know which is which in the final build. You will get eyes running in reverse if you get that wrong.
The values for the servos in the attached code are purely for the Futaba servos mentioned. If you use different servos you need to check the lower and upper values of the servos and calculate these into the code.
Once you have the components up and running on the test bed, check the servos move in twin to the direction that you are moving. The PIR for auto on/off on detection is a niceity but not necessary dependent on your setup. I chose to have it trigger when a point was reached but this could be any trigger you choose really; remote control, PIR, pressure mat etc.
I have included the arduino sketch as an attachment. One thing I haven't mentioned which is pertinent here is that there is a smoothing loop in the code for the tracking. I found that without it the eyes were too jittery. They are smoother with the loop but less responsive. It's probably worth fiddling with it to adjust to your likes / situation.
Step 7: Animated Skull Assemble
I painted my box black and installed all the components therein. The UV tube I placed at the top, mainly blacked out with electrical tape so it was invisible within the box. After running the wiring from the skull through the back of the box I then sealed it up with more electrical tape and put all the electrics behind the box covered with a black sheet. The ultrasonics were sited in the wings of the front of the box which were held at very slightly under 90 degrees to make the eyeball response as good as it could be. The PIR was mounted on the top blacked out again with tape as I had run out of time.
The final presentation is the best way to customise the skull. I can think of many different ways to do this and hopefully if you like this Instructable and make your own, you might comment with a picture as I would love to see them.
Participated in the
Halloween Decor Contest 2015