Recently, energy harvesting has been emerging as a promising technique to prolong the lifetime for wireless sensor nodes. Most existing efforts address the design of energy harvesting and sensor node subsystem separately or ignore some real-world constraints. In this paper, we study how to codesign the two subsystems and how to jointly manage energy harvesting, storage, and usage. We first propose a novel system architecture for energy harvesting which employs several supercapacitors to eliminate the conflicts on charging and discharging among different system components. Then, we present a method to schedule their charging and discharging, which is proved to be able to guarantee zero waste of the harvested energy if the battery is not full. Third, we propose an optimal algorithm to minimize different components' capacity and two heuristic algorithms to maximize the system reward. We conduct extensive experiments based on real-life data traces. Results show that the proposed system architecture can harvest more energy compared to the state of the art, and the capacity optimization algorithm can choose the most suitable size for each system component.