Spider Tank Robot

by Ashu503 in Circuits > Arduino

53 Views, 3 Favorites, 0 Comments

Spider Tank Robot

SPIDY FRONT PAGE1.jpg

The inspiration for this project came from the spider tank built by Jaimie Mantzel about a decade ago. While the leg movement is somewhat similar to the Klann mechanism, this design uses two motors, one to drive the legs and another to control direction. I thought it would be exciting to create my version, and here it is being powered by an Arduino and supported by a custom-built PCB controlled by an App.

The app features two modes: Manual and Autonomous. In Manual mode, users control the robot via arrow buttons on the phone, with a center button for stopping or sounding a horn. In Autonomous mode, the robot uses an ultrasonic sensor to navigate and avoid obstacles automatically. A toggle switch allows switching between modes, and Start/Stop buttons control the autonomous function

Supplies

ATmega328PMicrocontroller.jpg
CH340G.jpg
dip-socket.jpg
HC-05.jpg
l293d.jpg
lipo.jpg
MG90.jpg
N20.jpg
ULTRASONIC.jpg
microusb break 1.jpg
16MHZ_Crystal.jpg

Electronics Parts:

1 x Atmega328P IC

1x L293D Motor driver IC

1x CH340G USB-to-Serial IC

1x Micro USB breakout board

1 x 16 MHz Crystal

1 x 12 MHz Crystal

2 x AMS1117-5v

4 x 25v Tantalum capacitor

1 x DIP16 and DIP28 sockets

1 x push button

1x DPDT Switch 6X6x6 mm

1x Ultrasonic Sensor

1x HC-05 Module

2 x N20 Gear motor

1 x MG90s servo

1 x passive buzzer

2 x Lipo battery

few ceramic capacitors and resistors all 1206 size for SMD.

Mechanical Parts :

31x M2 x 6mm Screws

17x M2 x 10mm Screws

9x M2 x 4mm Screws

6x M2 x 8mm Screws

3x M3 x 14mm Screws

2x M3 x 12mm Screws

6 x 8mmOD x 3mm ID x 4mm Ball Bearings

Designing

SPIDY 10.jpg
SPIDY1.jpg
SPIDY2.jpg
SPIDY3.jpg
SPIDY4.jpg
SPIDY5.jpg
SPIDY6.jpg
spidy7.jpg
SPIDY8.jpg
spidy9.jpg

The robot is based on a crankshaft mechanism that drives six legs using a synchronized linkage system. The core structure consists of six short links, each connected at one end to the lower platform and at the other to the lower cage. These short links serve as the primary transmission elements for converting rotary motion into the coordinated leg movements.

Attached to each of these short links is a component referred to as a "feety" — essentially the contact point or foot of the robot. Each short link is responsible for powering a single feety, making up the basic leg unit. To achieve coordinated and stable walking motion, three additional side links are connected to these feeties and converge at a central component known as the trilink. The trilink serves as a common hub that interconnects the movement of all six legs, enabling them to work in synchronized pairs.

The robot’s six legs operate in two pairs, with each pair consisting of three feeties spaced 120 degrees apart around the robot’s body. This radial symmetry ensures balanced locomotion and stability during movement.

Directional control is achieved using an N20 motor, which drives a rotating gear mechanism mounted between the upper and lower body. The motor allows the upper body to rotate independently of the lower body, effectively changing the orientation of the robot without altering the gait direction. A key structural feature is the rotating collar that connects the upper and lower bodies. This collar acts as a bearing system that not only keeps both sections physically joined but also enables smooth and unrestricted rotation of the upper body.

3d Printing

PRINTED PARTS 1.jpg

All mechanical parts of the crank-based hexapod robot were 3D printed using PolyMaker PLA filament for a good balance of strength, ease of printing, and surface finish. The prints were done at a layer resolution of 200 microns, providing sufficient detail for moving linkages and functional joints. Rafts and supports were not required, as the parts were oriented to minimize overhangs and ensure clean adhesion. A 20% infill was used to keep the components lightweight while maintaining the structural integrity of the crank mechanism and legs.

Assembling the Parts

building 1.jpg
building 2.jpg
building 3.jpg
building 4.jpg
building 5.jpg
building 6.jpg
building 7.jpg
building 8.jpg
building 9.jpg
building.jpg

Steps for assembling the robot:

A - Lower Cage Apply plastic-safe grease in the screw cups. Use 3x M2x6mm screws to attach Short Links to Lower Cage. Tighten fully, then back off 1.5 full turns. There should be about 0.6mm of play.

A - Lower Platform Apply plastic-safe grease in the screw cups and channels. Use 3x M2x6mm screws to attach Short Links to Lower Platform. Use 3x M2x10mm screws to attach Slide Link to Lower Platform. Tighten fully, then back off 1.5 full turns. There should be about 0.6mm of play

A - Tri-Link Apply plastic-safe grease in the screw cups. Use 3x M2x6mm screws to attach the Tri-Link to the Slide Links. Tighten fully, then back off 1.5 full turns. There should be about 0.6mm of play.

