Construye un Robot Bípede Arduino: Guía DIY Baby Dino
Componentes y materiales
| Componente | Cantidad |
|---|---|
| Arduino Mega 2560 (también sirve Uno o Nano) | 1 |
| Batería 9V (o LiPo 2S) | 1 |
| Sensor ultrasónico HC-SR04 | 1 |
| Micro-servos SG90 9g | 5 |
Sobre el proyecto
Baby Dino es un robot bípedo basado en Arduino. Usa 5 servos: dos por pierna (cadera y tobillo) y uno para la cabeza. Incluye sensor ultrasónico para detectar y esquivar obstáculos. ¡Vamos a construirlo!
Paso 1: Introducción
- Robot DIY con Arduino.
- Estructura de cartón.
- Detecta obstáculos y gira izquierda/derecha.
Paso 2: Componentes requeridos
- 1x Arduino Uno, Nano o Mega
- 5x Servos 9g (SG90)
- 1x Sensor ultrasónico HC-SR04
- 1x Batería LiPo 2S o 9V
Paso 3: Calibrar servos (fix.ino)
- Descarga y sube el programa
fix.ino. - Conecta servos según esquema.
- Coloca los cuernos de servo a 90° (posición central).
#include <Servo.h>
Servo s1, s2, s3, s4, s5;
void setup() {
s1.attach(8); s2.attach(9); s3.attach(10); s4.attach(11); s5.attach(12);
}
void loop() {
s1.write(90); s2.write(90); s3.write(90); s4.write(90); s5.write(90);
}
Paso 4: Diseño y corte
- Descarga plantilla (PDF en adjuntos).
- Imprime en A4, pega en cartón, recorta.
Paso 5: Montaje final
- Fija servos al cartón.
- Sube el programa principal
biped.ino(uBipedino.ino). - Conecta servos y sensor ultrasónico según esquema.
- Organiza cables como "cola".
- Conecta batería.
Código principal (biped.ino / uBipedino.ino)
Edita los pines de servos y ultrasónico según tu cableado.
#include <Servo.h>
#include <NewPing.h>
// Pines (ajusta a tu conexión)
#define IRsensorPin 13 // Si usas sensor IR en lugar de ultrasónico
#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define LEFTLEG 7
#define RIGHTLEG 10
#define LEFTFOOT 8
#define RIGHTFOOT 9
#define HEAD 6
#define MAX_DISTANCE 200
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
Servo Lleg, Rleg, Lfoot, Rfoot, Head;
int Hcenter = 70;
int RLcenter = 100, RFcenter = 65;
int LLcenter = 90, LFcenter = 75;
int tAngle = 30, uAngle = 35, sAngle = 35;
int hAngle = Hcenter;
void Forward(byte Steps, byte Speed) {
Serial.println("Forward");
TiltRightUp(tAngle, Speed);
for (byte j = 0; j < Steps; ++j) {
SwingRight(sAngle, Speed);
TiltRightDown(tAngle, Speed);
TiltLeftUp(tAngle, Speed);
SwingRcenter(sAngle, Speed);
SwingLeft(sAngle, Speed);
TiltLeftDown(tAngle, Speed);
TiltRightUp(tAngle, Speed);
SwingLcenter(sAngle, Speed);
}
TiltRightDown(tAngle, Speed);
}
void TurnLeft(byte Steps, byte Speed) {
Serial.println("TurnLeft");
TiltLeftUp(uAngle, Speed); delay(20);
for (byte j = 0; j < Steps; ++j) {
LeftLegIn(sAngle, Speed);
TiltLeftDown(uAngle, Speed);
TiltRightUp(uAngle, Speed); delay(20);
LeftLegIcenter(sAngle, Speed);
RightLegOut(sAngle, Speed);
TiltRightDown(uAngle, Speed);
TiltLeftUp(uAngle, Speed); delay(20);
RightLegOcenter(sAngle, Speed);
}
TiltLeftDown(uAngle, Speed);
}
void TurnRight(byte Stps, byte Speed) {
Serial.println("TurnRight");
TiltRightUp(uAngle, Speed); delay(20);
for (byte f = 0; f <= Stps; ++f) {
RightLegIn(sAngle, Speed);
TiltRightDown(uAngle, Speed);
TiltLeftUp(uAngle, Speed); delay(20);
RightLegIcenter(sAngle, Speed);
LeftLegOut(sAngle, Speed);
TiltLeftDown(uAngle, Speed);
TiltRightUp(uAngle, Speed); delay(20);
LeftLegOcenter(sAngle, Speed);
}
TiltRightDown(uAngle, Speed);
}
void HeadRight() { Serial.println("HeadRight"); Head.write(Hcenter - 105); delay(1000); }
void HeadLeft() { Serial.println("HeadLeft"); Head.write(Hcenter + 105); delay(1000); }
void HeadCenter(){ Serial.println("HeadCenter"); Head.write(Hcenter); delay(1000); }
void TiltRightUp(byte ang, byte sp) { for (int i=0;i<=ang;i+=5){ Lfoot.write(LFcenter+i); Rfoot.write(RFcenter+i); delay(sp);} }
void TiltRightDown(byte ang, byte sp){ for (int i=ang;i>0;i-=5){ Lfoot.write(LFcenter+i); Rfoot.write(RFcenter+i); delay(sp);} }
void TiltLeftUp(byte ang, byte sp) { for (int i=0;i<=ang;i+=5){ Lfoot.write(LFcenter-i); Rfoot.write(RFcenter-i); delay(sp);} }
void TiltLeftDown(byte ang, byte sp) { for (int i=ang;i>0;i-=5){ Lfoot.write(LFcenter-i); Rfoot.write(RFcenter-i); delay(sp);} }
void SwingRight(byte ang, byte sp) { for (int i=0;i<=ang;i+=5){ Lleg.write(LLcenter-i); Rleg.write(RLcenter-i); delay(sp);} }
void SwingRcenter(byte ang, byte sp) { for (int i=ang;i>0;i-=5){ Lleg.write(LLcenter-i); Rleg.write(RLcenter-i); delay(sp);} }
void SwingLeft(byte ang, byte sp) { for (byte i=0;i<=ang;i+=5){ Lleg.write(LLcenter+i); Rleg.write(RLcenter+i); delay(sp);} }
void SwingLcenter(byte ang, byte sp) { for (byte i=ang;i>0;i-=5){ Lleg.write(LLcenter+i); Rleg.write(RLcenter+i); delay(sp);} }
void RightLegIn(byte ang, byte sp) { for (int i=0;i<=ang;i+=5){ Rleg.write(RLcenter-i); delay(sp);} }
void RightLegIcenter(byte ang, byte sp){ for (int i=ang;i>0;i-=5){ Rleg.write(RLcenter-i); delay(sp);} }
void RightLegOut(byte ang, byte sp) { for (int i=0;i<=ang;i+=5){ Rleg.write(RLcenter+i); delay(sp);} }
void RightLegOcenter(byte ang, byte sp){ for (int i=ang;i>0;i-=5){ Rleg.write(RLcenter+i); delay(sp);} }
void LeftLegIn(byte ang, byte sp) { for (byte i=0;i<=ang;i+=5){ Lleg.write(LLcenter+i); delay(sp);} }
void LeftLegIcenter(byte ang, byte sp) { for (byte i=ang;i>0;i-=5){ Lleg.write(LLcenter+i); delay(sp);} }
void LeftLegOut(byte ang, byte sp) { for (byte i=0;i<=ang;i+=5){ Lleg.write(LLcenter-i); delay(sp);} }
void LeftLegOcenter(byte ang, byte sp) { for (byte i=ang;i>0;i-=5){ Lleg.write(LLcenter-i); delay(sp);} }
void setup() {
Serial.begin(19200);
Serial.println("Bipedino setup is running.");
Lleg.attach(LEFTLEG); Rleg.attach(RIGHTLEG);
Lfoot.attach(LEFTFOOT); Rfoot.attach(RIGHTFOOT);
Head.attach(HEAD);
CenterServos(); delay(500);
for (int i=0;i<5;++i){ GetSonar(); delay(1000); }
Serial.println("Bipedino is ready.");
}
void loop() {
unsigned int cmCenter = MAX_DISTANCE, cmLeft = MAX_DISTANCE, cmRight = MAX_DISTANCE;
HeadCenter(); cmCenter = GetSonar();
if (cmCenter < 20) {
HeadRight(); cmRight = GetSonar(); HeadCenter();
if (cmRight > 20) { TurnRight(1, 30); }
else {
HeadLeft(); cmLeft = GetSonar(); HeadCenter();
if (cmLeft > 20) { TurnLeft(1, 30); }
}
} else {
int nSteps = cmCenter / 5;
if (nSteps > 5) nSteps = 5;
else nSteps = 1;
Serial.print("Steps <"); Serial.print(nSteps); Serial.println(">");
for (int n=0; n
Esquemático de conexiones
Ver imagen en sección "Schematics". Conexiones típicas: servos en pines 6-11, ultrasónico Trig 12 / Echo 11, alimentación 9V a Vin/GND.
Proceso de manufactura
- Chupete: Diseño, Normas de Seguridad y Perspectivas de Fabricación
- Portabebés: Historia, diseño y seguridad de los portabebés infantiles
- La ciencia y mercado de las toallitas para bebé: Materiales, fabricación y tendencias futuras
- Fórmula Infantil: Ciencia, Producción y Perspectivas Futuras
- La Evolución y Fabricación de Cochecitos de Bebé: De Cunas Portátiles a Coches Modernos
- Construye un Spybot controlado por Bluetooth con Arduino
- FlickMote: Mando IR por gestos para Smart Home
- TV‑B‑Gone DIY con Arduino: Mando universal para apagar cualquier TV
- Construye un Reloj Maestro LED Personalizado con Alarma – Visible desde 12 Metros
- Robot evasor de obstáculos con servo: Construcción con Arduino y HC-SR04
- Find Me: Localizador Inteligente de Objetos con Arduino y Bluetooth