We propose the wireless sensor network (hereinafter – WSN) and gateway initialization protocol for autonomous network operation. The proposed algorithm operates in WSN divided into two layers: the first is a gateway layer and the second is the sensor node layer. Sensor nodes are divided into clusters, and cluster sinks are chosen using the clustering algorithm. The research focuses on the gateway layer, where mobile gateways are implemented. It is intended to provide gateway mobility by using quadcopters, because they have easier access to energy resources, i.e., if a battery is nearly depleted a quadcopter can fly to the base and recharge it and the movements of a quadcopter are easily controlled. The proposed initialization algorithm ensures that gateways can move in WSN field without human interference and relay data from WSN to a user.