The optimal transmit power of a sensor node while satisfying different rate constraints is derived. First, an optimization problem with an instantaneous transmission rate constraint is addressed. Next, the optimal power is analyzed, but now with an average transmission rate constraint. The optimal solution for a class of fading channels, in terms of system parameters, is presented and a suboptimal solution is also proposed for an easier, yet efficient, implementation. Insightful asymptotical analysis for both schemes, considering a Rayleigh fading channel, are shown. Finally, the optimal power allocation for a sensor node in a cognitive radio environment is analyzed where an optimum solution for a class of fading channels is again derived. In all cases, numerical results are provided for either Rayleigh or Nakagami-m fading channels.