This article presents a new consensus-based control method for hybrid energy storage system (HESS) with a cascaded multiport converter in the DC microgrid. The cascaded multiport converter has two stages, where the first stage is for the supercapacitor and the second stage is for the batteries. The two-stage structure can reduce the component rating of the second stage since the batteries are indirectly connected to the DC bus via the supercapacitor at the first stage. Additionally, the second stage with multiple ports is able to integrate multiple batteries. The HESS balances the power mismatch between the generation of the photovoltaics (PV) and the dissipation of the loads, as well as maintains the bus voltage of the DC microgrid. To solve the state-of-charge (SOC) imbalance of multiple batteries for the long lifespan of HESS, a consensus-based control method is developed in this paper to equalize the SOCs among multiple batteries. The consensus-based method can accommodate a varying number of batteries, which enables the plug-And-play operation. A hardware-in-loop (HIL) setup is adopted to implement the DC microgrid, including the HESS using the cascaded multiport converter and the PV. The HIL experimental results demonstrate the effectiveness of the proposed consensus-based control method.