James Joule demonstrated the link between mechanical work done and temperature change. He conducted a series of experiments showing that doing work resulted in an increase in temperature proportional to the amount of work done, allowing for experimental uncertainty.
In many of his experiments the work was done by a falling weight. This could be used to force water to flow through narrow tubes, to compress air in a cylinder or to stir water in a cylinder, resulting in an increase in temperature in each case. By carefully measuring the increase in temperature, Joule managed to formulate 'a mechanical equivalent of heat', or find the amount of work that needed to be done in order to raise the temperature of water by a fixed amount.
One arrangement is shown below.
Turning the pulley raises the mass. As it falls, the mass turns the paddles and churns up the water, raising it's temperature. Repetition of this process enabled him to shown that a specific temperature rise required a specific amount of work to be done by the falling mass. Joule was so attentive to detail, he even attempted to take into account the energy lost due to the sound made when the mass hit the ground. This was needed because the temperature rise was extremely small, even for a large mass. He used a mass of about 300 kg, but this was only sufficient to produce a temperature rise of about half of less than two degrees when falling through a distance of one metre.
Now we would do the following calculation, equating the decrease in gravitational potential energy of the mass to the increase in heat energy of the water. Suppose there is 0.5 kg of water (with specific heat capacity 4180 J/kg/K).
Experiments of the same sort (using electricity and heating elements instead of falling masses and paddles) are used now to find heat capacities and specific heat capacities, published in tables and widely used.