Hemio: the Hemispherical Robot
by vikramksc2604 in Circuits > Electronics
534 Views, 2 Favorites, 0 Comments
Hemio: the Hemispherical Robot
Hemio the hemispherical bot. This robot unfolds from a bowl/hemisphere shape and can be programmed to move in any direction needed. This instructable contains the instructions to assemble the bot. The bot files can be found on Thingieverse.
Working of this bot can be found here:
Supplies
above are the important components other than the files.
The m2 screws shown: quantity - 15+
Servo motors: x8
16 Channel Servo driver x1
ESP32 x1
Mount a 4 servo motors on the serv_hold part as shown.
make screw holes onto this bottom_leg part as shown.
Do the same the top_leg part too.
attach the servo horn to bottom_leg. Similarly repeat for the remaining bottom leg parts.
attach both top_leg and bottom_leg parts to second_servo_holdd part
finally attach the combined parts to the ball_shell part. The rods of the top_leg and bottom_leg part should be inserted into any two holes of the ball_shell part(depending on the height you want to set it).
NOTE: There needs to be one empty hole gap between the rods.
attach the second_servo_holdd part to the first_serv_hold part. repeat for the remaining parts.
finally you will have a cool looking robot, Hemio. You can code the servo motors using your preferred microcontroller.
Servo Driver
Connect all 8 servo motors to this servo driver.
And refer 16 channel seeervo driver connections to esp32 and connect them.
Program Using Esp32
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// Create the PWM servo driver object
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMIN 150 // Minimum pulse length count
#define SERVOMAX 600 // Maximum pulse length count
#define STEP_DELAY 20 // Delay between steps (in milliseconds)
#define STEP_COUNT 10 // Number of steps for the transition
#define x 200
void setup() {
Serial.begin(9600);
pwm.begin();
pwm.setPWMFreq(50); // Analog servos run at ~50 Hz PWM
delay(10);
}
// Convert angle (0 to 180) to pulse length
uint16_t angleToPulse(int angle) {
return map(angle, 0, 180, SERVOMIN, SERVOMAX);
}
// Set custom positions for all 8 servos smoothly
void setServoPositionsSmooth(int targetPositions[8], int currentPositions[8]) {
for (int step = 0; step <= STEP_COUNT; step++) {
for (int i = 0; i < 8; i++) {
// Calculate intermediate position
int intermediatePosition = currentPositions[i] + (targetPositions[i] - currentPositions[i]) * step / STEP_COUNT;
pwm.setPWM(i, 0, angleToPulse(intermediatePosition));
}
delay(STEP_DELAY); // Delay to create smooth motion
}
// Update current positions to the target positions
for (int i = 0; i < 8; i++) {
currentPositions[i] = targetPositions[i];
}
}
void loop() {
static int currentPositions[8] = {45, 45, 45, 45, 45, 45, 45, 45}; // Initial current positions
int targetPositions1[8] = {120, 120, 120, 120, 50, 50, 50, 50}; // First target positions
// Smoothly transition to the first target positions
setServoPositionsSmooth(targetPositions1, currentPositions);
delay(x); // Wait before moving to the next position
// Define the next target positions
int targetPositions2[8] = {30, 30, 30, 30, 80, 80, 80, 80}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions2, targetPositions1);
delay(x); // Wait before the next loop
int targetPositions3[8] = {30, 30, 30, 30, 100,100, 100, 100}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions3, targetPositions2);
delay(x); // Wait before the next loop
int targetPositions4[8] = {30, 30, 30, 30, 130, 130, 130, 130}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions4, targetPositions3);
delay(x); // Wait before the next loop
int targetPositions5[8] = {20, 20, 20, 20, 100,100, 100, 100}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions5, targetPositions4);
delay(x); // Wait before the next loop
int targetPositions6[8] = {20, 20, 20, 20, 80, 80, 80, 80}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions6, targetPositions5);
delay(x); // Wait before the next loop
int targetPositions7[8] = {20, 20, 20, 20, 110, 110, 110, 110}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions7, targetPositions6);
delay(x); // Wait before the next loop
int targetPositions8[8] = {70, 70, 70, 70, 50, 50, 50, 50}; // Next target positions
// Smoothly transition to the next target positions
setServoPositionsSmooth(targetPositions8, targetPositions7);
delay(x); // Wait before the next loop
// You can define more target positions and repeat as needed
}