The most important components of the cognitive radio concept is its ability to measure, sense and learn. One also should be aware of the parameters related to the radio channel characteristics and the availability of spectrum and power. In cognitive radio technology, primary users can be defined as the users who have the highest priority on the usage of a specific part of the spectrum. Secondary users, have lower priority, and should not cause any interference to the primary users when using the technology. Therefore, the secondary users need to have certain cognitive radio capabilities, such as sensing the spectrum to check whether it is being used by primary user or not, and changing the radio parameters to exploit the unused part of the spectrum. In this paper we proposed a new approach for spectrum sensing, In the first approach the primary signal is known so we use the code value with match filter to detect the primary user, on the other hand, when the primary user signal is unknown we proposed a new strategy for energy detection in both non-cooperation and cooperation schemes. Then we will prove by simulation results that the new approach is better than the conventional energy detection.