The physical layer key has the characteristics of reducing the difficulty of key distribution, updating and maintenance. This paper aims at the problem that the node transmission information is vulnerable to eavesdropping on wireless sensor networks. Based on the “one time secret” theory in physical layer security, a physical layer key generation method is proposed, which mainly includes channel estimation and characteristics. Extraction, key generation and negotiation. In the half duplex communication mode, according to the length of coherent time in the channel estimation stage, the length of the training sequence is dynamically adjusted to improve the consistency of channel estimation. The simulation test and comparison analysis show that the consistency of the eavesdropping node generation key and the legitimate node generation key remains low, it reduces the risk of eavesdropping attack.