Measurement of hardness of tablets