We report on the electric field response of 180 degree nanodomain walls in BaTiO$_3$ using in situ electrical biasing in transmission electron microscopy (TEM). The sample is biased on a micro-device designed for reliable testing whose key attributes are confirmed by finite element calculations. The presence of weakly charged zig-zag domain walls at room temperature is attributed to the geometric confinement of the device. The motion of the domain walls under the applied electric field allows to extract local P-E loops where distinct domain wall pinning in deep and random energy potential profiles, characteristic for hard and soft ferroelectrics, respectively, are observed. Hard domain wall pinning results in asymmetrical loops typical for "hard" ferroelectrics while the soft domain wall pinning follows Rayleigh-like behaviour. All effects are measured locally and directly from the imaged domain structure.