--------------------------------------------------------------------------------------------------------------------------------------------------------------
Another approach with LM7805 voltage regulator IC (use this if you want to use battery as power source):- https://www.instructables.com/id/IOT-Based-Water-Level-Controller-Using-NodeMCU-ESP/
--------------------------------------------------------------------------------------------------------------------------------------------------------------