Using IoT and Machine Learning to Help Protect Kenya's Rivers

Posted by Ciira wa Maina on June 6, 2020

The Ewaso Nyiro (also Ewaso Ng'iro) is one of the major rivers that dot the Kenyan landscape and its magnificent waters have served communities in its path for millenia. Its waters are drawn from Mt Kenya and snake their way through diverse landscapes before joining the Jubba river in Somalia and eventually making their way to the Indian Ocean. All along its path, it serves as a lifeline for several communities; from farmers in Nyeri and Laikipia to pastoralists in the arid and semiarid areas of Samburu and Isiolo.

In recent years, increased demand for water to irrigate crops as well as reduced rainfall and land degradation in the catchment area have led to water shortage and conflict between the users of the river's water. To ensure equitable distribution of this vital resource and the detection of unsustainable water usage and destruction of the catchment, effective monitoring of the river is essential.

Since 2018, we have been developing appropriate systems for remote monitoring of water resources and have recently deployed prototypes along the Ewaso Nyiro as we continue to improve our systems. The hope is that we will be able to develop low cost devices capable of large scale deployment along the river's course. Access to data collected by these systems on river parameters such as river height, flow rate and turbidity could then be used to ensure sustainable use of the water and protection of the catchment.

Ewaso Nyiro River
Ewaso Nyiro River
The Ewaso Nyiro at different points on its course.

Initial prototypes were developed by Jared Makario, an intern at the Dedan Kimathi University of Technology (DeKUT) Center for Data Science and Artificial Intelligence (DSAIL) and deployed at DeKUT's wildlife conservancy in Nyeri. These initial prototypes used an STM32 Nucleo board which contains an ARM®32-bit Cortex®-M4 processor and a custom LoRaWAN transceiver.

Initial Prototype
Initial Prototype
Initial prototypes deployed at the DeKUT conservancy.

Our most recent systems have been developed by Jason Kabi, another DSAIL intern, and are based on the mDot™ which is an Arm® Mbed™ programmable LoRa module. They incorporate a Maxbotix ultrasonic sensor for river level measurement and a custom PCB was designed and etched at our labs to house all the components. Sensors to measure other parameters are being tested and will be incorporated in future.

PCB
PCB
PCB
PCB
The improved prototype etched onto a PCB.

The system was deployed at the Ol Pejeta Conservancy which is located within the Ewaso Nyiro basin. The conservancy is home to several species of wildlife including lions, rhinos, buffalo and zebra and a wildlife Tech lab was recently set up at the conservancy to develop and test conservation technology. After our initial system was destroyed by baboons, we designed a baboon proof cage and have been receiving data since early May 2020.

Improved Prototype
Improved Prototype
Systems deployed at the Ol Pejeta conservancy. The initial system (left) was destroyed by baboons. Our current system is protected by a cage (right).

In addition to sensor development, we have developed a web application for data visualisation and analysis. We are also developing machine learning methods to deal with anomalous sensor measurements and make predictions. In future we plan to incorporate multiple data sources such as weather and satellite imagery to build water level prediction models.

App Output
Mean river height as displayed on the app.

Acknowledgements

We would like to thank William Njoroge and the management at Ol Pejeta for allowing us to test our systems at the conservancy and allowing us to use the Tech Lab to prepare and test our systems. We also thank the wardens at Ol Pejeta for help with the deployment. We thank ARM for support acquiring hardware and for technical support. Also, Stephen Wamae from DeKUT has been a great help during sensor development and deployment.

Fieldwork Photos

A Buffalo at Ol Pejeta
Mounting the LoRaWAN gateway.
At the Tech Lab
Sensor deployment
At the equator
At the Tech Lab