Objective. Measurement of respiratory rate and effort is useful in various applications, such as the diagnosis of sleep apnea and early detection of patient deterioration in medical conditions, such as infections. A chest-worn accelerometer may be an easy and non-intrusive method, provided it is accurate and robust. We investigate the use of a novel method that can perform under realistic sleeping conditions such as variable sensor positions and body posture. Approach. Twenty subjects (aged 46-65 years) wore an accelerometer on the chest and a respiratory impedance plethysmography band as a reference. The subjects underwent an experimental protocol lasting approximately 90 min, under various postures and with different sensor positions. We used a novel, constrained, and recursive form of principal component analysis (PCA) to estimate the respiratory effort signal robustly. To obtain an estimate for the respiratory rate, first, multiple estimates were aggregated into a single frequency. Subsequently, a quality index was determined, such that unreliable estimates could be identified, and a trade-off could be made between coverage (percentage of time that the quality index is above a threshold) and limits of agreement. Main results. Results were determined over all recorded data, including changes in sensor position and posture. For respiratory effort, it was found that recursive and constrained computation of PCA reduced the estimation error significantly. For respiratory rate, a relation between coverage and limits of agreement was determined. If a minimum coverage of 80% was required, the limits of agreement could be kept below 1.45 breaths per minute. If the limits of agreement were constrained to 0.2 breaths per minute, a mean coverage of 5% was still attainable. Significance. We have shown that chest-worn accelerometery can be a robust and accurate method for measurement of respiratory features under realistic conditions.