Wireless sensor networks is an area with great demand because of the major advantages such as ever present and easy interconnection thus leading to various application areas. But the major constraint is sensor node being tiny and absence of battery backup. Improved network lifetime is major research area in which the work focuses upon the overall energy consumption. One such attempt is this paper in which various parameters were considered for which energy is consumed in the network. And after analyzing the various equations and relations linked to the energy consumption, this paper has mainly focused upon optimizing length of packet to be transmitted.