A wireless sensor network (WSN) is made up of sensor nodes (SNs), which collect and analyze data in real time about important software, hardware, and environmental aspects. This network gathers and analyzes data from many sources. Mobile sinks (MS) offer various advantages in WSNs, particularly in large networks. MS have gained popularity in recent years due to the several benefits they provide, including lower energy consumption, fewer isolated nodes, and a longer network lifetime. SNs consume significantly less energy while gathering data from an MS that is moving throughout the sensing field. However, the most significant obstacles in the sensing sector are the selection of cluster heads (CHs) and the development of an algorithm for MS data collection. This research describes on-demand data collection using a mobile sink (ODDCMS), a new approach for obtaining MS data for rechargeable wireless sensor networks (RWSNs). This approach is intended to address the issue that was previously mentioned. To begin, the BMUPOA algorithm is used to perform the best clustering technique. This is done while taking into account a variety of constraints, such as distance, energy, and delay. A certain number of CHs is established when the sensor field is divided into different groups. In response to CH requests, data from CHs is obtained through MS using the defined ODDCMS algorithm. To evaluate ODDCMS’s efficacy, we compare it to various algorithms currently in use, including EDEDA (J Ambient Intell Humaniz Comput 14(9):11671–11684, 2023), VGRSS (Wireless Netw 26:3763–3779, 2020), PSOBS (Wireless Pers Commun 104:199–216, 2019), and RkM (AEU Int J Electron Commun 73:110–118, 2017). Furthermore, for varying numbers of sensor nodes, ODDCMS outperforms EDEDA, VGRSS, PSOBS, and RkM by 5, 16.64, 26.51, and 28.89%, respectively.