Introduction: Self Balancing Triangle Robot | Balancing Inverted Triangle | With Ultrasonic Sensor, Servo Motor and Arduino | Shifting Centre of Gravity to Balance

This is the triangle. Which will try to balance itself. With the help of all the sensors & actuators on-board. It is an Inverted Triangle. With counterweight on the servo motor to balance itself. And an ultrasonic sensor to detect the falling direction.

When the triangle is upright, its center of gravity remains right above its base.

If the triangle falls left, then the CG Shifts left. And moves beyond the base. so the triangle tips over. The same goes for the right side.


So, to keep it balanced. We have added a servo motor. With counter weight on its shaft. 

Now if the triangle falls on one side, The servo motor will move the weight on the opposite side. So there combined CG remains at the same place.

Supplies

  • Arduino Uno
  • Ultrasonic Sensor (HC SR - 04)x 2
  • Servo Motor (SG - 90)
  • Cardboard
  • Scissors
  • Breadboard
  • Jumper Wires
  • Power Supply

Step 1: Scrap Cardboard Box

Take a scrap cardboard box.

Cut it as per your requirement.

Then fold it to form a prism shape.

Stick it with tape.

This will be the body or fuselage of the robot.

We will mount a Servo motor on top of it.

The wings will be inserted into their sides.

Step 2: Cutout Wings

From the same cardboard box cut out two longer pieces for making wings.

Step 3: Join Wings With Fuselage

Make holes on either side of the fuselage.

The dimensions of the hole must be equal to that of wings.

Step 4: Make Holes in Fuselage

Take reference to an ultrasonic sensor and make some marking on the wings.

These markings need to be cut out and the sensor will be inserted into them.

Step 5: Ultrasonic Sensors

Take two ultrasonic sensors.

There are two sensors. But, the other sensor is just for equal dead weight, it is not connected.

Step 6: Inserting Ultrasonic Sensors

Inserted these sensors into the holes on the wings.

Step 7: After Inserting Sensors

This is how it looks like after inserting sensors on both of its wings

Step 8: The Servo Motor With Link Attached

Take a servo motor.

Take a long metal link and attach it to the horn on the servo motor.

Some weights can also be attached to this link.

Step 9: Making Holes in Fuselage

Make some holes on the fuselage to mount a servo motor.

Step 10: After Attaching All Sensors & Actuators

Attach the servo motor on the fuselage with the help of a string/ zip tie/ wire.

Step 11: Circuit Schematic & Simulation TinkerCAD

This is the circuit schematic of the self-balancing triangle.

Step 12: Interfacing With Microcontroller

Write the code and upload it to the microcontroller.

The code should have logic such that whenever the triangle falls on the left side, the link is moved right. And whenever the triangle falls towards the right, the link should be moved left. To counterbalance. 

Step 13: Working

When the triangle is upright, its center of gravity remains right above its base.

If the triangle falls left, then the CG Shifts left. And moves beyond the base. so the triangle tips over. The same goes for the right side.

We have added a servo motor. With counter weight on its shaft. Now if the triangle falls on one side, The servo motor will move the weight on the opposite side. So there combined CG remains at the same place.

Step 14: Conclusion

We are not able to balance the triangle. But no regrets. We will modify it further. to make it balance itself in its next version.

Robotics EveryDay!!!

Step 15: Full Video Demonstration

Step 16: The Code for Self Balancing Triangle Robot

Code for the self-balancing Inverted triangle.

#include <Servo.h>
Servo m;

int t = 6;
int e=  7;
double d,dp=0;

void setup() {

  pinMode(t, OUTPUT);  //trigger pin
  pinMode(e, INPUT);  //echo pin
  m.attach(3);       // motor at pin 3

}

int distance(){
  
  long duration, cm;
  
  digitalWrite(t, LOW);
  delayMicroseconds(2);
  digitalWrite(t, HIGH);
  delayMicroseconds(5);
  digitalWrite(t, LOW);
  
  duration = pulseIn(e, HIGH);


  cm = duration/ 29 / 2;
  
  return cm; //returns distance in centimeters
}

void loop() {

  d = distance();
  
  if(d<18 && d>0){
    m.write(180 - ((dp*0.95 + d*0.05)*10));
    
  }
  
  dp=d;
  delay(25);
}


Step 17: CAD Design

Step 18: Circuit Schematic for Self Balancing Triangle

Toys and Games Contest

Participated in the
Toys and Games Contest