Current technology trends indicate an advancement in digital world, where we focus on reducing the size of electronic equipments and work on increasing their functionality. Basically, we are switching to portable devices with efficient communication capabilities. These devices are battery powered and thus battery lifetime is one of the most important parameters while designing a communication system. The concept of harvesting energy wirelessly is thus trending in the technological world. This paper aims to work in a collaborative system prototype that harvest energy wirelessly along with accommodating a large number of users using spectrum sharing in a cognitive system. We implement a Particle Swarm Optimization (PSO) algorithm to overcome the limitations of power constraints as well as spectrum unavailability, using a cooperative protocol. © 2017 IEEE.