A - Feeties Use 12x M2x6mm screws to attach the Leg Shield to the Feeties (optional, can be glued). Apply plastic-safe grease in the screw holes of the links. Use 6x M2x4mm screws to join the Lower Cage and Lower Platform. Use 12x M2x10mm screws to attach the feeties

A - Rotary Gear Grease mating area of Rotary Collar and Rotary Gear. Insert the rotary collar underneath the Rotary Gear, and use 3x M2x4mm screws to attach the Rotary Gear to the Lower Platform.

B – Drive Gears Apply plastic-safe grease to gear surfaces. Use greased 2x M3x14mm screws to attach the Gears to the drive platform. Insert motors into Drive Platform, and attach pinion gears, making sure Drive Gears are aligned.

B – Plunger Use greased 2x M3x12mm screws 2x 8mm ID x 3mm ID x 4mm bearings to attach the Plunger to Drive Gears.

B – Drive Cage Use 8x M2x6mm screws to secure the Drive Cage to the Drive Platform, and to attach the servo.

A & B – Merge Assemblies Grease the rotation end of the plunger and the top of the rotary gear. Use M2x10mm screws to attach the Drive Platform to the Rotary Collar. Attach the TriLink to the Plunger with greased M3x14mm screw.

C – Head Bracket & Platform Use 6x M2x8mm screws to secure.

C – PCB & Cover Secure the sensor into the bracket, and attach with M2x6mm screws.Use M2 Standoffs and M2 Screws to attach PCB. Alternate holes may need to be drilled depending on your board size.

Making Circuit

schematic SPIDY.jpg
sch2.jpg
sch1.jpg

Before starting the PCB design, I first prototyped the entire circuit on a breadboard to ensure that all components and connections worked as intended. This phase was quite challenging, particularly because I had to build a USB-to-TTL interface from scratch using the CH340G IC, instead of using a ready-made module. The CH340G required careful setup, including connecting the crystal oscillator (typically 12 MHz), the necessary load capacitors, and proper wiring of the TXD, RXD, D+, D−, and USB connector pins. In addition to this, I used the ATmega328P as a standalone microcontroller, which meant adding an external 16 MHz crystal with two 22pF capacitors, a pull-up resistor on the RESET pin, decoupling capacitors for power stability, and proper VCC/GND routing.

Getting everything to work on the breadboard involved a fair amount of debugging—checking voltages with a multimeter, verifying the serial communication using a terminal, and ensuring reliable programming through the CH340G interface using the Arduino IDE. This hands-on step was crucial because it allowed me to confirm the microcontroller's behavior outside of the Arduino board environment, and made me more aware of the real-world spacing, wiring complexity, and noise issues that could arise. These learnings directly informed the layout decisions in the PCB design phase, where I had limited space (63 × 43 mm) and only two layers to work with.

Testing

test run
servo test

This was the first test run of the circuit, and although it was functional, some work still remains to be done.

Designing PCB

PCB 6.jpg
PCB 7.jpg
pcb3.jpg
pcb4.jpg
PCB5.jpg
PCB7.jpg
PCB8.jpg
c58e774e-ac5c-4b17-ad4b-15cdeae20c81.jpg
pcb1.jpg
pcb2.jpg

The PCB was designed using Altium Designer. It is a 2-layer board with dimensions of approximately 63×43 mm, matching the size of the PCB cover. Designing within such a compact area was quite challenging, especially during the routing phase, which proved to be the most difficult part of the process.

Code

#include <SoftwareSerial.h>

#include <Servo.h>

#include <NewPing.h>

#include "pitches.h"

#include <avr/wdt.h>


//Create software serial object to communicate with HC-05

SoftwareSerial mySerial(3, 2); //HC-05 Tx & Rx is connected to Arduino #3 & #2


char Options=0;

#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor.

#define ECHO_PIN 7 // Arduino pin tied to echo pin on the ultrasonic sensor.

#define MAX_DISTANCE 20 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

#define LED 8 // LED on pin 8

#define BUZZER_PIN 13 // Buzzer is on Pin 13

#define servoPin 11 // Servo on Pin 11


//Motor Walking

const int motorPin1 = 9;

const int motorPin2 = 10;

//Motor Turning

const int motorPin3 = 4;

const int motorPin4 = 12;


long timeInMicro;

long distanceInCm;


int ledstate=LOW;

unsigned long currentMillis=0;

unsigned long previousMillis=0;

const unsigned long period = 500;


unsigned long preservo1=0;

int servo1state=HIGH;

const int on=5000;

const int off=1500;


// Creating Servo Object

Servo servo;

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);


// Define a simple pattern for a robotic sound

int melody[] = {

NOTE_C4, NOTE_E4, NOTE_G4, NOTE_C5,

NOTE_G4, NOTE_E4, NOTE_C4,

NOTE_C4, NOTE_E4, NOTE_G4, NOTE_C5,

NOTE_G4, NOTE_E4, NOTE_C4,

REST, NOTE_D4, NOTE_F4, NOTE_A4, NOTE_D5,

NOTE_A4, NOTE_F4, NOTE_D4,

NOTE_D4, NOTE_F4, NOTE_A4, NOTE_D5,

NOTE_A4, NOTE_F4, NOTE_D4

};


