Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Quadruped Spider Robot with IR Remote and Battery Power

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Quadruped Spider Robot with IR Remote and Battery Power

Circuit Documentation

Summary

This document describes a circuit designed to control a quadruped spider robot using an Arduino UNO microcontroller. The robot has 12 servo motors (3 per leg) and an HC-SR04 ultrasonic sensor for obstacle detection. The circuit is powered by two 18650 Li-ion batteries. The Arduino UNO interprets commands from an IR remote control to move the robot forward, sideways, or make it perform a "hello" gesture.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Tower Pro SG90 Servo (x12)

    • Description: Small and lightweight servo motor.
    • Pins: Signal, +5V, GND
  3. HC-SR04 Ultrasonic Sensor

    • Description: Ultrasonic distance sensor.
    • Pins: VCC, TRIG, ECHO, GND
  4. 18650 Li-ion Battery (x2)

    • Description: Rechargeable lithium-ion battery.
    • Pins: +, -

Wiring Details

Arduino UNO

Tower Pro SG90 Servo (x12)

HC-SR04 Ultrasonic Sensor

18650 Li-ion Battery (x2)

Code Documentation

/*
 * This Arduino sketch controls a quadruped spider robot with 3 servo motors
 * per leg, using an IR receiver to interpret commands from a remote control.
 * The robot moves forward if the up arrow is pressed, sideways if the left or
 * right arrow is pressed, and says hello with one leg if the number 1 is
 * pressed.
 */

#include <Servo.h>
#include <IRremote.h>

#define FORWARD 0xFF629D
#define LEFT 0xFF22DD
#define RIGHT 0xFFC23D
#define HELLO 0xFF6897

const int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
decode_results results;

Servo servos[12];

void setup() {
  irrecv.enableIRIn();
  for (int i = 0; i < 12; i++) {
    servos[i].attach(i);
  }
}

void loop() {
  if (irrecv.decode(&results)) {
    switch (results.value) {
      case FORWARD:
        moveForward();
        break;
      case LEFT:
        moveLeft();
        break;
      case RIGHT:
        moveRight();
        break;
      case HELLO:
        sayHello();
        break;
    }
    irrecv.resume();
  }
}

void moveForward() {
  for (int i = 0; i < 12; i++) {
    servos[i].write(90);
  }
  delay(1000);
  for (int i = 0; i < 12; i++) {
    servos[i].write(0);
  }
  delay(1000);
}

void moveLeft() {
  for (int i = 0; i < 6; i++) {
    servos[i].write(90);
  }
  delay(1000);
  for (int i = 0; i < 6; i++) {
    servos[i].write(0);
  }
  delay(1000);
}

void moveRight() {
  for (int i = 6; i < 12; i++) {
    servos[i].write(90);
  }
  delay(1000);
  for (int i = 6; i < 12; i++) {
    servos[i].write(0);
  }
  delay(1000);
}

void sayHello() {
  servos[0].write(90);
  delay(1000);
  servos[0].write(0);
  delay(1000);
}

This code initializes 12 servo motors and an IR receiver. It listens for IR commands and moves the servos accordingly to make the robot move forward, left, right, or perform a "hello" gesture.