With the rapid development of wireless communications, wireless devices are becoming more popular in everyday life. Currently, wireless devices usually rely on internal batteries to power. However, due to the limited battery capacity, the lifetime of these devices are limited. In addition, for low-power devices such as sensors used in the internet of things, since the number of sensors is very high and sensors may be located in some dangerous or hard access places, it may be hard or impossible to replace or charge the batteries. Therefore, achieving wireless charging of wireless devices has become a major issue. On the other hand, given that the battery capacity of wireless devices are limited, the use of wireless power transfer and energy harvesting from radio frequency signals by these devices is a solution to solve the problem of the battery capacity limitation. In wireless power transfer using radio frequency signals, the source transfers power wirelessly to the wireless devices, and they use this power to extract the energy they need to exchange information. To increase the power extraction, beamforming methods are used in the power transmitter. Moreover, it is very important to consider the quality of service and fairness among users. It takes a lot of energy to transmit information over long distances, but, wireless sensors have limited energy. For this reason, the sensors can send their information to the neighboring sensors and by cooperation, deliver the sensor information to the destination. In this method, it is very important to find the path that has the least energy consumption. Optimal routing algorithms is one of the useful solutions that can be used to reduce energy consumption. In this study, we randomly place a number of sensors in an area and wirelessly send energy to the sensors via a charger station. After extracting the energy, the sensors will send their information to the sink. The goal of this optimization is to maximize the minimum rate of the sensors, so that we have an everlasting wireless sensor network. In the proposed system model, we send the energy to sensors using energy beamforming in downlink and sensors will transmit their information using the harvested energy. The harvested energy is limmited to the considered battery capacity. In uplink, considering the Rayleigh channel and pathloss between the sensor nodes, we calculate the channel capacity using Shannon equation and use it in the optimization problem. We simulate the system and discuss the effects of the number of charger antennas, the range of sensors, battery capacity and channel capacity on the minimum data rate of sensors. The results show that increasing the battery capacity or channel capacity, as well as increasing the sensors range, increases the minimum rate of the sensors. Key Words: Wireless Sensor Networks, Wireless Power Transfer, Beamforming, Routing, Energy Harvesting