Skip to content

Harjotraith04/Robotic-Snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Modular Snake Robot - Motion Control System

A highly versatile modular snake robot with multiple locomotion gaits, powered by ESP32 and controlled via Bluepad32 gamepad integration. This project demonstrates various biomimetic snake motions including serpentine movement, rolling, sidewinding, and concertina motion.

Snake Robot Demo

Watch the full demonstration: Snake Robot in Action

๐Ÿ“ธ Project Gallery

Hardware Design Evolution

Snake Robot with Head Snake Robot with Head (View 2)
Snake Robot without Head Snake Robot without Head (View 2)

๐ŸŽฏ Features

  • Multiple Locomotion Gaits: Serpentine, rolling, sidewinding, concertina, and more
  • Gamepad Control: Real-time control using Bluepad32 library
  • Modular Design: 10-11 servo configuration with 2 DOF per module
  • Sensor Integration: VL53L0X ToF sensors for depth analysis and obstacle detection
  • Autonomous Navigation: Path following and hole detection capabilities
  • Three Generations: Continuous hardware and software improvements

๐Ÿ—๏ธ Hardware Components

  • Microcontroller: ESP32 (13, 12, 14, 27, 26, 25, 33, 32, 21, 19, 22 GPIO pins)
  • Servos: 10-11 servos (alternating vertical and horizontal planes)
  • Sensors: 5x VL53L0X Time-of-Flight distance sensors
  • Control: Bluetooth gamepad via Bluepad32
  • Power: Regulated power supply for servos and ESP32

๐ŸŽฎ Motion Modes

1. Serpentine Motion

Classic snake-like forward movement using sinusoidal wave propagation.

Code: snake-serpent/snake-serpent.ino

// Sinusoidal wave parameters
float Wavelengths = 1.5;
int amplitude = 50;
float Speed = 2;

Videos:

  • [Serpentine Motion (1st Gen)](Videos/1st_Generation/Serpentile motion .mp4)
  • [Straight Motion Simulation (3rd Gen)](Videos/3rd_Generation/straigh motion simulation.mp4)
  • [Path Following](Videos/3rd_Generation/path following.mp4)

2. Rolling Motion

Coordinated rolling movement for traversing obstacles and changing direction.

Code: snake-roll-jump/snake-roll-jump.ino

Videos:

  • [Rolling Motion (2nd Gen)](Videos/2nd_Generation/Rolling motion.mp4)
  • [Rolling Motion Trial (3rd Gen)](Videos/3rd_Generation/rolling motion trial.mp4)
  • [Rolling Motion Full (3rd Gen)](Videos/3rd_Generation/rolling motion.mp4)

3. Sidewinding (CMU)

Lateral undulation inspired by sidewinder rattlesnakes, ideal for sandy terrain.

Code: cmu-2/cmu-2.ino | cmu-side-winding/cmu-side-winding.ino

Videos:

  • CMU Motion (1st Gen)
  • [Side Sliding Motion (1st Gen)](Videos/1st_Generation/side sliding motion.mp4)

4. Forward/Backward Motion

Basic linear movement with two-loop implementation.

Code: forward-moving-two-loops/forward-moving-two-loops.ino | back/back.ino

Videos:

  • [Forward Motion (2nd Gen)](Videos/2nd_Generation/Forward Motion.mp4)
  • [Backward Motion (2nd Gen)](Videos/2nd_Generation/Backward motion.mp4)

5. Circular Motion

Continuous circular head movement and full circular path navigation.

Code: t-move/t-move.ino

Videos:

  • [Circular Head Motion (1st Gen)](Videos/1st_Generation/circular head .mp4)
  • [Circle Motion (3rd Gen)](Videos/3rd_Generation/circle motion.mp4)
  • [Curve Path Motion](Videos/3rd_Generation/curve path motion simulation.mp4)

6. Tunnel/Hole Navigation

Advanced motion for navigating through confined spaces and holes.

Code: tunnel-moving/tunnel-moving.ino | itself-winding/itself-winding.ino

Videos:

  • Hole Detection (1st Gen)
  • [Hole Motion (3rd Gen)](Videos/3rd_Generation/hole motion.mp4)
  • [Hole Motion Full (3rd Gen)](Videos/3rd_Generation/hole motion full.mp4)

7. Depth Analysis

Real-time depth sensing and environment analysis using ToF sensors.

Videos:

  • [Depth Analysis (1st Gen)](Videos/1st_Generation/Depth Analysis.mp4)
  • [Depth Analysis 2 (1st Gen)](Videos/1st_Generation/depth analysis_2.mp4)

8. Gamepad Control System

Complete wireless control with customizable commands.

Code: controller-commands/controller-commands.ino | command-new/command-new.ino | command-snake/command-snake.ino

๐Ÿš€ Getting Started

Prerequisites

# Arduino IDE or PlatformIO
# ESP32 Board Package
# Required Libraries:
- ESP32Servo
- Bluepad32
- Wire (I2C)
- VL53L0X
- Adafruit_PWMServoDriver

Installation

  1. Clone this repository:
git clone <your-repo-url>
cd Motions
  1. Install required libraries in Arduino IDE:

    • Sketch โ†’ Include Library โ†’ Manage Libraries
    • Search and install: ESP32Servo, Bluepad32, VL53L0X, Adafruit PWM Servo Driver
  2. Select Board:

    • Tools โ†’ Board โ†’ ESP32 Arduino โ†’ ESP32 Dev Module
  3. Upload desired motion code:

    • Open any .ino file from the motion folders
    • Select correct COM port
    • Upload

Hardware Setup

  1. Servo Connections:

    • Servo 0: GPIO 13
    • Servo 1: GPIO 12
    • Servo 2: GPIO 14
    • Servo 3: GPIO 27
    • Servo 4: GPIO 26
    • Servo 5: GPIO 25
    • Servo 6: GPIO 33
    • Servo 7: GPIO 32
    • Servo 8: GPIO 21
    • Servo 9: GPIO 19
    • Servo 10: GPIO 22
  2. I2C Sensors (VL53L0X):

    • SDA: GPIO 4
    • SCL: GPIO 5
    • Multiple sensors with address multiplexing (GPIO 15, 2, 18, 23)

๐Ÿ“ Project Structure

Motions/
โ”œโ”€โ”€ snake-serpent/          # Serpentine locomotion
โ”œโ”€โ”€ snake-roll-jump/        # Rolling motion
โ”œโ”€โ”€ cmu-2/                  # CMU sidewinding implementation
โ”œโ”€โ”€ cmu-side-winding/       # Alternative sidewinding
โ”œโ”€โ”€ forward-moving-two-loops/  # Forward motion
โ”œโ”€โ”€ back/                   # Backward motion
โ”œโ”€โ”€ controller-commands/    # Main gamepad control system
โ”œโ”€โ”€ command-new/            # Updated command interface
โ”œโ”€โ”€ command-snake/          # Snake command wrapper
โ”œโ”€โ”€ t-move/                 # Circular/turning motion
โ”œโ”€โ”€ tunnel-moving/          # Tunnel navigation
โ”œโ”€โ”€ itself-winding/         # Self-winding motion
โ”œโ”€โ”€ Photos/                 # Hardware images
โ””โ”€โ”€ Videos/                 # Motion demonstrations
    โ”œโ”€โ”€ 1st_Generation/     # Early prototype videos
    โ”œโ”€โ”€ 2nd_Generation/     # Improved design videos
    โ””โ”€โ”€ 3rd_Generation/     # Latest generation videos

๐ŸŽ“ Development Timeline

1st Generation

  • Initial motion calibration
  • Basic serpentine and sidewinding
  • Depth analysis implementation
  • Proof of concept for hole navigation

Videos: Videos/1st_Generation/

2nd Generation

  • Improved rolling mechanics
  • Forward and backward motion refinement
  • Better servo synchronization

Videos: Videos/2nd_Generation/

3rd Generation

  • Path following capabilities
  • Advanced curve navigation
  • Hole detection and navigation
  • Motion simulation improvements

Videos: Videos/3rd_Generation/

๐ŸŽฎ Controller Mapping

When using controller-commands/controller-commands.ino:

  • Left Stick: Manual servo control
  • Right Stick: Speed adjustment
  • D-Pad: Preset motion selection
  • Buttons: Mode switching and calibration

๐Ÿ”ง Configuration

Adjusting Wave Parameters (Serpentine)

int amplitude = 50;           // Wave amplitude (degrees)
float Wavelengths = 1.5;      // Number of waves along body
float Speed = 2;              // Movement speed

Servo Calibration

int offsets[] = {0, 45, 90, 135, 180, 225, 270, 315, 360, 405, 450};

Sensor Sensitivity

// Adjust distance thresholds in controller-commands.ino
// Variables: a, b, c, d, e (sensor readings)

๐Ÿ“Š Performance Metrics

  • Speed: Variable (configurable via code)
  • Servos: 10-11 DOF
  • Sensor Range: VL53L0X (up to 2m)
  • Control Latency: ~50ms (Bluetooth gamepad)
  • Power: 5V servo power + 3.3V ESP32

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new motion gaits
  • Improve existing code
  • Add documentation

๐Ÿ“ License

This project is open-source. Please provide attribution when using or modifying the code.

๐Ÿ™ Acknowledgments

  • Carnegie Mellon University (CMU) for sidewinding algorithms
  • Bluepad32 library developers
  • Arduino and ESP32 community
  • VL53L0X sensor integration examples

๐Ÿ“ž Contact

For questions or collaborations, please open an issue in this repository.


โญ If you find this project interesting, please star the repository!

๐ŸŽฅ Video Gallery

Motion Calibration Sequence

  • [Calibration 1](Videos/1st_Generation/Motion calibration_1.mp4)
  • [Calibration 2](Videos/1st_Generation/Motion calibration_2.mp4)
  • [Calibration 3](Videos/1st_Generation/Motion calibration_3.mp4)
  • [Calibration 4](Videos/1st_Generation/motion calibration_4.mp4)

Path Following Demonstrations

  • [Path Following Full Trial](Videos/3rd_Generation/path following full trial.mp4)
  • [Path Following Curve](Videos/3rd_Generation/path following curve .mp4)

About

ESP32-powered modular snake robot with 8+ motion gaits, Bluepad32 gamepad control, ToF sensors, and autonomous navigation. Arduino-based locomotion system with 10 DOF.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages