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

by Python EveryDay in Circuits > Robots

2396 Views, 18 Favorites, 0 Comments

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

Self Balancing Triangle Robot | Balancing Inverted Triangle | Ultrasonic Sensor Servo Motor Arduino

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

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

Scrap Cardboard Box

IMG_20220228_192855_HDR.jpg

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.

Cutout Wings

IMG_20220228_194026_HDR.jpg

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

Join Wings With Fuselage

IMG_20220228_200830_HDR.jpg

Make holes on either side of the fuselage.

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

Make Holes in Fuselage

IMG_20220228_201203_HDR.jpg

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.

Ultrasonic Sensors

IMG_20220305_164302_HDR.jpg

Take two ultrasonic sensors.

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

Inserting Ultrasonic Sensors

IMG_20220228_201810_HDR.jpg

Inserted these sensors into the holes on the wings.

After Inserting Sensors

IMG_20220228_203159_HDR.jpg

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

The Servo Motor With Link Attached

IMG_20220305_164654_HDR.jpg

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.

Making Holes in Fuselage

IMG_20220305_165446_HDR.jpg

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

After Attaching All Sensors & Actuators

IMG_20220305_163852_HDR.jpg

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

Circuit Schematic & Simulation TinkerCAD

Self Balancing Triangle.png

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

Interfacing With Microcontroller

IMG_20220305_164333_HDR.jpg
IMG_20220305_165232_HDR.jpg

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. 

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.

Conclusion

IMG_20220305_163934_HDR.jpg

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!!!

Full Video Demonstration

Self Balancing Triangle Robot | Balancing Inverted Triangle | Ultrasonic Sensor Servo Motor Arduino

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);
}


CAD Design

Circuit Schematic for Self Balancing Triangle