Software apps and online services
Hand tools and fabrication machines
Something very tragic happened recently in our town. A dog parent took her dog to a lake for swim. She did not notice there was algal blooms. On the way back home, dog started panting, was taken to emergency immediately but could not survive :( Wish parent knew the lake has toxin and could avoided the swim.
We are designing a device equipped with multiple sensors to detect the presence of algae in the water and provide real time update to town residents. This device should be deployed on multiple places in the lakes in our town and residents should get real time update so that they can avoid such incidents.Harmful Algae Bloom (HAB)
Algae are fundamental to life on earth as the foundation of aquatic ecosystems and the originators of the production of oxygen via photosynthesis. Even today algae produce 50% of the oxygen in the earth's atmosphere. All algaes are not harmful.
The term harmful algal bloom (HAB) came about due to minor players in the world of photosynthetic organisms, especially the toxic blue green algae in freshwater lakes, reservoirs, rivers and streams, and toxic diatoms and dinoflagellates like the Florida red tide dinoflagellate Karenia brevis in coastal environments. "Harmful algal bloom" describes overgrowth of these problem species, considered harmful mainly because of their ability to produce toxins.
Blue-green algae, also known as cyanobacteria, occur naturally in lakes and ponds throughout Connecticut. These microscopic organisms often go unnoticed and cause no harm. However, when nutrient loading exceeds certain levels, a water body can experience nuisance blue-green algae blooms that may produce and release toxins. When blue-green algae blooms release toxins, people and animals using the water body for recreation can be affected. It is important to note that not all algae blooms are harmful algae blooms (HABs), but as it is not possible to determine the type of algae within the bloom without a more detailed evaluation. [source] So avoiding contact of the water is the best prevention method for human and pets. Hence any early detection of algae bloom formation is very helpful.Water Parameters and HAB
All above parameters are directly or indirectly related to harmful algae bloom. HABs are photosynthetic - they use carbon dioxide, water and sunlight to produce glucose and oxygen. This process reduces dissolved carbon dioxide (carbonic acid, H2Co3) from water, increasing pH level of the water. It has been observed pH level of HAB water reaches 8 to 10.
Study suggest that warming water (ideally between 60 to 80 degree fahrenheit) favors the growth of blue-green HAB. In the east coast of USA, harmful algae blooms occurs from mid summer to early fall.
Turbidity is a measure of water clarity how much the material suspended in water decreases the passage of light through the water. While turbidity is not a cause of HAB but it is a quantitative estimate of the intensity of the bloom once the existence of the bloom is detected.
Produced glucose ( carbon & hydrogen ) are not enough for the growth of microorganism. Nitrogen, phosphorus, sulfur, vitamins and other micro nutrients are obtained from the environment. Presence of these substances in the water increases the reading of TDS. Hence high TDS is an indication of favorable condition.
As you can understand all of the above readings ( and dissolved oxygen which I did not include as I don't have one ) are somehow related to growth of HAB or presence of HAB. Thus using these readings we can predict if harmful algaes are blooming and notify local public agencies for further action.Prototyping
This must be built on low-power micro controller but during prototyping we are using Wio terminal. A TDS ( Total dissolved solids ) sensor, a Turbidity sensor and a pH sensor are connected to the MCU. Reading is taken every hour and transmitted to AWS cloud via Helium network. Device also runs tinyML model to predict normal vs danger water condition based on captured sensor values.
Lora module (Wio Lora Chassis) is connected to the Wio terminal to make the connection between MCU and SenseCAP data only hotspot. There is a dashboard website where each device is mapped and shows real time data.
Town or any organization can subscribe for real time notification by providing a callback endpoint. Every time there is a new data, will be sent to the callback endpoint.
Apart from the sensors and reading, one major thing to consider is power consumption. To minimize power usage, the device will send data every few hours and go to deep sleep rest of the time. Solar panel is also considered. Once the prototype is successful, I would like to engage our town and deploy this devices and make our lakes smart.
Once we have all the sensors connected, we started visiting nearby water bodies and collecting data. A sample data from the backwater lake as below.
The goal is to collect as much data ( with and without algae ) as possible. Due to time constraint for the project submission we have collected limited data so far but that should be enough to build the prototype. We need to continue the effort to collect more and more data.
We have programmed the Wio Terminal's top 3 buttons ( A, B & C) to collect data as csv ( comma separated value ) file.
C = DangerTiny ML
As you can understand all the parameters explained above are related to presence or growth of HAB but building an alerting system based on combination of values is a nightmare. We will be talking about hundreds of IF-ELSE condition in the program and keep updating the program when new set of data is observed. Machine learning makes perfect sense here. We collect data from water where there is no HAB and where we have. Then train the model and predict.
I have used Edge Impulse to collect, label and train the model. Edge Impulse is the leading development platform for machine learning on edge devices and free for developers. Below is how data from one csv file looks like.
For the DSP, I chose raw data to get started and Keras as learning block.
Honestly, though the model is trained, but created with very limited data set. We will have the program flashed on the device but may not be able predict correctly initially. That's why it's important to collect data from real environment after deployment.Solar Panel
12V 3W solar panel with dimension of 145mm by 145mm.
3.7V 2400mAh Lipo battery.
Wio Battery Chassis also has 650mAh 3.7V lipo battery. So total capacity is 3050mAh.
Solar panel current = 3W % 12V = 0.25A = 250mA.
Total charging time = 3050 % 250 = 12.2 hrs. This is a rough estimate. So the goal is to run the device at least a week with battery so that we can run the device with solar forever.
During this prototyping, I have used Wio terminal with display which definitely consumes lot of power and not needed when deployed in real. We should keep the display off and we should use "deep sleep" so that device runs in intervals ( hourly or every 3 hours or every 12 hours) which will use lot less power.
The smart lake device sends data to helium console through LoRaWan protocol. Each device is configured in helium console and integrated with AWS IoT core so that data is forwarded to AWS Cloud for further processing.
Once device is created on helium console, we need to create a label, attach a function to the label and create a flow to connect to AWS.
These steps are documented in one of my past projects. Check out this link.
Also checkout helium documentation for step by step guide to create AWS IoT topic here.
Device is sending 64 bit encoded string which is decoded by helium integration function before sending to AWS. Code can be found in my github repo.
The system is designed keeping "serverless first" approach in mind. It's no-brainer that server less architecture makes perfect sense here as it can scale automatically as load increases.
Once data is received by AWS IoT core ( in the configured topic which was done in helium console), created IoT rule involves the lambda function passing the value.Dashboard
Often we build systems which produce good data but most of the time we can utilize those data as 3rd party applications cannot make use of the data. We thought about this problem and designed a "eventer" system which makes it easy to integrate with external applications via REST api.
External applications such as public health agencies or local town-hall system can sign up to receive events from the "Smart lake" system by providing a callback url and email. This callback url must be a "POST" api. Every time there is a new data from the device, it will be posted to the callback url. Integrator will be notified via email if "Smart lake" system is unable to post the message.