This project demonstrates the implementation and simulation of the LEACH protocol in Contiki-NG using the Cooja simulator.
(Under Ubuntu) Clone the Contiki-NG repository:
git clone https://github.com/contiki-ng/contiki-ng
cd contiki-ng- Run Cooja Navigate to the Cooja tool directory and run it:
cd ~/contiki-ng/tools/cooja
./gradlew run- Implement LEACH Protocol
cd ~/contiki-ng/examples/nullnetAdd the following files:
- Makefile
- leach.c
- leach_edgegateway.c
For LEACH-C protocol, use leach_c.c and leach_c_edge_gateway.c.
-
Create a Simulation in Cooja
-
File → New simulation → Create
-
Motes → Add motes → Create new mote type → Cooja mote
-
Press open, compile, and create the mote
-
Choose the number of motes you want to create
Repeat the same steps for leach_edge_gateway.c and create 1 gateway mote.
- Run the Simulation Press Start / Pause to start the simulation Observe the network behavior under the LEACH protocol
Tips: Ensure Java is installed for Cooja Use leach_c.c and leach_c_edge_gateway.c for LEACH-C implementation Adjust the number of motes to see how network performance scales
Processes:
- Main process
- CH selection process
- CH advertisement process
- Non CH advertisement process
- TDMA schedule creation process
- TDMA data transmission process
- CH data fusion process
(8. Energy calculation process)
- Free variable process
- LEACH: W. R. Heinzelman, A. Chandrakasan and H. Balakrishnan, "Energy-efficient communication protocol for wireless microsensor networks," Proceedings of the 33rd Annual Hawaii International Conference on System Sciences, Maui, HI, USA, 2000, pp. 10 pp. vol.2-, doi: 10.1109/HICSS.2000.926982. keywords: {Energy efficiency;Wireless application protocol;Wireless communication;Microsensors;Energy dissipation;Routing protocols;Telecommunication network reliability;Monitoring;Spread spectrum communication;Scalability},
- LEACH-C: W. B. Heinzelman, A. P. Chandrakasan and H. Balakrishnan, "An application-specific protocol architecture for wireless microsensor networks," in IEEE Transactions on Wireless Communications, vol. 1, no. 4, pp. 660-670, Oct. 2002, doi: 10.1109/TWC.2002.804190. keywords: {Wireless application protocol;Microsensors;Energy efficiency;Delay;Signal processing algorithms;Remote monitoring;Intelligent networks;Robustness;Wireless communication;Access protocols},
- Developed as part of the UCSC CSE257 Masters course.