In this paper we discuss a scheme that allows sensor networks to operate securely and efficiently. In this scheme after deployment the sensors go through a self-organization phase when they establish a communication pattern among themselves; then they follow this pattern through multiple activity phases when they collect, process, and transmit information. The algorithm for self-organization assumes anonymous sensors and random times of the communication events, as well as random communication frequencies; the sensors use random number generators and a set of shared seeds so no external entity can either join in, or predict the time when the sensors in the set will transmit and attempt to interfere with the transmissions. The scheme extends the lifetime of the network by reducing the power consumption; it minimizes the number of collisions experienced by a sensor when it transmits and maximizes the time a sensor is either idle or dedicated to monitoring and/or internal data processing.