Clustering in wireless sensor networks (WSNs) provides scalability and robustness for the network; it allows spatial reuse of the bandwidth, simpler routing decisions, and results in decreased energy dissipation of the whole system by minimizing the number of nodes that take part in long distance communication. Clustering allows for data aggregation which reduces congestion and energy consumption. Recent study in battery technology reveals that batteries tend to discharge more power than needed and reimburse the over-discharged power if they are recovered. In this paper, we first provide an online mathematical battery model suitable for implementation in sensor networks. Using our battery model, we propose a new Battery Aware Reliable Clustering (BARC) algorithm for WSNs. BARC incorporates many features which are missing in many other clustering algorithms. It rotates cluster heads (CHs) according to a battery recovery scheme and it also incorporates a trust factor for selecting cluster heads thus increasing reliability. Most importantly, our proposed algorithm relaxes many of the rigid assumptions that the other algorithms impose such as the ability of the cluster head to communicate directly with the base station and having a fixed communication radius for intra-cluster communication. BARC uses Z-MAC which has several advantages over other MAC protocols. Simulation results show that using BARC prolongs the network lifetime greatly in comparison to other clustering techniques.