7sinzz
Well-Known Member
Its been two and a half years since I wrote this tutorial on how to motorise the Iron Man helmet faceplate and in that time it has been viewed hundreds of thousands of times and helped thousands of people. We've had some fantastic people jump on board and help us out and share their knowledge. This thread has become an absolute gold mine of information relating not only to motorising your Iron Man helmet, but also adding sound effects and lights and all sorts. Along with the growth of it came an element of complication. I initially embarked on this learning curve to keep things as simple as possible, I wanted to make it as easy as possible for noobs like me to get their helmet motorised. Reading back over it, I noticed my initial post was quite messy with badly formatted images and random text everywhere. With that in mind, I've decided to tidy it all up and host the tutorial on my own website. I've completely streamlined the code and the equipment to make it as easy and flawless as possible. Anybody following my new streamlined code and method should be able to have the equipment working in less than half an hour. Please follow this link:
Electronic Iron Man Helmet Tutorial
Here's a preview:
I have compressed the old post to save space without having to delete it. There is no spoiler content here, its just the messy, complicated old tutorial.
Electronic Iron Man Helmet Tutorial
Here's a preview:
I have compressed the old post to save space without having to delete it. There is no spoiler content here, its just the messy, complicated old tutorial.
Hey guys. Well as im sure you all know, the electronics for the motorised faceplate in the iron man helmet are as rare as rocking horse ****.
Like many of you, I searched all over the internet for the code and a full tutorial, but its nowhere to be found. Certain individuals are happy to build the equipment, but not so happy to share the knowledge. Well over the past few weeks I have been taking various pieces of code and stitching them together and have finally come up with a solution I am happy with, and I'm ready to share this information with you.
This tutorial is my interpretation of the electronics and code required for a fully motorised faceplate including light up eyes. The code has a slight delay so that once the faceplate closes the eyes take a second to come on. Once open the eyes turn off again.
This tutorial only shows the breadboard stages so far but this post will be updated each time new information is provided. What i have supplied is a MASSIVE foundation for you all. This is purely designed to get all the coding and the order of components out of the way.
Moving from the breadboard into the helmet is something we can work on together.
Here's a quick video showing what i have achieved
and here's one of it in the helmet...
This is written for people that have absolutely no idea of electronics (just like me)
For this you will need:
Either: Arduino UNO + USB cable (available on ebay or many electronics suppliers) This is for prototyping only!!! To big for helmet.
OR!... Arduino Mini Pro 5v + FTDI cable (sold separately) and drivers.
Arduino software (available here)
2 servo motors
1 LED
1 push button
1 10k ohm resistor
1 breadboard
13 breadboard cables
Edit: Please note, the Arduino Uno is simply for prototyping, I advise all readers not to skip the prototyping phase, it ensures that all components are situated correctly and lends an opportunity for testing components. When it comes to installation then my preferred choice of board is the Arduino Mini Pro. Its a lot smaller and a lot lighter. If you also choose to select the mini Pro, you will need an FTDI cable + drivers in order to programme it. Once you get to the installation phase, the breadboard will also be made redundant
Observations:
First lets take a look at the Bread board. Down each side of the bread board you will notice a red line and a blue line. Next to the red line running down the board are lots of holes. These are all connected together and will act as our positive power rail.
The the holes running down next to the blue line will act as our negative ground rail. Again all the ports running in a line parallel to this blue line are connected.
Next you will notice numbers and letters on the board. Each numbered row is connected across the board instead of down this time. So 1a 1b 1c 1d 1e are all connected together. Next there is a split in the board. Anything after this split is seperate. So 1f 1g 1h 1i 1j are again connected to each other but not connected to the ports the other side of the split.
Now take a look at the Arduino UNO. Please navigate it so that the USB cable is furthest from you. On the right of the board you will notice numbers from 0 to 13. For this tutorial those are signal ports and shall be referred to as such. On the left side of the board the only things you need to be aware of for this tutorial are the 5v port and the GND port. These are for our power.
Lets begin
Ok this is pretty complicated so double check check each stage before moving on to the next.
Here is what you are aiming for (scroll down for written instructions):
1) Run a cable from the 5v port of Arduino UNO to the positive RED rail running down the side of the breadboard
2) Run a cable from the Gnd port in arduino uno to the negative blue rail of the breadboard
3) Bend the longer leg on the LED so it is the same length as the shorter leg.
4) Insert shorter leg of LED (negative) into 11a on the breadboard.
5) Insert longer leg of LED (positive) into 14a of bread board.
6) Insert one leg of resistor into 25f on breadboard.
7) Insert the other leg of resistor into 20f on breadboard
8) Please notice the switch has 2 legs on one side and 2 legs on the other. The 2 legs per side are connected together. So orientate the switch so that 2 legs face up the breadboard, and 2 legs face down.
9) Legs should be inserted into the breadboard at: 25g, 25i, 28i, 28g. If the switch does not fit in these spaces turn it 1 quarter of a turn.
10) Examine the cables on the servo. There should be a red cable, a black cable and a white cable. Red is positive, black is ground, and white is signal.
11) Run a cable from red on servo 1 to the red rail on the breadboard
12) Run a cable from black on servo 1 to the blue rail on breadboard
13) Run a cable from white on servo 1 to signal port 9 on the right of Arduino.
14) Run a cable from red on servo 2 to the red rail on the breadboard
15) Run a cable from black on servo 2 to the blue rail on the breadboard
16) Run a cable from white on servo 2 to signal port 10 on Arduino.
17) Run a cable from 14c to signal port 5 on arduino (this should be connected to the positive leg on LED, PLEASE CHECK!)
18) Run a cable from 11e to the negative rail on breadboard (this should be the negative leg on LED, PLEASE CHECK!)
19) Run a cable from 20g to negative rail on breadboard (this should be connected to 1 leg of the resistor PLEASE CHECK!)
20) Run a cable from 28f to the positive rail on the breadboard (this should be connected to switch)
21) Run a cable from 25j to signal port 2 on breadboard (this should be connected to other side of switch and resistor.
22) YOUR DONE!!! Well done, now give yourself a big pat on the back.
Now start up the Arduino software and connect you Arduino UNO to the computer via the supplied USB cable.
Wait for your computer to install the Arduino Uno if it hasnt already.
Click show and copy this code and paste it into your arduino software:
This Code will give you eyes that just turn on 1 second after the helmet closes. As seen Here
This different code will make the LED flicker then fade on, one second after the faceplate closes. Mimicking a powering up function. Demonstration here. Thank you to guitarkizta for this code:
Click the arrow at the top of the software which will upload this code to the Arduino, then wait for it to say "done" at the bottom of the screen.
Testing:
Leave the board connected to the computer and press the switch on the breadboard.
1) First button press powers up the system and turns eye lights on (1.5 second delay), no movement will be seen.
2) Second button press rotates servos and turns off eye light, this is the faceplate opening.
3) Third button press rotates servos in opposite direction, then 1 second delay and light turns on. This is the faceplate closing and eye lights turning on.
You may notice a vibrating noise once the servos have reached their resting positions. I have been informed this is normal but Im not sure how reliable that information is. If anybody has a fix, please let me know.
Id like to give a massive thank you to ironleoman for his continued help throughout putting this together. He's been giving me the much needed kick up the arse to get this done so we can share it with you guys.
IDEAS
Some ideas for you to think of: Id like the eyes to flicker before coming on to mimic powering up... Could anyone modify the code to make this happen? Is anyone able to shut off power to the servos when they are in their resting positions to stop the buzzing noise? Feel free to modify this code and post your own findings. From this point on we're working together.
Circuit without eyes:
If you dont wish to have the eye lights in your circuit, please skip steps 3,4,5 and 17
First button press powers up the system, no movement will be seen. Second button press and every botton press thereafter will move the servos.
Flight Stabilisers:
This code can also be used for the flight stabilisers on the back of the Iron Man armour. If you would like me to write 2 more servos into the code for all 4 flight stabilisers, please comment in the thread.
Quick glance at installation
This is the same installation method I intend on using, minus the jaw:
Faceplate
Close up
Servo Mounting Location
Sound Effects
Please also find some awesome sound effects in these links provided by TryChick for those of you considering adding sound to your suits. I shall update on this at a later date:
Sound effects set 1 Here
and
Sound effects set 2 Here
EDIT10/12/2013
OK this thread has come a hell of a long way since it first started almost exactly a year ago. Its 0340 in the morning in England and I've been having a quick scan through to see how I can update this first thread. Many members have added a considerably higher amount of knowledge than I could have ever posted here. So I think its time I updated this first thread to make things easier. The information i provided above was just a foundation and a learning curve for me. Yes the code works but members with more extensive knowledge than me have provided tighter code to achieve the goals we're aiming for more efficiently.
So the first member that needs seriously crediting is xI97 who has constantly added endless reals of limitless knowledge. Here is the link to his code within this thread:
xI97 code, please scroll down the page to post number 65
You can find his schematic here:
xI97 schematic post number 778
The next member who has added a tonne of info is member, his schematic uses the same code as I have supplied but many more components. The schematic for his setup can be found here:
memebr's schamtic post number 740
Both of these guys deserve considerably more credit than me.
More to be added in time...
Like many of you, I searched all over the internet for the code and a full tutorial, but its nowhere to be found. Certain individuals are happy to build the equipment, but not so happy to share the knowledge. Well over the past few weeks I have been taking various pieces of code and stitching them together and have finally come up with a solution I am happy with, and I'm ready to share this information with you.
This tutorial is my interpretation of the electronics and code required for a fully motorised faceplate including light up eyes. The code has a slight delay so that once the faceplate closes the eyes take a second to come on. Once open the eyes turn off again.
This tutorial only shows the breadboard stages so far but this post will be updated each time new information is provided. What i have supplied is a MASSIVE foundation for you all. This is purely designed to get all the coding and the order of components out of the way.
Moving from the breadboard into the helmet is something we can work on together.
Here's a quick video showing what i have achieved
and here's one of it in the helmet...
This is written for people that have absolutely no idea of electronics (just like me)
For this you will need:
Either: Arduino UNO + USB cable (available on ebay or many electronics suppliers) This is for prototyping only!!! To big for helmet.
OR!... Arduino Mini Pro 5v + FTDI cable (sold separately) and drivers.
Arduino software (available here)
2 servo motors
1 LED
1 push button
1 10k ohm resistor
1 breadboard
13 breadboard cables
Edit: Please note, the Arduino Uno is simply for prototyping, I advise all readers not to skip the prototyping phase, it ensures that all components are situated correctly and lends an opportunity for testing components. When it comes to installation then my preferred choice of board is the Arduino Mini Pro. Its a lot smaller and a lot lighter. If you also choose to select the mini Pro, you will need an FTDI cable + drivers in order to programme it. Once you get to the installation phase, the breadboard will also be made redundant
Observations:
First lets take a look at the Bread board. Down each side of the bread board you will notice a red line and a blue line. Next to the red line running down the board are lots of holes. These are all connected together and will act as our positive power rail.
The the holes running down next to the blue line will act as our negative ground rail. Again all the ports running in a line parallel to this blue line are connected.
Next you will notice numbers and letters on the board. Each numbered row is connected across the board instead of down this time. So 1a 1b 1c 1d 1e are all connected together. Next there is a split in the board. Anything after this split is seperate. So 1f 1g 1h 1i 1j are again connected to each other but not connected to the ports the other side of the split.
Now take a look at the Arduino UNO. Please navigate it so that the USB cable is furthest from you. On the right of the board you will notice numbers from 0 to 13. For this tutorial those are signal ports and shall be referred to as such. On the left side of the board the only things you need to be aware of for this tutorial are the 5v port and the GND port. These are for our power.
Lets begin
Ok this is pretty complicated so double check check each stage before moving on to the next.
Here is what you are aiming for (scroll down for written instructions):
1) Run a cable from the 5v port of Arduino UNO to the positive RED rail running down the side of the breadboard
2) Run a cable from the Gnd port in arduino uno to the negative blue rail of the breadboard
3) Bend the longer leg on the LED so it is the same length as the shorter leg.
4) Insert shorter leg of LED (negative) into 11a on the breadboard.
5) Insert longer leg of LED (positive) into 14a of bread board.
6) Insert one leg of resistor into 25f on breadboard.
7) Insert the other leg of resistor into 20f on breadboard
8) Please notice the switch has 2 legs on one side and 2 legs on the other. The 2 legs per side are connected together. So orientate the switch so that 2 legs face up the breadboard, and 2 legs face down.
9) Legs should be inserted into the breadboard at: 25g, 25i, 28i, 28g. If the switch does not fit in these spaces turn it 1 quarter of a turn.
10) Examine the cables on the servo. There should be a red cable, a black cable and a white cable. Red is positive, black is ground, and white is signal.
11) Run a cable from red on servo 1 to the red rail on the breadboard
12) Run a cable from black on servo 1 to the blue rail on breadboard
13) Run a cable from white on servo 1 to signal port 9 on the right of Arduino.
14) Run a cable from red on servo 2 to the red rail on the breadboard
15) Run a cable from black on servo 2 to the blue rail on the breadboard
16) Run a cable from white on servo 2 to signal port 10 on Arduino.
17) Run a cable from 14c to signal port 5 on arduino (this should be connected to the positive leg on LED, PLEASE CHECK!)
18) Run a cable from 11e to the negative rail on breadboard (this should be the negative leg on LED, PLEASE CHECK!)
19) Run a cable from 20g to negative rail on breadboard (this should be connected to 1 leg of the resistor PLEASE CHECK!)
20) Run a cable from 28f to the positive rail on the breadboard (this should be connected to switch)
21) Run a cable from 25j to signal port 2 on breadboard (this should be connected to other side of switch and resistor.
22) YOUR DONE!!! Well done, now give yourself a big pat on the back.
Now start up the Arduino software and connect you Arduino UNO to the computer via the supplied USB cable.
Wait for your computer to install the Arduino Uno if it hasnt already.
Click show and copy this code and paste it into your arduino software:
This Code will give you eyes that just turn on 1 second after the helmet closes. As seen Here
#include <Servo.h>
Servo myservo; // create servo object to control a servo
Servo myservo1;
const int buttonPin = 2; // the pin that the pushbutton is attached to
const int ledPin = 5; // the pin that the LED is attached to
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
int ledState = 0; // remember current led state
int pos = 0; // variable to store the servo positions
int pos1 = 180;
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo1.attach(10); // attaches the servo 1 on pin 10 to the servo object
pinMode(buttonPin, INPUT); // initialize the button pin as a input
pinMode(ledPin, OUTPUT); // initialize the button pin as a output
}
void loop()
{
buttonState = digitalRead(buttonPin); // read the pushbutton input pin
if (buttonState != lastButtonState) // compare buttonState to previous state
{
if (buttonState == 1)
{
if(ledState == 1)
{
delay(30); ledState = 0;
for(pos = 0; pos <= 180; pos += 10) // goes from 0 degrees to 180 degrees
{ // in steps of 10 degrees
myservo.write(pos); // tell servo to go to position 'pos'
}
for(pos1 = 180; pos1 >= 0; pos1 -= 10) // goes from 180 degrees to 0 degrees
{ // in steps of 10 degrees
myservo1.write(pos1); // tell servo to go to position 'pos1'
}
delay(15); // waits 15ms for the servo to reach the position
}
else
{
delay(30); ledState = 1;
for(pos = 180; pos >= 0; pos -= 10) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position 'pos'
}
for(pos1 = 0; pos1 <= 180; pos1 += 10) // goes from 0 degrees to 180 degrees
{
myservo1.write(pos1); // tell servo to go to position 'pos1'
}
delay(1000);
}
}
lastButtonState = buttonState; // remember the current state of the button
}
// turns LED on if the ledState =1 or off if ledState = 0
digitalWrite(ledPin, ledState);
myservo.write(pos); // goes from 0 degrees to 180 degrees
myservo1.write(pos1); // goes from 180 degrees to 0 degrees
delay(20);
}
Servo myservo; // create servo object to control a servo
Servo myservo1;
const int buttonPin = 2; // the pin that the pushbutton is attached to
const int ledPin = 5; // the pin that the LED is attached to
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
int ledState = 0; // remember current led state
int pos = 0; // variable to store the servo positions
int pos1 = 180;
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo1.attach(10); // attaches the servo 1 on pin 10 to the servo object
pinMode(buttonPin, INPUT); // initialize the button pin as a input
pinMode(ledPin, OUTPUT); // initialize the button pin as a output
}
void loop()
{
buttonState = digitalRead(buttonPin); // read the pushbutton input pin
if (buttonState != lastButtonState) // compare buttonState to previous state
{
if (buttonState == 1)
{
if(ledState == 1)
{
delay(30); ledState = 0;
for(pos = 0; pos <= 180; pos += 10) // goes from 0 degrees to 180 degrees
{ // in steps of 10 degrees
myservo.write(pos); // tell servo to go to position 'pos'
}
for(pos1 = 180; pos1 >= 0; pos1 -= 10) // goes from 180 degrees to 0 degrees
{ // in steps of 10 degrees
myservo1.write(pos1); // tell servo to go to position 'pos1'
}
delay(15); // waits 15ms for the servo to reach the position
}
else
{
delay(30); ledState = 1;
for(pos = 180; pos >= 0; pos -= 10) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position 'pos'
}
for(pos1 = 0; pos1 <= 180; pos1 += 10) // goes from 0 degrees to 180 degrees
{
myservo1.write(pos1); // tell servo to go to position 'pos1'
}
delay(1000);
}
}
lastButtonState = buttonState; // remember the current state of the button
}
// turns LED on if the ledState =1 or off if ledState = 0
digitalWrite(ledPin, ledState);
myservo.write(pos); // goes from 0 degrees to 180 degrees
myservo1.write(pos1); // goes from 180 degrees to 0 degrees
delay(20);
}
This different code will make the LED flicker then fade on, one second after the faceplate closes. Mimicking a powering up function. Demonstration here. Thank you to guitarkizta for this code:
#include <Servo.h>
//servo 1
Servo myservo;
Servo myservo1;
int val; // variable for reading the pin status
int val2; // variable for reading the delayed/debounced status
int buttonState;
int pos = 0;
int pos1 = 180;
int servostatus = 0;
int switchPin =2; // Switch connected to digital pin 2
int ledPin = 5;
int ledPin2 = 18;
void setup() // run once, when the sketch starts
{
//servo 1
myservo.attach(9);
myservo1.attach(10);
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
buttonState = digitalRead(switchPin);
myservo.write(0);
myservo1.write(175);
pinMode(ledPin2, OUTPUT);
}
void loop() // run over and over again
//servo 1
{
val = digitalRead(switchPin); // read input value and store it in val
delay(10); // 10 milliseconds is a good amount of time
val2 = digitalRead(switchPin); // read the input again to check for bounces
if (val == val2) { // make sure we got 2 consistant readings!
if (val != buttonState) { // the button state has changed!
if (val == LOW) { // check if the button is pressed
if (servostatus == 0) { // is the light off?
servostatus = 1; // turn light on!
myservo.write(0);
myservo1.write(180);
delay(1000);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
// fading
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
delay(30);
}
} else {
servostatus = 0; // turn light off!
digitalWrite(ledPin, LOW);
delay(15);
digitalWrite(ledPin2, LOW);
myservo.write(180);
myservo1.write(0);
}
}
}
buttonState = val; // save the new state in our variable
}
}
//servo 1
Servo myservo;
Servo myservo1;
int val; // variable for reading the pin status
int val2; // variable for reading the delayed/debounced status
int buttonState;
int pos = 0;
int pos1 = 180;
int servostatus = 0;
int switchPin =2; // Switch connected to digital pin 2
int ledPin = 5;
int ledPin2 = 18;
void setup() // run once, when the sketch starts
{
//servo 1
myservo.attach(9);
myservo1.attach(10);
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
buttonState = digitalRead(switchPin);
myservo.write(0);
myservo1.write(175);
pinMode(ledPin2, OUTPUT);
}
void loop() // run over and over again
//servo 1
{
val = digitalRead(switchPin); // read input value and store it in val
delay(10); // 10 milliseconds is a good amount of time
val2 = digitalRead(switchPin); // read the input again to check for bounces
if (val == val2) { // make sure we got 2 consistant readings!
if (val != buttonState) { // the button state has changed!
if (val == LOW) { // check if the button is pressed
if (servostatus == 0) { // is the light off?
servostatus = 1; // turn light on!
myservo.write(0);
myservo1.write(180);
delay(1000);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
// fading
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
delay(30);
}
} else {
servostatus = 0; // turn light off!
digitalWrite(ledPin, LOW);
delay(15);
digitalWrite(ledPin2, LOW);
myservo.write(180);
myservo1.write(0);
}
}
}
buttonState = val; // save the new state in our variable
}
}
Click the arrow at the top of the software which will upload this code to the Arduino, then wait for it to say "done" at the bottom of the screen.
Testing:
Leave the board connected to the computer and press the switch on the breadboard.
1) First button press powers up the system and turns eye lights on (1.5 second delay), no movement will be seen.
2) Second button press rotates servos and turns off eye light, this is the faceplate opening.
3) Third button press rotates servos in opposite direction, then 1 second delay and light turns on. This is the faceplate closing and eye lights turning on.
You may notice a vibrating noise once the servos have reached their resting positions. I have been informed this is normal but Im not sure how reliable that information is. If anybody has a fix, please let me know.
Id like to give a massive thank you to ironleoman for his continued help throughout putting this together. He's been giving me the much needed kick up the arse to get this done so we can share it with you guys.
IDEAS
Some ideas for you to think of: Id like the eyes to flicker before coming on to mimic powering up... Could anyone modify the code to make this happen? Is anyone able to shut off power to the servos when they are in their resting positions to stop the buzzing noise? Feel free to modify this code and post your own findings. From this point on we're working together.
Circuit without eyes:
If you dont wish to have the eye lights in your circuit, please skip steps 3,4,5 and 17
First button press powers up the system, no movement will be seen. Second button press and every botton press thereafter will move the servos.
Flight Stabilisers:
This code can also be used for the flight stabilisers on the back of the Iron Man armour. If you would like me to write 2 more servos into the code for all 4 flight stabilisers, please comment in the thread.
Quick glance at installation
This is the same installation method I intend on using, minus the jaw:
Faceplate
Close up
Servo Mounting Location
Sound Effects
Please also find some awesome sound effects in these links provided by TryChick for those of you considering adding sound to your suits. I shall update on this at a later date:
Sound effects set 1 Here
and
Sound effects set 2 Here
EDIT10/12/2013
OK this thread has come a hell of a long way since it first started almost exactly a year ago. Its 0340 in the morning in England and I've been having a quick scan through to see how I can update this first thread. Many members have added a considerably higher amount of knowledge than I could have ever posted here. So I think its time I updated this first thread to make things easier. The information i provided above was just a foundation and a learning curve for me. Yes the code works but members with more extensive knowledge than me have provided tighter code to achieve the goals we're aiming for more efficiently.
So the first member that needs seriously crediting is xI97 who has constantly added endless reals of limitless knowledge. Here is the link to his code within this thread:
xI97 code, please scroll down the page to post number 65
You can find his schematic here:
xI97 schematic post number 778
The next member who has added a tonne of info is member, his schematic uses the same code as I have supplied but many more components. The schematic for his setup can be found here:
memebr's schamtic post number 740
Both of these guys deserve considerably more credit than me.
More to be added in time...
Last edited by a moderator: