This paper is concerned with flexural vibrations of smart beams. Layers made of piezoelectric material are used to perform a distributed sensing of strains. In the present contribution, special emphasis is given to the sensor shaping problem, which can be stated as follows: Seek a shape function of the distributed sensor such that a mechanical interpretation of the sensor output is possible, e.g. to interpret the output as deflection, or as a slope. The scope of the present contribution is to find a class of easy to obtain analytic solutions of this inverse problem, and to present an experimental verification. Within the context of the Bernoulli-Euler beam theory, sensor equations are derived taking into account the coupling of mechanical and electrical fields. The principle of virtual work is then applied to derive integral equations for the structural deformations e.g. deflection, slope, curvature. Comparing these integral equations, the above sensor shaping problem is solved. Beams with different boundary conditions are considered. Furthermore, shape functions responsible for non-uniqueness of the shaping problem are derived. These nilpotent solutions may be added to the above derived solution of the sensor shaping problem without influencing the measured sensor signal. The analytical results of the sensor shaping problem are realized in a series of experiments for a cantilever beam, without and including a redundant support. Deflections measured by the new type of distributed piezoelectric sensor are compared to laser based distance measurements. Excellent coincidence between these measurements is found.