int durations[] = {

8, 8, 8, 8,

8, 8, 8,

8, 8, 8, 8,

8, 8, 8,

16, 8, 8, 8, 8,

8, 8, 8,

8, 8, 8, 8,

8, 8, 8

};




void setup()

{

wdt_disable();

//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)

Serial.begin(9600);

//Begin serial communication with Arduino and HC-05

mySerial.begin(9600);


Serial.println("Initializing...");

Serial.println("The device started, now you can pair it with bluetooth!");


pinMode(LED,OUTPUT);

pinMode(motorPin1, OUTPUT);

pinMode(motorPin2, OUTPUT);

pinMode(motorPin3, OUTPUT);

pinMode(motorPin4, OUTPUT);

pinMode(ECHO_PIN,INPUT);

pinMode(TRIGGER_PIN,OUTPUT);

pinMode(BUZZER_PIN, OUTPUT);

servo.write(83);

servo.attach(servoPin);

}


void loop()

{

if (mySerial.available()) {

Options=mySerial.read();

if (Options == 'F' || Options == 'B' || Options == 'L' || Options == 'R' || Options == 'H') {

manual();

}


else if (Options == 'A') {

automatic();

}

}

}


/********************************************* MANUAL MODE ********************************************/


void manual() {

if (Options == 'F') {

FORWARD();

Serial.println("FORWARD");

}

else if (Options == 'B') {

//BACKWARD();

Serial.println("BACKWARD");

}

else if (Options == 'L') {

LEFT();

Serial.println("LEFT");

}

else if (Options == 'R') {

RIGHT();

Serial.println("RIGHT");

}

else if (Options == 'H') {

STOP();

Serial.println("STOP");

}

}


/******************************************** AUTOMATIC MODE *******************************************/


void automatic() {


while (true) {


SERVO();

blinkLED();


if (Distance() <= 15 && Distance() != 0) {

STOP();

Serial.println("Obstacle detected, stopping!");

delay(500);


// Rotate left until a clear path is found

while (true) {

LEFT();

int checkDistance = Distance();


if (checkDistance > 15 || checkDistance == 0) {

delay(1200);

STOP();

Serial.println("Clear path found, moving forward");

break;

}

}

}

else {

FORWARD();

Serial.println("Moving forward");

}


if(mySerial.read() == 'E'){

break;

}

}

}


void RIGHT(){

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, LOW);

}


void BACKWARD(){

digitalWrite(motorPin1, HIGH);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

}


void LEFT(){

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, HIGH);

}


void FORWARD(){

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

}


void STOP(){

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

}


void SERVO(){

if(servo1state==HIGH){

if((millis()-preservo1) >= on){

servo1state=LOW;

preservo1=millis();

servo.write(63);

}

}

else{

if((millis()-preservo1) >= off){

preservo1=millis();

servo1state=HIGH;

servo.write(83);

}

}

}


void blinkLED(){

if(currentMillis - previousMillis >= period){

previousMillis=currentMillis;


if(ledstate == LOW){

ledstate=HIGH;

}

else{

ledstate=LOW;

}


digitalWrite(LED,ledstate);

}

}


int Distance(){


delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.

distanceInCm=sonar.ping_cm();


return distanceInCm;

}


void SONG(){

int size = sizeof(durations) / sizeof(int);


for (int note = 0; note < size; note++) {

int duration = 1000 / durations[note];

if (melody[note] == REST) {

delay(duration);

} else {

tone(BUZZER_PIN, melody[note], duration);

}


int pauseBetweenNotes = duration * 1.30;

delay(pauseBetweenNotes);


noTone(BUZZER_PIN);

}

// Add a delay between each repetition of the sound pattern

delay(1000);

}

Downloads

Building the App

app1.jpg
APP2.jpg
APP3.jpg
APP4.jpg
app5.jpg
APP6.jpg
APP7.jpg
APP8.jpg

I made this mobile application using MIT App Inventor. The app consists of a total of three screens. The first screen is a loading screen, the second is the mode selection screen, and the third is the controller interface. In the controller screen, there are four arrow buttons for controlling the movement direction of the robot—forward, backward, left, and right. A central button serves as both a stop button and a horn. Additionally, there is a toggle switch that allows the user to switch between MANUAL and AUTONOMOUS modes. The Start and Stop buttons are specifically used to activate or deactivate the AUTONOMOUS mode as needed.

Demonstration

RUN1
RUN2

Here is the demo of how the robot work

Conclusion

PS1.jpg
PS2.jpg
PS3.jpg

I had initially planned to add a separate PCB for battery charging using TP5100 modules, but that has now been deferred to a future upgrade. Additionally, the robot's passive buzzer could be used creatively to play different sounds or simple tunes, adding an extra layer of interactivity and feedback.