Introduction: BB8 With a Arduino + Buzzer

Welcome! This is a rather noob-ish approach to things, which is to be fair, very close to my character but it might not be for you. Never the less I hope that it can help you in some way.

Thing you'll need to complete this project:

-The ability to tolerate stupid jokes, for there will be many

-Something nice to snack, for this will take long

The Technical Bits

-An Arduino(I've used an Arduino Uno, but any other Arduino will do)

-2 leds -Plenty of little wires

- Buzzer (I used a Velleman sv3, but whatever you have laying at the ready will suffice I suppose)

-An Infrared proximity sensor

-220ohm Resistor

The Body and Head

-Balloon or beach ball


-Old news papers

-Half of a Styrofoam ball

-Paint in the colours orange, white and black(can be mixed with the white to make grey)

Step 1: The Body + Head

The first step is creating it’s body, at least I recommend you start here first and try your hand at the other steps whilst the paint and/or glue is drying. But if you’d rather start somewhere feel free.

The making of the body and head are mostly the same in the beginning as the both need to be papier-mâché-ed.

If papier-mâché isn’t your thing please check out this gorgeous example from 1truedrum

Step one: The papier-mâché play

To get your papier-mâché game going you’ll need some glue and some old newspapers.

Cut the newspaper in nice even strokes(trust me this makes it way easier to keep things nice and smooth like we want, at least that’s what I assume we want, do we want that? Yes, yes we do) and apply the to the head/body with the help of a paint brush(or use your hands if you like). You can also dip the paper in the glue and then apply, see what works best for you. Just make sure there aren’t any air bubbles or that you apply to much paper to one side.

I gave both the body and the head about 3 layers of paper(apply one, dry, apply 2, dry, ect.).

I made BB8’s head out of one half Styrofoam ball, which was already nice and hollow on the inside(like me).

Alternatively you could make one out of just papier-mâché(using the same method as I use for making the body only with a smaller ball and make sure you add enough layers to keep it steady) or you could also cleave a solid Styrofoam ball and then get to carving.

Keep in mind however that this is a tedious job and you quickly carve away too much, which might result in tears.

It can literally be anything as long as you can fit your Arduino + sensor+ buzzer inside, I trust you can handle this creative freedom.

For the body I used a balloon (I tapped of to make it rounder) as a kind of “mold”. Because much to my dismay, all the beach balls were all sold out. OH THE HUMANITY!

In the end this worked out in my favor, for the slightly off shape allowed me to balance the head on the body and keep it all standing.

Step 2: Painting

For BB8’s eye I used the half off a plastic christmas tree decoration ball, which I painted black from the inside out so it kept its nice and shiny outside.

There are plenty of references on the interwebz you can use for painting it’s body and head, but you can also use your own creative vision of what BB8 looks like just keep in mind we are going to punch two holes into the front of its head to place the sensor, so don’t get to enthusiastic on that part.

Step 3: ​The Arduino + Code

I used this wonderful video tutorial by Mert Arduino and Tech to put all of it together. What I also did is marry two leds together so I can have two instead of one light inside BB8’s beautiful face.

The Code

I used the code from the same video tutorial and only changed the safetyDistance for the buzzer to <= 30 and the led to <=100, so the light starts burning first and the buzzer only goes off when you get closer.

Here it is:

// defines pins numbers

const int trigPin = 9;

const int echoPin = 10;

const int buzzer = 11;

const int ledPin = 13;

// defines variables

long duration;

int distance;

int safetyDistance;

void setup() {

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output

pinMode(echoPin, INPUT); // Sets the echoPin as an Input

pinMode(buzzer, OUTPUT);

pinMode(ledPin, OUTPUT);

Serial.begin(9600); // Starts the serial communication


void loop() {

// Clears the trigPin

digitalWrite(trigPin, LOW);


// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

safetyDistance = distance;

if (safetyDistance <= 30){

digitalWrite(buzzer, HIGH);



digitalWrite(buzzer, LOW);


if (safetyDistance <= 100){

digitalWrite(ledPin, HIGH);



digitalWrite(ledPin, LOW);


// Prints the distance on the Serial Monitor

Serial.print("Distance: ");



Step 4: Avengers Assemble!

Carve out some of the Styrofoam(tedious, I know), and punch in a few holes so the sensors and leds will stick out thusly. . In order to not have your BB8 plugged into the computer yet still have it function, you can plug in a battery and tuck it nice and save into his head. Please consider you’ll want to be able to remove said battery at whim. For the noise the buzzer makes is sure to drive you absolutely mental.

Step 5: the End

And there you are, now bask in the glory that is your BB8! I'm proud of you.

Step 6: References