This paper presents an unobtrusive method for automatic detection of atrial fibrillation (AF) from single-channel ballistocardiogram (BCG) recordings during sleep. We developed a remote data acquisition system that measures BCG signals through an electromechanical-film sensor embedded into a bed's mattress and transmits the BCG data to a remote database on the cloud server. In the feasibility study, 12 AF patients' data were recorded during entire night of sleep. Each BCG recording was split into nonoverlapping 30s epochs labeled either AF or normal. Using the features extracted from stationary wavelet transform of these epochs, three popular machine learning classifiers (support vector machine, K-nearest neighbor, and ensembles) have been trained and evaluated on the set of 7816 epochs employing 30% hold-out validation. The results showed that all the trained classifiers could achieve an accuracy rate above 91.5%. The optimized ensembles model (Bagged Trees) could achieve accuracy, sensitivity, and specificity of 0.944, 0.970 and 0.891, respectively. These results suggest that the proposed BCG-based AF detection can be a potential initial screening and detection tool of AF in home-monitoring applications.