Theory:

When a body is partially or entirely submerged in a fluid, it receives an upward force due to the fluid surrounding it. We also know that pressure is higher at the bottom of the liquid and lower at the top. Therefore, the object is pushed upward by force created by the pressure differences. This is known as buoyant force, and the phenomenon is known as buoyancy.
 
The force that causes an object to float is called buoyancy or buoyant force.
It is the force exerted on a thing that is partly or wholly immersed in a fluid. This is due to the difference in pressure between the top of the submerged object and the bottom. The deeper the object sinks, the more the pressure acting at the bottom of the object. The buoyancy force always points upwards because the pressure of a fluid increases with depth.
 
7 (2).png
Buoyant force acting on the objects

The objects with a relatively high volume and low density are the most buoyant. If the object weighs less than the weight of the water that has displaced(density is low), the buoyant force is greater, and the object floats (referred as positively buoyant). However, if an object's weight exceeds the amount of water it has displaced (density is greater), the buoyant force is reduced, and the object will sink.
  
Cartesian driver:
3 (2).png
Cartesian driver
  
The Cartesian diver is a demonstration of the principle of buoyancy. It is a clay-filled pen cap. The Cartesian diver holds just enough liquid to float in a liquid bath; the rest of its capacity is filled with air. When you press the bath, more water enters the diver, increasing its average density and causing it to sink.