Talking arduino Halloween skeleton

Hello. Newbie here. I am working with an arduino uno using the instruct able for a talking skeleton. By chance has anyone seen the sketch written with the latest library rather than the initial AF_wave? Thank you in advance!

Hi there. I have not seen the sketch yet for this. I too was trying to follow that same instructable. from . i could not get a reading off the resistor he said to put a wire from the resistor to analog 1 pin. I had to use the reading from the output of the 3.5mm headphone jack off the adafruit waveshield. What I ended up doing was using 2 microcontrollers since the one microcontroller used could not run the servo library due to timer problems. So with that said... if you need any information message me or comment on here.

Microcontroller one: loaded with the adafruit waveshield code and library's and uploaded to arduino waveshield attached to arduino two wires off the output pins of the 3.5mm jack---- signal wire out or + and ground. (you can figure this out by using a dmm while the waveshield while the shield is on and playing with no speaker hooked up. if the leads are reversed you will get negative number on the dmm when the positive probe is on the negative ground lead of 3.5mm jack. The positive is the first pin looking the long way on the waveshield on the side with the 3.5mm jack and the negative is the far right pin (not sure better correct me on that one.)). Microcontroller two: loaded with servo code and library and uploaded to arduino servo attached to one of the pwm pins. (I used pin 9) The other 2 pins to ground and power. + signal pin from waveshield 3.5mm jack from Microcontroller one to the analog pin 0 on microcontroller two. Negative ground wire from 3.5mm jack to 1k resistor to ground. (I used the ground on Microcontroller two. Not sure if all grounds can be connected together from microcontroller one to microcontroller two.

Turn both arduinos on with the uploaded codes and watch read the serial analog pin in the serial monitor. make sure you are not getting a solid number or a jumping high number. it should move along steady with high number and low numbers based on sound level. You can tweak with the code a bit to get it to work with your servo.

Power up both controllers and watch the mouth move to sound. I could not really find away around this and this really works quite well. Not sure if its the best way but it works for me.

the code for microcontroller 2;

/* Skull
created 2011
by Boris Landoni

This example code is in the public domain.


#include <Servo.h>

Servo myservo; // create servo object to control a servo

int SoundPin = 0; // analog pin used to connect the potentiometer

int LedPin = 13;

void setup()

myservo.attach(9); // attaches the servo on pin 9 to the servo object

pinMode(LedPin, OUTPUT);

void loop()
int sound = (analogRead(SoundPin)*8);


int LEDValue = map(sound,0,1023,0,255);

analogWrite(LedPin, LEDValue);

if (LEDValue<=1)
{analogWrite (LedPin, LOW); }

int pos = map(sound, 0, 512, 160, 80); // scale it to use it with the servo

myservo.write(pos); // sets the servo position according to the scaled value

delay(50); } // waits for the servo to get there

code for microcontroller 1; (this code can be modified since it does not use the servo on this arduino. I keep it there because I didn’t feel like deleting it. you can change it however. this does not control the servo. microcontroller 2 does all that. This is the example in the daphc example). good luck modding this code.

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include “WaveUtil.h”
#include “WaveHC.h”

SdReader card; // This object holds the information for the card
FatVolume vol; // This holds the information for the partition on the card
FatReader root; // This holds the information for the filesystem on the card
FatReader f; // This holds the information for the file we’re play

uint8_t dirLevel; // indent level for file/dir names (for prettyprinting)
dir_t dirBuf; // buffer for directory reads

WaveHC wave; // This is the only wave (audio) object, since we will only play one at a time

// for PIR
int inputPin = 12; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin statu
int servoPin =9;
int minPulse= 500; // minimum servo position
int maxPulse = 2500; // maximum servo position
int pulse=0;
int turnRate = 1800; // servo turn rate increment (larger value, faster rate)
int refreshTime = 20; // time (ms) between pulses (50Hz)
int mouthchange = 6; //checks to see if mouth position needs to be changed

long lastPulse = 0; // recorded time (ms) of the last pulse
int analogValue=0;
int analogPin=1;

#define DEBOUNCE 100 // button debouncer

// this handy function will return the number of bytes currently free in RAM, great for debugging!
int freeRam(void)
extern int __bss_end;
extern int *__brkval;
int free_memory;
if((int)__brkval == 0) {
free_memory = ((int)&free_memory) - ((int)&__bss_end);
else {
free_memory = ((int)&free_memory) - ((int)__brkval);
return free_memory;

void sdErrorCheck(void)
if (!card.errorCode()) return;
putstring("\n\rSD I/O error: “);
Serial.print(card.errorCode(), HEX);
putstring(”, ");
Serial.println(card.errorData(), HEX);

void setup() {
// set up serial port
// set up servo pin
pinMode(servoPin, OUTPUT); // Set servo pin 9 as an output pin
pulse= minPulse;

putstring_nl(“WaveHC with 6 buttons”);

putstring("Free RAM: "); // This can help with debugging, running out of RAM is bad
Serial.println(freeRam()); // if this is under 150 bytes it may spell trouble!

// Set the output pins for the DAC control. This pins are defined in the library
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);

// if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn’t working for you
if (!card.init()) { //play with 8 MHz spi (default faster!)
putstring_nl(“Card init. failed!”); // Something went wrong, lets print out why
while(1); // then ‘halt’ - do nothing!

// enable optimize read - some cards may timeout. Disable if you’re having problems

// Now we will look for a FAT partition!
uint8_t part;
for (part = 0; part < 5; part++) { // we have up to 5 slots to look in
if (vol.init(card, part))
break; // we found one, lets bail
if (part == 5) { // if we ended up not finding one :frowning:
putstring_nl(“No valid FAT partition!”);
sdErrorCheck(); // Something went wrong, lets print out why
while(1); // then ‘halt’ - do nothing!

// Lets tell the user about what we found
putstring(“Using partition “);
Serial.print(part, DEC);
putstring(”, type is FAT”);
Serial.println(vol.fatType(),DEC); // FAT16 or FAT32?

// Try to open the root directory
if (!root.openRoot(vol)) {
putstring_nl(“Can’t open root dir!”); // Something went wrong,
while(1); // then ‘halt’ - do nothing!

// Whew! We got past the tough parts.

void loop() {
//putstring("."); // uncomment this to see if the loop isnt running
switch (check_switches()) {
case 1:


byte check_switches()
if (digitalRead(12) == LOW) // check for high signal on pin 14 (analog 0)
return random(1,6);
return 0;

// Plays a full file from beginning to end with no pause.
void playcomplete(char *name) {

// call our helper to find and play this name
while (wave.isplaying) {

analogValue = analogRead(A1);
Serial.println(analogValue) ;
pulse = map(analogValue,0,100,minPulse,maxPulse);


if (millis() - lastPulse >= refreshTime)

digitalWrite(servoPin, HIGH); // start the pulse
delayMicroseconds(pulse); // pulse width
digitalWrite(servoPin, LOW); // stop the pulse
lastPulse = millis();
// do nothing while its playing

// now its done playing
void playfile(char *name) {
// see if the wave object is currently doing something
if (wave.isplaying) {// already playing something, so stop it!
wave.stop(); // stop it
// look in the root directory and open the file
if (!, name)) {
putstring("Couldn’t open file "); Serial.print(name); return;
// OK read the file and turn it into a wave object
if (!wave.create(f)) {
putstring_nl(“Not a valid WAV”); return;

// ok time to play! start playback;

OK, if you are going to "speak" to someone who has not been on this forum for five and a half years, the very least you could do is to read the instructions for posting here. :roll_eyes: