Despite the significant limits put on the resources of the sensor nodes, such as storage, processing power, communication range, and energy, the spectrum of applications for wireless sensor networks (WSNs) is expanding. This is the case even though WSNs have severe limitations. The primary goals of a WSN are to reduce the amount of energy used and the amount of time it takes to transmit data to the sink node. When a significant number of nodes are being installed, as is the situation with monitoring industrial pollutants, this becomes an extremely important point of discussion. We present an energy-efficient and resilient routing method for wireless sensor networks (WSNs) dubbed ELDC that is based on artificial neural networks. In this method, the network is trained on a massive data set that encompasses the vast majority of possible situations. This helps the network become more dependable and responsive to its surroundings. In addition to this, it makes use of a technique that is based on groups, with the understanding that the sizes of the groups might vary. This helps to extend the life of the network as a whole. An artificial neural network enables intelligent, efficient, and robust group organization by providing efficient threshold values for the selection of a group’s chief node and a cluster head based on the back propagation technique. These threshold values are provided by an artificial neural network. As a result, the method that we have suggested is very good at saving energy and is able to extend the life of sensor nodes.