Step-by-Step Guide to DIY Biped Robot Using Proteus

This article will explain how to DIY a biped robot. The hardware system of the biped robot mainly includes the microcontroller minimum system circuit, PWM circuit, indicator light circuit, independent key circuit, and power supply circuit. The main design requirements for this biped robot circuit are as follows:

· The microcontroller minimum system can output 6 PWM channels simultaneously, and even more.
· The power supply circuit includes the microcontroller minimum system power supply circuit and the servo power supply circuit.
· An indicator light should be lit when the microcontroller minimum system is working.
· The rotation angle range for each servo is from -90 degrees to 90 degrees.
· An independent key is set to start the biped robot’s actions.
· An independent key is set to stop the biped robot’s actions.

1. Hardware Circuit Design

1.1 Microcontroller Minimum System Circuit

Create a new simulation project file and name it “TwoFootRobot”. The microcontroller minimum system circuit includes the microcontroller circuit, crystal oscillator circuit, and reset circuit. The microcontroller minimum system circuit is shown in Figure 1-1. The main function of the microcontroller minimum system circuit is to drive multiple servos via the IIC protocol.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-1 Microcontroller Minimum System

1.2 Power Supply Circuit

The voltage of commonly used lithium batteries is about 3.7V, while the power supply for the biped robot usually requires 3 lithium batteries in series to meet both voltage and size/weight requirements. The power supply circuit mainly consists of 3 voltage regulator circuits: the first voltage regulator circuit is composed of components like 7805, converting +11.1V voltage to +5V to power the microcontroller minimum system circuit, independent key circuit, and PWM circuit; the second voltage regulator circuit is composed of components like 7806, converting +11.1V voltage to +6V to power servo 0, servo 1, and servo 2; the third voltage regulator circuit is also composed of components like 7806, converting +11.1V voltage to +6V to power servo 3, servo 4, and servo 5. The power supply circuit drawn in Proteus software is shown in Figure 1-2.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-2 Power Supply Circuit

Tip
◎ Search for “7805” in the component library to find the 7805 voltage regulator chip.

◎ Search for “7806” in the component library to find the 7806 voltage regulator chip.

1.3 PWM Circuit

The PWM circuit is mainly composed of the PCA9685 component, which can output a maximum of 16 PWM signals. The PWM circuit drawn in Proteus software is shown in Figure 1-3. Pin 27 of the PCA9685 component connects to IO18 of the Arduino microcontroller via the network labeled “SDA”, pin 26 connects to IO19 via the network labeled “SCL”, pins 23 and 25 are connected to the “GND” network, and pins 1, 2, 3, 4, 5, and 24 also connect to the “GND” network, which means they are set to low level. Pins 6 to 22 can be connected to different servos through different network labels.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-3 PWM Circuit

Tip

◎ Search for “PCA9685” in the component library to find the PCA9685 chip.

1.4 Servo Circuit

The servo circuit mainly consists of 6 servos. The servo circuit drawn in Proteus software is shown in Figure 1-4. Double-click on servo 0 to open the “Edit Component” dialog, set the Part Reference to SERVO0, Minimum Angle to -90.0, Maximum Angle to +90.0, Rotational Speed to 60, Minimum Control Pulse to 0.5m, and Maximum Control Pulse to 2.5m, as shown in Figure 1-5. Other servos can be set up similarly.

Servo SERVO0’s first pin connects to the first power supply circuit via the network labeled “+12V”, the second pin connects to PCA9685’s pin 6 via the network labeled “OUT0”, and the third pin connects to the “Ground” network; servo SERVO1’s first pin connects to the first power supply circuit via the network labeled “+12V”, the second pin connects to PCA9685’s pin 7 via the network labeled “OUT1”, and the third pin connects to the “Ground” network; servo SERVO2’s first pin connects to the first power supply circuit via the network labeled “+12V”, the second pin connects to PCA9685’s pin 8 via the network labeled “OUT2”, and the third pin connects to the “Ground” network; servo SERVO3’s first pin connects to the second power supply circuit via the network labeled “+12V”, the second pin connects to PCA9685’s pin 9 via the network labeled “OUT3”, and the third pin connects to the “Ground” network; servo SERVO4’s first pin connects to the second power supply circuit via the network labeled “+12V”, the second pin connects to PCA9685’s pin 10 via the network labeled “OUT4”, and the third pin connects to the “Ground” network; servo SERVO5’s first pin connects to the second power supply circuit via the network labeled “+12V”, the second pin connects to PCA9685’s pin 11 via the network labeled “OUT5”, and the third pin connects to the “Ground” network.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-4 Servo Circuit

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-5 Servo Parameter Settings

1.5 Independent Key Circuit

The independent key circuit of the biped robot mainly consists of independent keys, capacitors, and resistors. The independent key circuit drawn in Proteus software is shown in Figure 1-6. The independent key circuit connects to the first power supply circuit via the network labeled “SYS+5V”. The independent key KEY1 connects to IO6 of the Arduino microcontroller via the network labeled “IO6”, and the independent key KEY2 connects to IO7 of the Arduino microcontroller via the network labeled “IO7”.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-6 Independent Key Circuit

1.6 Indicator Light Circuit

The indicator light circuit of the biped robot mainly consists of light-emitting diodes and resistors. The indicator light circuit drawn in Proteus software is shown in Figure 5-2-6. The LED D2 connects to IO11 of the Arduino microcontroller via the network labeled “IO11”, and the LED D3 connects to IO12 of the Arduino microcontroller via the network labeled “IO12”.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 1-6 Indicator Light Circuit

2. Microcontroller Program Design

2.1 Main Program Functions

Enter the main programming interface of the biped robot. In the main function program, define the functions of the microcontroller pins, setting the Arduino microcontroller pins 13, 12, and 11 to output mode to drive the LEDs, and setting pins 6 and 7 to input mode to receive input signals from the independent keys. The specific program is as follows:

//int LED = 13;
pinMode(13, OUTPUT);
//int LED1 = 11;
pinMode(11, OUTPUT);
//int LED2 = 12;
pinMode(12, OUTPUT);
pinMode(6, INPUT);
// int key1 = digitalRead(6);
pinMode(7, INPUT);
// int key2 = digitalRead(7);

In the Loop() function, you can set the actions of the biped robot. When the independent key KEY2 is pressed, the LED D2 lights up, the LED D3 goes out, and the servos start to execute actions. When the independent key KEY1 is pressed, the LED D2 goes out, the LED D3 lights up, and the servos stop executing actions. The specific program is as follows:

void loop()
{
// Drive each servo one at a time
Serial.println(servonum);
digitalWrite(13,HIGH);
if(digitalRead(6))
{
delay(50);
if(digitalRead(6))
mm = 1;
while(digitalRead(6))
{
}
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
}
if(digitalRead(7))
{
delay(50);
if(digitalRead(7))
mm = 2;
while(digitalRead(7))
{
}
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
}
if(mm == 0)
{
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
}
if(mm == 1)
{
pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 90);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 90);
pwm.setPWM(5, 0, 90);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
}
if(mm == 2)
{
pwm.setPWM(0, 0, 480);
pwm.setPWM(1, 0, 480);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 480);
pwm.setPWM(5, 0, 480);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
}
if(mm == 2)
{
delay(100);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);
delay(1000);
pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);
delay(1000);
pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 480); //6
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 480); //7
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 480); //8
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(1000);

pwm.setPWM(0, 0, 480); //9
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(1000);

pwm.setPWM(0, 0, 480); //10
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(1000);

}

2.2 Complete Program

The complete program for the biped robot in main.ino is as follows:

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMIN 150 // this is the ‘minimum’ pulse length count (out of 4096)
#define SERVOMAX 600 // this is the ‘maximum’ pulse length count (out of 4096)
// our servo # counter
uint8_t servonum = 0;
uint8_t mm = 0;
void setup()
{
Serial.begin(9600);
Serial.println(“16 channel Servo test!”);
pwm.begin();
pwm.setPWMFreq(50); // Analog servos run at ~60 Hz updates
//int LED = 13;
pinMode(13, OUTPUT);
//int LED1 = 11;
pinMode(11, OUTPUT);
//int LED2 = 12;
pinMode(12, OUTPUT);
pinMode(6, INPUT);
// int key1 = digitalRead(6);
pinMode(7, INPUT);
// int key2 = digitalRead(7);
}
// you can use this function if you’d like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
double pulselength;
pulselength = 1000000; // 1,000,000 us per second
pulselength /= 60;
Serial.print(pulselength); Serial.println(” us per period”);
pulselength /= 4096; // 12 bits of resolution
Serial.print(pulselength); Serial.println(” us per bit”);
pulse *= 1000;
pulse /= pulselength;
Serial.println(pulse);
pwm.setPWM(n, 0, pulse);
digitalWrite(13,HIGH);
}
void loop()
{
// Drive each servo one at a time
Serial.println(servonum);
digitalWrite(13,HIGH);
if(digitalRead(6))
{
delay(50);
if(digitalRead(6))
mm = 1;
while(digitalRead(6))
{
}
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
}
if(digitalRead(7))
{
delay(50);
if(digitalRead(7))
mm = 2;
while(digitalRead(7))
{
}
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
}
if(mm == 0)
{
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
}
if(mm == 1)
{
pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 90);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 90);
pwm.setPWM(5, 0, 90);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
}
if(mm == 2)
{
pwm.setPWM(0, 0, 480);
pwm.setPWM(1, 0, 480);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 480);
pwm.setPWM(5, 0, 480);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
}
if(mm == 2)
{
delay(100);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);
delay(1000);
pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);
delay(1000);
pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 480); //6
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 480); //7
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);
delay(1000);
pwm.setPWM(0, 0, 480); //8
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(1000);

pwm.setPWM(0, 0, 480); //9
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(1000);

pwm.setPWM(0, 0, 480); //10
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(1000);

}

PWM Configuration Resource File Program:

#include <Adafruit_PWMServoDriver.h>
#include <Wire.h>
#if defined(__AVR__)
#define WIRE Wire
#elif defined(CORE_TEENSY) // Teensy boards
#define WIRE Wire
#else // Arduino Due
#define WIRE Wire1
#endif
// Set to true to print some debug messages, or false to disable them.
#define ENABLE_DEBUG_OUTPUT true
Adafruit_PWMServoDriver::Adafruit_PWMServoDriver(uint8_t addr) {
_i2caddr = addr;
}
void Adafruit_PWMServoDriver::begin(void) {
WIRE.begin();
reset();
}
void Adafruit_PWMServoDriver::reset(void) {
write8(PCA9685_MODE1, 0x0);
}
void Adafruit_PWMServoDriver::setPWMFreq(float freq) {
//Serial.print(“Attempting to set freq “);
//Serial.println(freq);
freq *= 0.9; // Correct for overshoot in the frequency setting (see issue #11).
float prescaleval = 25000000;
prescaleval /= 4096;
prescaleval /= freq;
prescaleval -= 1;
if (ENABLE_DEBUG_OUTPUT) {
Serial.print(“Estimated pre-scale: “); Serial.println(prescaleval);
}
uint8_t prescale = floor(prescaleval + 0.5);
if (ENABLE_DEBUG_OUTPUT) {
Serial.print(“Final pre-scale: “); Serial.println(prescale);
}
uint8_t oldmode = read8(PCA9685_MODE1);
uint8_t newmode = (oldmode&0x7F) | 0x10; // sleep
write8(PCA9685_MODE1, newmode); // go to sleep
write8(PCA9685_PRESCALE, prescale); // set the prescaler
write8(PCA9685_MODE1, oldmode);
delay(5);
write8(PCA9685_MODE1, oldmode | 0xa1); // This sets the MODE1 register to turn on auto increment.
// This is why the beginTransmission below was not working.
// Serial.print(“Mode now 0x”); Serial.println(read8(PCA9685_MODE1), HEX);
}
void Adafruit_PWMServoDriver::setPWM(uint8_t num, uint16_t on, uint16_t off) {
//Serial.print(“Setting PWM “); Serial.print(num); Serial.print(“: “); Serial.print(on); Serial.print(“->”); Serial.println(off);
WIRE.beginTransmission(_i2caddr);
WIRE.write(LED0_ON_L+4*num);
WIRE.write(on);
WIRE.write(on>>8);
WIRE.write(off);
WIRE.write(off>>8);
WIRE.endTransmission();
}
// Sets pin without having to deal with on/off tick placement and properly handles
// a zero value as completely off. Optional invert parameter supports inverting
// the pulse for sinking to ground. Val should be a value from 0 to 4095 inclusive.
void Adafruit_PWMServoDriver::setPin(uint8_t num, uint16_t val, bool invert)
{
// Clamp value between 0 and 4095 inclusive.
val = min(val, 4095);
if (invert) {
if (val == 0) {
// Special value for signal fully on.
setPWM(num, 4096, 0);
}
else if (val == 4095) {
// Special value for signal fully off.
setPWM(num, 0, 4096);
}
else {
setPWM(num, 0, 4095-val);
}
}
else {
if (val == 4095) {
// Special value for signal fully on.
setPWM(num, 4096, 0);
}
else if (val == 0) {
// Special value for signal fully off.
setPWM(num, 0, 4096);
}
else {
setPWM(num, 0, val);
}
}
uint8_t Adafruit_PWMServoDriver::read8(uint8_t addr) {
WIRE.beginTransmission(_i2caddr);
WIRE.write(addr);
WIRE.endTransmission();
WIRE.requestFrom((uint8_t)_i2caddr, (uint8_t)1);
return WIRE.read();
}
void Adafruit_PWMServoDriver::write8(uint8_t addr, uint8_t d) {
WIRE.beginTransmission(_i2caddr);
WIRE.write(addr);
WIRE.write(d);
WIRE.endTransmission();

}

PWM Configuration Header File:

#ifndef _ADAFRUIT_PWMServoDriver_H
#define _ADAFRUIT_PWMServoDriver_H
#if ARDUINO >= 100
#include “Arduino.h”
#else
#include “WProgram.h”
#endif
#define PCA9685_SUBADR1 0x2
#define PCA9685_SUBADR2 0x3
#define PCA9685_SUBADR3 0x4
#define PCA9685_MODE1 0x0
#define PCA9685_PRESCALE 0xFE
#define LED0_ON_L 0x6
#define LED0_ON_H 0x7
#define LED0_OFF_L 0x8
#define LED0_OFF_H 0x9
#define ALLLED_ON_L 0xFA
#define ALLLED_ON_H 0xFB
#define ALLLED_OFF_L 0xFC
#define ALLLED_OFF_H 0xFD
class Adafruit_PWMServoDriver {
public:
Adafruit_PWMServoDriver(uint8_t addr = 0x40);
void begin(void);
void reset(void);
void setPWMFreq(float freq);
void setPWM(uint8_t num, uint16_t on, uint16_t off);
void setPin(uint8_t num, uint16_t val, bool invert=false);
private:
uint8_t _i2caddr;
uint8_t read8(uint8_t addr);
void write8(uint8_t addr, uint8_t d);
};

#endif

Execute the command, and after successful compilation, the “VSM Studio Output” bar is shown in Figure 2-1.

Step-by-Step Guide to DIY Biped Robot Using ProteusFigure 2-1 “VSM Studio Output” Bar

3. Overall Simulation Testing

Double-click on the Arduino microcontroller to open the “Edit Component” dialog, and you can see the path of the compiled file in the Program File, as shown in Figure 3-1.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-1 “Edit Component” Dialog

Execute the command to run the biped robot circuit simulation. In the initial state, the Arduino microcontroller’s indicator light is on, indicating that the Arduino microcontroller has started working normally. No LEDs in the indicator light circuit are lit. All 6 servos in the servo circuit are in the 0-degree position, as shown in Figure 3-2.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-2 Simulation Result 1

Click on the independent key KEY1 in the biped robot circuit, and the blue LED in the indicator light circuit lights up while all 6 servos are in the -90-degree position, as shown in Figure 3-3.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-3 Simulation Result 2

Click on the independent key KEY2 in the biped robot circuit, and the green LED in the indicator light circuit lights up. The biped robot’s actions require the cooperation of 6 servos, executing a total of 10 poses in this example. When executing the first pose’s program, the specific program is as follows, where all 6 servos rotate to the 0-degree position, as shown in Figure 3-4.

delay(500);
pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-4 Simulation Result 3

When executing the second pose’s program, the specific program is as follows: SERVO0 rotates to -90 degrees, SERVO3 rotates to +90 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to 0 degrees, and SERVO5 rotates to 0 degrees, as shown in Figure 3-5.

pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 276);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 276);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-5 Simulation Result 4

