It’s Like Taking Candy From A Baby!

I worked on this project with Julia Fernandez, who wrote this blog post. I am simply sharing the work and process. Thanks for a solid time, Julia!

Soft, cuddly, giggly, bundle-of-joy.

What did you think of when you read those words? You thought of a baby, didn’t you. But what happens if you take that description and replace them with something very opposite?

Menacing, screeching, demonic… purple.

In the beginning stages of brainstorming, we could not let go of a creepy baby being involved in some way. With lots of thought and consideration of our own capabilities, we decided to embark on plan to make a candy bowl with a baby inside that reacts when a piece of candy is taken.

The initial plan included LEDs behind the eyes, a servo motor spinning the baby’s head, and a recording of a baby crying when an unsuspecting trick-or-treater stuck their hand in the bowl. We would fix an ultrasonic sensor to the inside of the bowl to detect a hand. We considered fixing the head upright or sliced in half and fixed like a mask on the bottom of the bowl.

A sketch of the original plan.

The idea evolved and we planned to go with the severed head approach. In this idea, we planned to have the breadboard and all wiring tucked away inside the baby head.

An alternate configuring of the head.

As we began to map this out, it became apparent that sawing the baby head in half was not very practical or a good use of our time. Additionally, the eyes of the baby seemed to be impossible to remove; they were embedded in a thick layer of plastic. Upon those discoveries, Aidan and I decided it would be best to ditch the LEDs in the head and try animating another part of the baby in place of it. A third a final sketch was drafted.

Third and final sketch.

In this sketch, we designed a platform for the servo motors to be mounted on. The baby’s head and arm would be mounted on the servo motor, and all of the wiring would be hidden underneath the platform. A more complete blueprint of the structure of the platform is seen in this blueprint:

We were left with a goal to make a candy bowl with a baby head that spun and screamed when candy was taken from the bowl.

After our plan was finalized, we began construction!

The materials we gathered for the aesthetic aspect of the project included the following:

  • plastic bowl
  • baby doll
  • paint
  • hot glue
  • canvas strips
  • cardboard

The materials we gathered for the technical aspect of the project included:

  • arduino with short breadboard
  • ultrasonic sensor
  • female/male headers
  • (2) servo motors
  • bluetooth speaker

Goodnight, baby.

After decapitating the baby, we quickly worked to make the base for the servo motors using cardboard and hot glue.

After attaching the servo motors to the base, we glued a cardboard platform to glue the head and arm to on each motor. We drilled a hole in the bottom of the back of the bowl for the microUSB to come out of, and soon we had a prototype of our product. The bowl was adorned with canvas strips for an extra spooky effect.

First attempt at construction

Now, on to the code!

In Arduino, we had to write code to make the the ultrasonic sensor create input for the the servo motors translate into output.

ARDUINO CODE:

int trigPin = 9; // Trigger
int echoPin = 10; // Echo
long duration, cm, inches;

#include <Servo.h> // include the servo library

Servo servoMotor;
Servo servoMotor2;

void setup() {
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
servoMotor.attach(3);
servoMotor2.attach(4);
}

void loop() {
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

// Convert the time into a distance
cm = (duration/2) / 29.1; // Divide by 29.1 or multiply by 0.0343
inches = (duration/2) / 74; // Divide by 74 or multiply by 0.0135

Serial.println(inches);
// Serial.print(“in, “);
// Serial.print(“,”);
// Serial.print(cm);
// Serial.print(“cm”);
// Serial.println();

delay(10);
int output = map(inches, 0, 401, 0, 180);
int output2 = map(output, 0, 180, 180, 0);
servoMotor.write(output);
servoMotor2.write(output2);
delay(100);
}

As can be seen in the code above, we declared two separate servo motors: one for the baby’s head and one for the baby’s hand. After ensuring that both servo motor’s functioned properly, we moved onto connecting them to the ultrasonic sensor. Though the sensor could detect the full length of the room at 401 inches, we set the range for 4 inches. At this point, we were confronted with a problem.

Problem: The ultrasonic sensor kept mistaking the moving baby extremities for human movement reaching into the bowl. The amount of space in the bowl was just too tight for the sensor to be able to detect the single motion of a hand moving in front of it. We also realized that if the trick-or-treater stuck there hand in the bowl at any other position aside from where the sensor was aimed, there would be no special effect, defeating the purpose of the sensor in the first place.

Solution: We decided that we should point the ultrasonic sensor outside of the front of the bowl to detect when a person is standing in front of it, close enough to reach for candy. Though this isn’t what we wanted ideally, there seemed to be no other option. We remapped the range of the ultrasonic sensor to 20 inches, a distance we decided on after pretending to reach for candy and measuring how close the average person stood when reaching.

The circuit: The two bundles of three wires on the bottom of the breadboard are for the servo motors and the bundle of four wires are for the ultrasonic sensor.

We drilled a large hole in the front of the bowl to put the ultrasonic sensor through.

Shortly after, we were faced with another obstacle. The servo motor attached to the head wasn’t moving anymore.

The head turned out to be too heavy, so we had to detach it. Luckily, we had a spare baby leg to attach to the servo motor in place of it.

Our plan had clearly changed as we progressed with the construction. We now had the ultrasonic pointing outside the bowl, a leg and an arm on the servo motor, and the baby head in a fixed position.

We then spray painted all of the separate pieces and reassembled them for the last time.

Don’t worry, we didn’t forget to include that haunted baby sound we originally wanted to have!

CODE FOR SOUND (p5.js):

var song;
var latestData = “waiting for data”;

function preload() {
song = loadSound(‘cryingbaby3.mp3’);
}

function setup() {
createCanvas(400, 400);

serial = new p5.SerialPort();
serial.open(“/dev/tty.usbmodem143401”);
serial.on(‘data’, gotData);
}
function draw() {
background(220);
if (latestData < 20) {
if (!song.isPlaying()) {
song.play();
console.log(“test”); }
} else {
song.stop();
}
}
function gotData() {
var currentString = serial.readLine();
}

This code makes the audio play when the ultrasonic sensor receives input, playing the sound as the baby limbs turn. The variable “song” represents the song of the baby. In the draw function, we created an if statement which says that if the sensor has input, the song will play and if it does not, the song will stop.

The sound plays from the computer, but we enhanced this sound by connecting the computer to a bluetooth speaker and hiding it behind the bowl.

With a splash of blood and a bag of candy, we were able to finish our demon baby candy bowl.

Though this project involves literally taking candy from a baby, making it was not like taking candy from a baby. We were faced with a number of obstacles including:

  • The baby’s head being too heavy for the motor
  • The unreliability of the ultrasonic sensor
  • Mapping the ultrasonic sensor
  • Fitting all of the baby parts in the bucket

Despite these challenges, we are pleased with our final product. We’ve learned a lot about computation this semester, and it was really exciting to be able to use our new skills in combination with some creativity to make something! In our project we revisited topics discussed in class. These topics were:

  • Serial communication — we used this to connect sound with the ultrasonic sensor
  • Analog input and output — the ultrasonic sensor (I) and servo motors (O)
  • p5.js sound library — the audio of the crying baby

Special thanks to DanO for giving us the ultrasonic sensor, Arnab for helping us work out the code for the audio, and David for also helping us with code and playing lots of stress-relieving ping pong games in between work.

Making the bowl baby gave us lots of great experience in product design, fabrication, and collaboration. Having the time make a complex piece allowed for lots of practice planning, testing, and perfecting.

Posted onOctober 30, 2019Leave a commenton “It’s Like Taking Candy From A Baby” Midterm Project

Student at New York University. Passionate about visual art and the intersection between technology and sports.