Modern electric vehicles (EVs) and hybrid electric vehicles (HEVs) require a reliable battery management system (BMS). The remaining energy and the state-of-energy (SoE) are very important indexes for the embedded BMS used in both EV and HEV applications. As a case study in the embedded BMS, this paper presents the implementation of remaining energy prediction based on the μC/OS-II real time operating system (RTOS). In considering that there are accumulated errors caused by inevitable drift noise of the current or voltage sensors, a model based SoE estimator is developed based on a first-order RC equivalent circuit model. Moreover, the Bayesian learning technique is used for SoE estimation to get accurate and robustness estimation results. Lastly, two different kinds of batteries are carried out under laboratory experiments and real road test to verify the robustness of the proposed SoE estimation approach. The results indicate that the maximum absolute estimation error (MAEE) and the root-mean square error (RMSE) are within 2% and 1% for both LiFePO4 and Li(Ni1/3Co1/3Mn1/3)O2 batteries.