In this paper, a hybrid MAC protocol for wireless sensor networks with clustering structure is proposed. Full random multiple access is used within the cluster, and each node competes for the channel. The TDMA scheduling mechanism is adopted between the clusters, and the nodes transmit and receive data in respective time slots according to the pre-assigned time slot table, thereby implementing collision-free communication. The simulation is used to verify the correctness and performance of the protocol. The CC2530 node is used to build a real wireless sensor network. The protocol is designed based on Z-Stack, and the protocol is implemented on the hardware. The results show that the system using this protocol can operate correctly, and the throughput and average delay are in line with the theoretical values.