Project tutorial
Spider-Man Mask with Servos and Bluetooth Control

Spider-Man Mask with Servos and Bluetooth Control © GPL3+

Want a cheap Spider-Man mask that looks cool?

  • 3,736 views
  • 0 comments
  • 14 respects

Components and supplies

HM-17 Bluetooth Module
Bluetooth module to connect to our mask.
×1
Resistor 2k
For the voltage divider to lower our 5V Arduino pin output to 3.3V.
×1
Mfr 25frf52 1k sml
Resistor 1k ohm
2 for the transistor base and 1 for the voltage divider.
×3
Mfr 25frf52 10k sml
Resistor 10k ohm
For the button located on the side of the mask.
×1
Fairchild semiconductor tip120 image
Darlington High Power Transistor
Our transistor to turn off the power going to the servo to conserve our battery.
×2
Sg90 servo motor 180 degrees sg90 micro
SG90 Micro-servo motor
The servos to control each eye of the mask.
×2
Spider-Man Feature Mask
I purchased the exact same one at a Disney Store.
×1
Ard nano
Arduino Nano R3
The brain of our project.
×1

Apps and online services

RoboRemo
The Android app that can create custom GUI and connect to the Bluetooth module.

About this project

-I've seen videos on YouTube of homemade, 3D-printed, Spider-Man masks with movable eyes and I thought it looked pretty cool. I don't have access to a 3D printer and I really did not want to create my own mask. I have already made an Iron Man helmet using Pepakura, resin, bondo, and that was a lot of work. After a trip to the Disney Store, I found a Spider-Man mask with movable eyes that can be controlled using a slider on each side of the mask. I wanted to make it better by adding small servos that can be controlled by a button on the side. Adding a Bluetooth module allowed me to have different modes that can be controlled by a phone.

Here is my mask in action:

Let's get started!

STEP ONE: Disassembly

I don't have any photos before I modified the mask so the following photos will be the modified mask.

Remove the screws:

STEP TWO: Remove the Following Parts

We will be removing some parts that we don't need here. The circuit board (circled in green), the speaker (circled in yellow), and the switch (circled in purple).

De-solder the circuit board from the battery pack (grey arrow), and de-solder the button (blue arrow) from the circuit board. We will need the button for later.

STEP THREE: Mask Cleanup

Use a Dremel tool to cut where the speakers were. We will be mounting our microcontroller circuit board here later and we will be cutting holes here for the servos.

Cut out two holes like in the photo below so that the servos can go through them as shown:

Drill two small holes on each side of the eyes (marked in red) and connect springs (salvaged from pens) to the servo. This allows the servo the control each eye.

Use a hot glue gun or your preferred method to glue the servos in place as shown in the photo above.

STEP FOUR: Electronics

We will be using an Arduino Nano to control the servos powered by the mask's battery pack. The battery pack can power the two servos we will be using and a 9V battery will be used to power the Nano through the VIN pin.

Connect everything as shown in the photo above.

I used two TIP-120 transistors so that we can control the power going to each servos. Without this, the servos will keep running even as it reaches our desired position. Once our servos have reached our desired position (open, close), we can cut power to the servos to save our battery life.

In our code, this is labeled as RightPower and LeftPower. Our signal for the servo position is labeled as righteyepin and lefteyepin.

A 1kΩ ohm resistor is connected to the base of the transistor for protection.

The button in the photo represents the button at the side of the mask.

The Bluetooth Module (HM-17) will be connected to the Arduino as well. The TX pin can be directly connected to the Arduino and the RX pin will need to be connected to a voltage divider as the HM-17 can only take 3.3V for input.

It will be connected like in the photo below:

STEP FIVE: Code

Modify to your liking and upload the code using the Arduino IDE below.

STEP SIX: Bluetooth Connection

Using the RoboRemo app (the paid version can give you more than 5 modules), you can connect to your Bluetooth module without configuration. Pair the bluetooth module with your phone (default password is 123456) and it will show up on the list in the app. You can download the RoboRemo file I have setup for myself and you can modify it to your liking. Add different modes to customize your mask. You can import the interface using the RoboRemo app. The file can be found below.

STEP SEVEN: Done!

Connect to the Bluetooth module using the app and everything should be working like in the video!

Code

Spider-Man Mask CodeC/C++
Upload to Arduino IDE.
#include <SoftwareSerial.h>
#include <Servo.h>

int righteyepin = 5; //pin for the servo signal
int lefteyepin = 4;
Servo righteye;
Servo lefteye;
SoftwareSerial BTSerial (12,11); //RX||TX Serial communication pins for the bluetooth module

int Button = 2; //pin for the side button of the mask for non-bluetooth control
int RightPower = 10; //pin for the base of the transistor
int LeftPower = 7;
int state = HIGH;
int reading;
int glitch = 150;
int quick = 200;
int previous = LOW;
long time = 0;
long debounce = 200;
int value;
byte valueall[28];
char valuechar[28];

void setup() {

Serial.begin(9600);
BTSerial.begin(9600);
righteye.attach(righteyepin);
lefteye.attach(lefteyepin);
pinMode(Button, INPUT);
pinMode(RightPower, OUTPUT);  pinMode(LeftPower, OUTPUT);
Serial.println("AT commands: ");
righteyeopen();
lefteyeopen();

}

void loop() {
if (BTSerial.available()) { //wait for bluetooth commands
value = BTSerial.parseInt(); 
Serial.print (value);
    }
	
switch (value) {
  case 1: //if value received from the bluetooth is 1, do this
      digitalWrite(RightPower, HIGH);  //right eye closed
      righteye.write(120);
      delay (1000);
      digitalWrite(RightPower, LOW); 
    break;
  case 2: //right eye open
      digitalWrite(RightPower, HIGH);  
      righteye.write(30);
      delay (1000);
      digitalWrite(RightPower, LOW); 
    break;
  case 3: //left closed
      digitalWrite(LeftPower, HIGH);  
      lefteye.write(70);
      delay (1000);
      digitalWrite(LeftPower, LOW);  
    break;	
  case 4: //left open
      digitalWrite(LeftPower, HIGH);  
      lefteye.write(180);
      delay (1000);
      digitalWrite(LeftPower, LOW);   
    break;	
  case 5: //both eyes open
      digitalWrite(LeftPower, HIGH);  
      digitalWrite(RightPower, HIGH);  
      lefteye.write(180);
      righteye.write(30);
      delay (1000);
      digitalWrite(LeftPower, LOW); 
      digitalWrite(RightPower, LOW);  
    break;
  case 6: //both eyes closed
      digitalWrite(LeftPower, HIGH);  
      digitalWrite(RightPower, HIGH);  
      lefteye.write(70);
      righteye.write(120);
      delay (1000);
      digitalWrite(LeftPower, LOW); 
      digitalWrite(RightPower, LOW); 
    break;
  case 7: //animation mode
botheyeopen();
delay (200);
lefteyeclosed();
delay (200);
lefteyeopen();
righteyeclosed();
delay (200);
lefteyeclosed();
delay (100);
botheyeopen(); 
delay (500);
lefteyeclosed();
delay (200);
lefteyeopen();
righteyeclosed();
delay (200);
lefteyeclosed();
delay (100);
botheyeopen();    
    break;
  case 8: //surprised
botheyeclosed();
delay (4000);
botheyeopen();   
    break;
  case 9: //glitch mode
digitalWrite(RightPower, HIGH);
righteye.write(120);
delay (glitch);
righteye.write(30);
delay (glitch);  
righteye.write(120);
delay (glitch);
righteye.write(30);
delay (glitch); 
righteye.write(120);
delay (glitch);
righteye.write(30);
delay (glitch); 
digitalWrite(RightPower, LOW);   
    break;
  case 10: //glitch both eyes
digitalWrite(RightPower, HIGH);
digitalWrite(LeftPower, HIGH);
righteye.write(120);
lefteye.write(70);
delay (glitch);
righteye.write(30);
lefteye.write(180);
delay (glitch);  
righteye.write(120);
lefteye.write(70);
delay (glitch);
righteye.write(30);
lefteye.write(180);
delay (glitch); 
righteye.write(120);
lefteye.write(70);
delay (glitch);
righteye.write(30);
lefteye.write(180);
delay (glitch); 
digitalWrite(RightPower, LOW); 
digitalWrite(LeftPower, LOW);  
    break;
}

sideButton(); //button for the side of the mask
}

void sideButton(){
   reading = digitalRead(Button);

  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    if (state == HIGH) { //first press opens the eyes
      state = LOW; 
      digitalWrite(RightPower, HIGH);
      digitalWrite(LeftPower, HIGH);
      righteye.write(120);
      lefteye.write(70);
      delay (1000);
      digitalWrite(RightPower, LOW);
      digitalWrite(LeftPower, LOW);
    }
    else {
      state = HIGH; //second press closes the eyes
      digitalWrite(RightPower, HIGH);
      digitalWrite(LeftPower, HIGH);
      righteye.write(30);
      lefteye.write(180);
      delay (1000);
      digitalWrite(RightPower, LOW);
      digitalWrite(LeftPower, LOW);
    }
    time = millis();
  }

  previous = reading;
 
}

void lefteyeopen(){ //left eye open - turns on the servo power, sets the position of the servo, and then turns of the power.
digitalWrite(LeftPower, HIGH);
lefteye.write(180);  
delay (300);
digitalWrite(LeftPower, LOW);
}

void lefteyeclosed(){
digitalWrite(LeftPower, HIGH);
lefteye.write(70);
delay (300);
digitalWrite(LeftPower, LOW);
}

void righteyeopen(){
digitalWrite(RightPower, HIGH);
righteye.write(30);
delay (quick);
digitalWrite(RightPower, LOW);
}

void righteyeclosed(){
digitalWrite(RightPower, HIGH);
righteye.write(120);
delay (quick);
digitalWrite(RightPower, LOW);
}

void botheyeclosed(){
      digitalWrite(LeftPower, HIGH);  
      digitalWrite(RightPower, HIGH);  
      lefteye.write(70);
      righteye.write(120);
      delay (1000);
      digitalWrite(LeftPower, LOW); 
      digitalWrite(RightPower, LOW);
}
void botheyeopen(){
      digitalWrite(LeftPower, HIGH);  
      digitalWrite(RightPower, HIGH);  
      lefteye.write(180);
      righteye.write(30);
      delay (1000);
      digitalWrite(LeftPower, LOW); 
      digitalWrite(RightPower, LOW);
}
Spider-Man Mask Code
Upload to Arduino IDE.

Custom parts and enclosures

RoboRemo file
RoboRemo file for Android app. Import it under MENU>INTERFACE>IMPORT
_oODIQx9mIb.spiderman%20mask

Schematics

Spider-Man Mask Schematic
Fritzing Schematic File.
spiderman_CwGIpEkO3t.fzz
Schematic Image
The image only shows the connection for the left servo to make it look cleaner.
Spiderman iokhzyiksr
Wiring Diagram
Wiring diagram created using draw.io

Comments

Similar projects you might like

Servo Control with TV Remote Control

Project showcase by eldo85

  • 9,771 views
  • 5 comments
  • 27 respects

Control the Speed of Brushless DC Motor Using Bluetooth

Project tutorial by mohitmehlawat

  • 6,461 views
  • 1 comment
  • 13 respects

Dual Axis Servo Control with Joystick

Project tutorial by Arnov Sharma

  • 2,207 views
  • 0 comments
  • 12 respects

Bluetooth Control RC Car

Project tutorial by electronicprojects

  • 1,702 views
  • 2 comments
  • 11 respects

Control RC Car via Bluetooth with Android Smartphone

Project showcase by JoyDutta06

  • 9,485 views
  • 3 comments
  • 6 respects

Smart Thermostat, Airing and Lights Control with Bluetooth

Project tutorial by Gyula Osi

  • 6,890 views
  • 20 comments
  • 52 respects
Add projectSign up / Login