When executing the third pose’s program, the specific program is as follows: SERVO0 rotates to -90 degrees, SERVO3 rotates to +90 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to -90 degrees, and SERVO5 rotates to +90 degrees, as shown in Figure 3-6.

pwm.setPWM(0, 0, 90);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);

delay(500);

When executing the fourth pose’s program, the specific program is as follows: SERVO0 rotates to 0 degrees, SERVO3 rotates to +90 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to -90 degrees, and SERVO5 rotates to +90 degrees, as shown in Figure 3-7.

pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 90);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-6 Simulation Result 5

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-7 Simulation Result 6

When executing the fifth pose’s program, the specific program is as follows: SERVO0 rotates to 0 degrees, SERVO3 rotates to +90 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to +90 degrees, and SERVO5 rotates to +90 degrees, as shown in Figure 3-8.

pwm.setPWM(0, 0, 276);
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-8 Simulation Result 7

When executing the sixth pose’s program, the specific program is as follows: SERVO0 rotates to +90 degrees, SERVO3 rotates to +90 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to +90 degrees, and SERVO5 rotates to +90 degrees, as shown in Figure 3-9.

pwm.setPWM(0, 0, 480); //6
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 480);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);

delay(500);

When executing the seventh pose’s program, the specific program is as follows: SERVO0 rotates to +90 degrees, SERVO3 rotates to 0 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to +90 degrees, and SERVO5 rotates to +90 degrees, as shown in Figure 3-10.

pwm.setPWM(0, 0, 480); //7
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 480);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-9 Simulation Result 8

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-10 Simulation Result 9

When executing the eighth pose’s program, the specific program is as follows: SERVO0 rotates to +90 degrees, SERVO3 rotates to 0 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to +90 degrees, and SERVO5 rotates to -90 degrees, as shown in Figure 3-11.

pwm.setPWM(0, 0, 480); //8
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 276);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-11 Simulation Result 10

When executing the ninth pose’s program, the specific program is as follows: SERVO0 rotates to +90 degrees, SERVO3 rotates to -90 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to +90 degrees, and SERVO5 rotates to -90 degrees, as shown in Figure 3-12.

pwm.setPWM(0, 0, 480); //9
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(500);

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-12 Simulation Result 11

When executing the tenth pose’s program, the specific program is as follows: SERVO0 rotates to 0 degrees, SERVO3 rotates to 0 degrees, SERVO1 rotates to 0 degrees, SERVO4 rotates to 0 degrees, SERVO2 rotates to 0 degrees, and SERVO5 rotates to 0 degrees, as shown in Figure 3-13.

pwm.setPWM(0, 0, 480); //10
pwm.setPWM(1, 0, 276);
pwm.setPWM(2, 0, 480);
pwm.setPWM(3, 0, 90);
pwm.setPWM(4, 0, 276);
pwm.setPWM(5, 0, 90);

delay(500);

All ten poses will loop to complete the forward rolling action of the biped robot. The forward rolling action programmed in this section may not be universal; readers should write the pose programs based on the actual servo assembly of the biped robot, following the principle of converting actions into several static poses.

Tip
◎ Readers can write programs for other actions of the biped robot.
◎ Readers can increase the number of servos, controlling up to 16 servos.

◎ Scan the QR code below to watch the simulation video of the biped robot’s forward rolling action.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Step-by-Step Guide to DIY Biped Robot Using Proteus

Figure 3-13 Simulation Result 12

4. Design Summary

The biped robot circuit consists of the power supply circuit, microcontroller minimum system circuit, indicator light circuit, servo drive circuit, and PWM circuit, which basically meet the requirements. Readers can DIY a dancing robot based on the design method of this example. In practical applications, the power supply circuit composed of LM7806 should not power multiple servos; otherwise, it may cause damage to the LM7806 and other adverse consequences. When writing the biped robot’s action programs, it is necessary to add a certain delay during pose transitions, as servos require time to rotate to the specified angle.

Step-by-Step Guide to DIY Biped Robot Using Proteus

Step-by-Step Guide to DIY Biped Robot Using Proteus
Source: Proteus Practical Guide: From Simple Circuits to Microcontroller Circuit Simulation
Editor: Zhai Tianrui
Reviewer: Fu Chenggui

Leave a Comment