Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Components and supplies

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Arduino UNO
×1
Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Jumper wires (generic)
×1
Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Ultrasonic Sensor - HC-SR04 (Generic)
×1
MP3 MODULE ARDUINO DFPLAYER MIN
×1
4 CHANNEL RELAY
×1

Necessary tools and machines

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Hot glue gun (generic)
Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Soldering iron (generic)
Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Tip Tinner/Cleaner, Lead-Free

Apps and online services

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide
Arduino IDE

About this project

Iron Man is a fictional comic book character published by Marvel Comics. His true identity is that of businessman and billionaire Tony Stark, who uses high-tech armor in the fight against crime.

Material

  • Arduino Uno
  • 4-channel relay board
  • Ultrasonic module
  • 330 ohm resistor
  • Modulo mini MP3 player
  • Cable p2

Steps

The purpose of this project is to bring an Iron Man doll to life. We use an Ardudino Uno to control everything. When programming, we use the MP3 DFPlayer library and call the function random () to make the choices of the Iron Man audio files.

The audio was taken from Tony Stark's pessimistic films, and were renamed with numbers (001, 002, 003) to be performed by the MP3 module. Link of some auddio files: https://github.com/Sandromesquita/audioIronMan

When a person approaches (about 1.3m), the ultrasonic module identifies and commands the Arduino to call a BURF command (MP3 play command).

Circuit

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Lamp circuit

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Code

  • Homem_de_FerroV5.ino
Homem_de_FerroV5.inoArduino
#include <Ultrasonic.h>
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

//Inicia a serial por software nos pinos 10 e 11
SoftwareSerial mySoftwareSerial(6,7); // RX, TX

//Objeto responsvel pela comunicao com o mdulo MP3 (DFPlayer Mini)
DFRobotDFPlayerMini myDFPlayer;

//varivel responsvel por armazenar os comandos enviados para controlar o player
String buf;
//varivel responsvel por armazenar o estado do player (0: tocando ; 1: pausado)
int pausa = 0;
//varivel responsvel por armazenar o estado da equalizao
//varia de 0 a 5
int equalizacao = 0;
//varivel responsvel por armazenar o total de msicas presentes no SD card.
int maxSongs = 0;



#define Gnd  5 // Preto
#define Echo 4 // Laranja com fita preta
#define Trig 3 // Preto com fita preta 
#define Vcc  2 // Laranja

Ultrasonic ultra(Trig,Echo);

int distancia;
/*
 * Rel 1 Cabea 
 * Rel 2 Peito
 * Rel 3 Brao esquerdo
 * Rel 4 Brao direito
 */ 
 #define Cabeca   13
 #define Peito    12
 #define Esquerda 11
 #define Direito  10
 int x=3;
void setup() {
   //Comunicacao serial com o modulo
  mySoftwareSerial.begin(9600);
  //Inicializa a serial do Arduino
  Serial.begin(115200);
 
  //Verifica se o modulo esta respondendo e se o
  //cartao SD foi encontrado
  Serial.println();
  Serial.println("DFRobot DFPlayer Mini");
  Serial.println("Inicializando modulo DFPlayer... (3~5 segundos)");
  if (!myDFPlayer.begin(mySoftwareSerial))
  {
    Serial.println("Nao inicializado:");
    Serial.println("1.Cheque as conexoes do DFPlayer Mini");
    Serial.println("2.Insira um cartao SD");
    while (true);
  }
  Serial.println();
  Serial.println("Modulo DFPlayer Mini inicializado!");

  //Definicoes iniciais
  myDFPlayer.setTimeOut(500); //Timeout serial 500ms
  myDFPlayer.volume(30); //Volume 10
  myDFPlayer.EQ(0); //Equalizacao normal

  //recupera o numero de Msicas encontradas no SD.
  maxSongs = myDFPlayer.readFileCounts(DFPLAYER_DEVICE_SD);
  Serial.println();
  Serial.print("Numero de arquivos no cartao SD: ");
  Serial.println(maxSongs);
  
 
 

 
 
 pinMode(Cabeca,OUTPUT);
 pinMode(Peito,OUTPUT);
 pinMode(Esquerda,OUTPUT);
 pinMode(Direito,OUTPUT);
 
 pinMode(Vcc,OUTPUT);
 pinMode(Gnd,OUTPUT);

 
 digitalWrite(Gnd,LOW );
 digitalWrite(Vcc,HIGH);
 
 digitalWrite(Cabeca,HIGH);
 digitalWrite(Peito,HIGH);
 digitalWrite(Esquerda,HIGH);
 distancia=ultra.Ranging(CM);
}

void loop() {
  Serial.println(String(ultra.Ranging(CM))+" Lendo fora");
  distancia=ultra.Ranging(CM);
  
 
  if((distancia<=150)&&(x==3))
  {
    buf = random(1, 19);
   
  play();
  delay(3000);
  Serial.println("voltei");
  delay(100);
    while(ultra.Ranging(CM)<=150)
    {
      digitalWrite(Esquerda,HIGH); 
      x=2; 
      delay(1200);
    }
  
  }
  else
  {
  digitalWrite(Direito,LOW);
  Serial.println("Nd indentificado");
  x=3;
  }
  
}
void play()
{
  digitalWrite(Direito,HIGH);
  Serial.println("POU");
  delay(300);
  
  digitalWrite(Direito,LOW);
  delay(300);
  
  digitalWrite(Direito,HIGH);
  Serial.println("POU");
  delay(300);
  
  digitalWrite(Direito,LOW);
  delay(300);

  
    //Aguarda a entrada de dados pela serial
  while (Serial.available() >= 0)
  {    
    //Reproducao
    if ((buf.toInt() >= 1) && (buf.toInt() <= maxSongs))
    {

      Serial.print("Reproduzindo musica: ");
      Serial.println(buf.toInt());
//      buf = buf - 48;
      myDFPlayer.play(buf.toInt());
       buf=-1;
      break;
    }
  }
}

Schematics

Build an Arduino Iron Man: Components, Sensors, and Step‑by‑Step Guide

Manufacturing process

  1. Arduino Digital Dice Project: Build Your Own LCD-based Random Number Generator
  2. Find Me: Smart Item Locator with Arduino and Bluetooth
  3. Build a Functional Arduino-Powered 3D‑Printed Robotic Arm – Step‑by‑Step Guide
  4. DIY Arduino Humidifier Controller with Relay – Safe High‑Voltage Setup
  5. Build a Custom Arduino Joystick Steering Wheel for Gaming
  6. Arduino 101: Build a Pedometer with DHT11 Sensor & LCD Display
  7. Build an Arduino RGB Color Mixer – Step‑by‑Step Tutorial
  8. PhoneLocator: Securely Locate Your Phone Anywhere
  9. Arduino LED Bar Graph Controlled by Potentiometer
  10. Custom Arduino MIDI Arpeggiator – Modular Firmware & Euclidean Rhythms