Introduction: Smart Skull

Picture of Smart Skull

Well, This is a fun project to make, and the spin offs and personalization make this fun for all.

Whats that? Well what exactly is it! I'm glad you asked! This is no ordinary skull, this is a singing, speech recognizing, message-able, portable, talking skull with charm named Calvin Cium, or Cal for short, get it?

Now don't let that deter you. This is cheap (under $150 US), fun and medium level difficulty build project using a raspberry pi and arduino and other stuff I had laying around (you'll probably have to buy some). The code varies in difficulty but i recommend being intermediate with python and linux systems.

And as said have fun with your own spin offs and feel free to tell me about them ( I'm really hoping someone does Handles from Dr. Who, I couldn't find a good CAD).

Right lets start!

Step 1: Get the Parts!

Alright, to play Dr. Frankenstein here we need to dig up some body parts, or rather just the head parts.

  • Brain: Raspberry pi 3 (need wifi) + Arduino Nano (optional but I used it)
  • Eyes: 2 LED's (i used multi-color RGB LED)
  • Jaw Muscles: Standard Servo
  • Bones: 3D printer and filament
  • Vocal Chords: 12 watt Speaker + Drok 5 volt, 8 Watt Audio Amplifier
  • Ears: USB microphone
  • Nerves: Regular Wires +female 3 pin (tail end of servo) Wires + male to male aux cable (short) + MicroUSB +Mini USB
  • Blood: 10000mah portable battery + Power supply (3 amp, 5v) (I used a spare switch powersupply and a drok buck converter)
  • Misc: Main Line Switch, male end power cord, thick wire (2-4 mm, 8 ''), PVC pipe, box, dc barrel plug and jack, paint, screw bottle top and cap (feel free to customize, or find alternatives for these parts)

This is a lot, but don't let it get you down. There are lots of alternatives, I just recommend you look for small stuff. I will explain the purpose of each part when I install it so you can choose alternatives, most of this I collected over many years so I put it to use rather then buy.

Step 2: The Bare Bones of It

Picture of The Bare Bones of It

I printed this in 6 different parts, There are 5 CAD files (I sliced one into two to fit my printer and I kept knocking the teeth out so the split was fortunate). Right of the bat I want to thank Dantana for the great CAD files. The link to thingiverse and the files is https://www.thingiverse.com/thing:819046 . Feel free to find others, but the key is an empty cranium. Then print and wait. I also recommend printing the bottom half of a pi case. Any will do and keep it to the side for now.

I recommend hot gluing the pieces together now (NOT THE SKULL TOP) and molding the hotglue to smooth over the seams.

Next paint. Regardless of the filament color I recommend painting it (spray paint works, but by hand is a lot better) I went for white because I like a white skull over a more realistic color.

With hindsight I also advise you know to put pins or strong small magnets in the skull to hold the top part of the skull in place. The part that you didn't glue, right, RIGHT? I put pins in the front and back, as shown in the images with the holes being in the top part. Magnets take more space so if you use those put them on the sides.

To put the jaw in i used a paperclip and made a small hole in the jaw. The 4th pic shows this on the jaw's left. then hotglue the paperclip in the inside of the skull. This is the hardest part and requires a lot of patience because its hard to see and in a small crevice. Refer to the 5th picture to get an idea of the positioning. The jaw should now move freely.

Finally the bottle cap. Put a hole for 2 wires in it and glue it excessively in place, (trust me there's a reason teeth kept getting knocked out). Place it in the bottom of the skull where the spine would connect. This is the connection to the charging station and base. Put 2 wires for power through the hole so there is about a 1.5 ft inside and 3 in in the cap outside and glue it in place. (No pics of this b/c hindsight)

That's it now you got the bare bones of it.

Step 3: Jaws

Picture of Jaws

Time to give this guy some bite. Get a servo and that thick wire. The servo moves the jaw by pulling the wire back and forth which is connected to the back of the jaw. In the first image you can see the servo connected to the wire at the bottom of the skull. The next two images show the wire painted white and where it enters the skull and connects to the jaw.

Drill a hole in the jaw near the back and bend the wire in a z like shape, but perpendicular. Then thread it through the skull and attach it to the jaw through the hole. A blob of solder on the end will keep it from coming out. Next attach it to the servo and position it at the bottom of the skull. try to keep it as flat to the bottom as possible and make adjustments as necessary. Try turning the servo before you glue it to the skull and bottle cap to make sure you get the desired range of motion. The more glue on the cap the better.

Step 4: LED Eyes

Picture of LED Eyes

For this get your LEDs and wires. If you desire RGB LEDs I recommend the 3 pin female wires from an old servo. Put the 3 pin wires and a single regular through the oracular nerve cavity in the skull with the jack ends inside the skull. Then solder the color led pins to the three wires and ground to the single. Do the same for the other eye and connect the grounds, that's all.

At this point you can pull the wires to get the LEDS further back into the oracular cavity and glue it there. Feel free to paint the wires outside now to make it look better.

Step 5: If I Only Had a Brain!

Picture of If I Only Had a Brain!

Now one can put in the rpi. Before that I recommend you solder wires to the 5v and ground on the bottom of the pi. and leave about a foot loose. Now make a small hole in the case and put the pi in with wires coming out of the case. Place the case on the servo or as low down as you can get it and glue it in place. Now you can connect the wires of the eyes to the pi and the servo too.

I had problems getting the servo to work on the pi and startup problems too, so i got an arduino nano and attached to the pi with a usb cable, and connected the servo to that. In the first image you can see the two servo cables are actually the LED eye cables and the black wire in the middle is ground the red wire is power to the arduino nano (redundant). the green wires connect to the power of the audio amp (to be mentioned later).

In the second picture you can see the power cable from the cap and the pi power wires (both red and black coiled) the stripped down spark-fun micro cable (red usb) (saved room) connecting to arduino nano. The servo is soldered to the nano

In the third picture you can see a mess of wires connected to power (the green screw jack) including the power of the servo. The servo is connected to the nano pins (black connector).

NOTE: Wires become quite a mess with so many components, twisting and labeling help but it still is a mess.

Step 6: Ears for 'earing.

Picture of Ears for 'earing.

Well, he doesn't actually have ears, rather, the microphone is ah, stuck up his nose (see pic 1, the black spot at the top). I got a usb mic and stripped it so all it was was a usb wire and a microphone on a circuit board (pic 2) I then desoldered the microphone and soldered longer wires to it. I ran the wires up his nose into the brain area and re-soldered it to the circuit board. Then i glued the mic inside the nose were no one could see it, the further from the electronics in the cranium the better. and plug it into the rpi (clear plastic usb under dongle in pic).

Thats that.

Step 7: Robots Deserve a Voice

Picture of Robots Deserve a Voice

Right. In order to hear Calvin speaking across the room I chose an 12 watt speaker, a bit big, but i made it fit. I also put tape for insulation. I bought a 8 watt drok audio amp from amazon (pic 2), set it to max and wired it up. This amp runs of 5v so, make sure you get one that runs on 5v since that's your only voltage here! Connect to pi audio out with aux, you may need to solder a audio jack or just cut, strip, and solder the aux cable.

Dont worry if its too loud, or a bit too quiet. there are programs that help boost volume on pi and the skull cap will muffle it a bit.

Step 8: Energize

Picture of Energize

Time to give it it's life blood. There is no fancy wiring to the battery pack, charging itself is ok. I took mine apart to make it fit, it is a bit old so bigger than today's 10000mah. Then all positives and all negatives connect respectively, including the cap. Then in the cap you can solder a dc jack or plug, your choice.

Then just plop it on top. Organization of this stuff is really done on a case by case basis depending on how things fit. I didn't glue this because I couldn't and tried multiple orientations. In the end i glued the speaker to the battery pack and it fit well (pic 3/4).

Step 9: Charging Station

Picture of Charging Station

Alright, this is it's stand, its home so make this look good. I just got a box put a 24v 8 amp switch power supply and connected it to a drok buck converter set to 5.2v. This crazy power supply is so it can charge, speak, and run at the same time. expect a peak draw of 3.5 amps and you'll be good. You can put 2 pi power supplies together for 5 amps. you might be able to get by with just a single rpi power supply, but I like to play it safe. I then glued excessively a pvc pipe and the top of a bottle and painted it white. I ran the wire up and attached the complimentary jack or plug depending what you do and called it a day.

Like i said make it pretty, pink duck tape and a nice plaque with its name and it's done.

Now you can screw your skull on and have it charge.

Step 10: Setup Pi

Picture of Setup Pi

Right now. Your robot companion is almost done now to set up the os and programs.

So the basic is to get it auto connect to wifi, ssh capable, default aux out, not hdmi.

Test speakers. make sure that all works.

The Coding here can become quite complicated, but i'll walk you through some of it.

start by installing the folowing

sudo apt install espeak festival sox mpg123 ffmpeg (speech synthesis and audio manipulation)

sudo -H pip install fbchat (fb client so you can msg it)

Step 11: Startup Scipt

So we want it so that whenever it restarts it auto runs the main script.

  1. make a main script
    1. cd ~
    2. sudo touch runSkull.sh
  2. set up self startup
    1. sudo nano /etc/rc.local
    2. add the following
    3. export AUDIODEV=hw:1,0 # set default audio out to aux
      exec 2> /tmp/rc.local.log      # send stderr from rc.local to a log file
      exec 1>&2 # send stdout to the same log file set -x # tell sh to display commands before execution _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" python /home/pi/IPStartup.py # Script sends IP addr to me every startup via messenger hostname -I | festival --tts # speak IP addr (optional) bash /home/pi/runshull.sh & # auto start script fi exit 0

Step 12: IPStartup.py Script

This Script automatically sends me the IP addr during startup.

Type :

cd ~
sudo nano IPStartup.py

#IP Startup Script

# Created by Wolfgang Huber 1/13/2017

import fbchat
import socket

import netifaces as ni ip = ni.ifaddresses('wlan0')[2][0]['addr'] # get ip addr as string

client = fbchat.Client("username", "password")

friends = client.getUsers("My Name Here") # return a list of names friend = friends[0] sent = client.send(friend.uid,'IP: '+str(ip)) #send msg if sent: print("Message sent successfully!")

Step 13: Main Script

The main script is above with its dependent library.

They do a lot of things which i wont explain to too much detail.

FBScanner runs in the background and constantly looks for msgs, storing them in a file.

Action Processor processes those msgs for commands like to sing(play mp3) download youtube audio, say a phrase, change eye color and volume and voices.

Skull.py actually updates the skulls states dealing with the IO.

There are many files that dealing with manipulating info, audio, and more.

This project can be scaled incredibly so it can do so much. Speech recognition is done with julius, or snowboy. A tutorial on that can be found on http://kamilskowron.pl/en/linux/julius-step-by-ste... who does a great job on setup for julius on pi.

Step 14: All Code

Picture of All Code

The coding on this project is extensive, confusing, and definitely advanced for all the bells and whistles. But for simple stuff like speaking words and eye color the previous scripts will do with a few bugs naturally with your own mods and getting the necessary packages installed.

For those of you who want all the dice I give you all the code and work which definitely can be improved on. Its up to you to explore the code and all the details and comments. And get pulseaudio, also and mics to work (nightmares will ensue, but so worth it).

Have Fun!

Ill do my best to answer comments below, and share!

Comments

DIY Hacks and How Tos (author)2017-05-21

That is awesome! Something like this would make a great project for people learning some of the more advanced things that you can do with microcontrollers.

About This Instructable

765views

13favorites

License:

Bio: Robotics, Art, Electronics, programming, and physics enthusiast.
More by Wolfgang Huber:Pepsi BirdSmart Skull
Add instructable to: