Difference between revisions of "Fixed Sensor"

From BioDesign for the Real-World
Jump to: navigation, search
(Problem faced during the project)
Line 58: Line 58:
 
"Open design of a fixed probe for water quality monitoring in rivers and lakes" is the bachelor project of an EPFL student [https://biodesign.cc/2016/03/06/bachelor-project-spring-2016/ Nils Bonfils] which is done within the Biodesign project and supervised by Robin Scheibler.
 
"Open design of a fixed probe for water quality monitoring in rivers and lakes" is the bachelor project of an EPFL student [https://biodesign.cc/2016/03/06/bachelor-project-spring-2016/ Nils Bonfils] which is done within the Biodesign project and supervised by Robin Scheibler.
 
The goal is to set a fixed measurement station on Sorge river at EPFL. It will collect different water-related and environment-related data and then send them through the internet to a server to be stored there, and then maybe be displayed with a web interface.
 
The goal is to set a fixed measurement station on Sorge river at EPFL. It will collect different water-related and environment-related data and then send them through the internet to a server to be stored there, and then maybe be displayed with a web interface.
The core of the station is a raspberry pi that will be used to interface with the different components like the temperature probe. The advantages of using raspberry pi in such a project is firstly its low power consumption (roughly 2 to 3 W [http://www.pidramble.com/wiki/benchmarks/power-consumption] [https://whyamistilltyping.wordpress.com/2012/04/29/first-slice-of-pi/]). There are other advantages, like easy backup storage and internet connexion through USB (like usb dongle for 3g/4g) and there also is an ease of use with the ssh connexion, which provides a direct interface to access the raspberry pi, update the code, etc...
+
The core of the station is a raspberry pi that will be used to interface with the different components like the temperature probe. The advantages of using raspberry pi in such a project is firstly its low power consumption (roughly 2 to 3 W ). There are other advantages, like easy backup storage and internet connexion through USB (like usb dongle for 3g/4g) and there also is an ease of use with the ssh connexion, which provides a direct interface to access the raspberry pi, update the code, etc...
  
== Parameters Measured ==
+
== References and links ==
These are the parameters that will be mesured by the station.
+
[https://cdn-learn.adafruit.com/assets/assets/000/003/059/original/learn_raspberry_pi_gpio-srm.png?1396790782 Rpi GPIO]
+
*Turbidity of water -> [https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/connecting-the-cobbler-to-a-mcp3008 adc hook up for reading from sensor] - [https://gist.github.com/justy/2d1b5f3113d60773aa22 python code to read from adc] - need to add a 10k resistor from data to gnd
+
*Photo of the water -> [http://www.arducam.com/camera-modules/ arduino camera]
+
*Barometric pressure -> [https://www.adafruit.com/products/1603 Used Sensor (BMP180)] [https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf Datasheet of the sensor] [https://cdn-learn.adafruit.com/assets/assets/000/001/692/original/raspberry_pi_BMP085_Breadboard_1K.png?1396775358 BMP180 circuit hook up] [https://github.com/adafruit/Adafruit_Python_BMP BMP python lib]
+
*Temperature of the air + water (available at hackuarium) -> [https://www.sparkfun.com/products/11050 waterproof sensor(DS18B20)] - [https://github.com/timofurrer/w1thermsensor useful python library] (needed to change /boot/config.txt though) - [https://www.adafruit.com/products/372 ada fruit] [https://cdn-learn.adafruit.com/assets/assets/000/003/782/original/learn_raspberry_pi_breadboard-probe.png?1396801706 DS18B circuit hook up (the resistor is 4.7 or 10k Ohms)]
+
  
== Other parameters related to water ==
+
=== Currently used in the project ===
These are parameters related to the project that will not be measured for simplicity reasons, but it could be interresting to have them on an upgrade of the project (bigger station, needs to measure other things).
+
*... <!-- TODO: write down the list -->
+
  
== Turbidity sensor ==
+
[https://github.com/nbonfils/fixed-probe GitHub of the project]
  
Tutorial to connect ADC to raspberry pi [https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview]
+
[https://cdn-learn.adafruit.com/assets/assets/000/003/059/original/learn_raspberry_pi_gpio-srm.png?1396790782 Rpi GPIO]
  
== Data Collecting ==
+
[https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/connecting-the-cobbler-to-a-mcp3008 adc hook up for reading from sensor] - [https://gist.github.com/justy/2d1b5f3113d60773aa22 python code to read from adc] - [https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview Tutorial to connect ADC to raspberry pi]
*SD card shield
+
*GSM shield -> [https://www.sparkfun.com/products/13120 sparkfun] - [http://www.ebay.com/sch/items/?_nkw=arduino+gsm+shield&_sacat=&_ex_kw=&_mPrRngCbx=1&_udlo=&_udhi=&_sop=12&_fpos=&_fspt=1&_sadis=&LH_CAds=&rmvSB=true ebay] - [http://www.arduino.cc/en/Main/ArduinoGSMShield arduino official]
+
*GSM click -> [http://wiki.octanis.org/sim800?s=sim800 octanis wiki] - [http://stackoverflow.com/questions/6677991/internet-through-gprs-using-telit-gl-865-gsm-gprs-modem useful command sequence] - [http://www.multitech.net/developer/wp-content/uploads/2010/10/S000463C.pdf some doc on at commands] - [http://elinux.org/RPi_Serial_Connection#Method_3.2C_manual_configuration_.28complex.29 configure serial on RPi] - Set CTS pin HIGH and RTS pin LOW to get proper communication
+
  
== Data displaying ==
+
[https://www.adafruit.com/products/1603 Used Sensor (BMP180)] [https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf Datasheet of the sensor] [https://cdn-learn.adafruit.com/assets/assets/000/001/692/original/raspberry_pi_BMP085_Breadboard_1K.png?1396775358 BMP180 circuit hook up] [https://github.com/adafruit/Adafruit_Python_BMP BMP python lib]
*[http://grafana.org/ Grafana] [https://www.digitalocean.com/community/tutorials/how-to-analyze-system-metrics-with-influxdb-on-centos-7 tutorial with influxDB  on CentOS]
+
*[https://www.elastic.co/products/kibana Kibana]
+
  
== Battery and power management ==
+
[https://www.sparkfun.com/products/11050 waterproof sensor(DS18B20)] - [https://github.com/timofurrer/w1thermsensor useful python library] (needed to change /boot/config.txt though) - [https://www.adafruit.com/products/372 ada fruit] [https://cdn-learn.adafruit.com/assets/assets/000/003/782/original/learn_raspberry_pi_breadboard-probe.png?1396801706 DS18B circuit hook up (the resistor is 4.7 or 10k Ohms)]
  
* RPi shield that can be schedule shutdown and wakeup [http://www.uugear.com/product/witty-pi-realtime-clock-and-power-management-for-raspberry-pi/ Witty Pi]
+
[http://www.mikroe.com/click/gsm/ GSM Click] - [http://wiki.octanis.org/sim800?s=sim800 octanis wiki] - [http://stackoverflow.com/questions/6677991/internet-through-gprs-using-telit-gl-865-gsm-gprs-modem useful command sequence] - [http://www.multitech.net/developer/wp-content/uploads/2010/10/S000463C.pdf some doc on at commands] - [http://elinux.org/RPi_Serial_Connection#Method_3.2C_manual_configuration_.28complex.29 configure serial on RPi]
* Power management: [http://seeedstudio.com/item_detail.html?p_id=992 LiPo Rider] from SeeedStudio (at hackuarium) [http://www.seeedstudio.com/wiki/Lipo_Rider_V1.1 wiki page]
+
  
== Background ==
+
[http://www.uugear.com/product/witty-pi-realtime-clock-and-power-management-for-raspberry-pi/ Witty Pi]
  
Other examples:<br>
+
[http://seeedstudio.com/item_detail.html?p_id=992 LiPo Rider Pro]
* [http://echo.epfl.ch/ Laboratory of ecohydrology] at EPFL has a [http://echo.epfl.ch/page-113945-fr.html project for herbicide monitoring] in the Chamberonne catchment where meteorological and flow data are available.
+
* [http://flood.network/join Flood monitor] in the Flood Network.
+
  
== References ==
+
=== May be useful for further research/developpement ===
  
[https://github.com/nbonfils/fixed-probe GitHub of the project]
+
[http://www.pidramble.com/wiki/benchmarks/power-consumption power consumption of pi 1] - [https://whyamistilltyping.wordpress.com/2012/04/29/first-slice-of-pi/ power consumption of pi 2]
 +
 
 +
[http://grafana.org/ Grafana] [https://www.digitalocean.com/community/tutorials/how-to-analyze-system-metrics-with-influxdb-on-centos-7 tutorial with influxDB  on CentOS]
 +
 
 +
[https://www.elastic.co/products/kibana Kibana]
  
 
[https://www.researchgate.net/profile/Joshua_Pearce/publication/270438135_Open-source_mobile_water_quality_testing_platform/links/54f9ab660cf21ee4fdede9be.pdf DIY water quality testing platform]
 
[https://www.researchgate.net/profile/Joshua_Pearce/publication/270438135_Open-source_mobile_water_quality_testing_platform/links/54f9ab660cf21ee4fdede9be.pdf DIY water quality testing platform]
Line 104: Line 92:
 
[https://publiclab.org/wiki/open-water Public Lab open water project]
 
[https://publiclab.org/wiki/open-water Public Lab open water project]
  
[https://www.youtube.com/watch?v=GNyLoHTiHbw (VIDEO)Some guy doing a work pretty similar to mine]
+
[https://www.youtube.com/watch?v=GNyLoHTiHbw (VIDEO)Some guy doing a pretty similar work]
 +
 
 +
[http://echo.epfl.ch/ Laboratory of ecohydrology] at EPFL has a [http://echo.epfl.ch/page-113945-fr.html project for herbicide monitoring] in the Chamberonne catchment where meteorological and flow data are available.
 +
 
 +
[http://flood.network/join Flood monitor] in the Flood Network.
  
 
[[Category:Ongoing Projects]][[Category:Hardware]]
 
[[Category:Ongoing Projects]][[Category:Hardware]]

Revision as of 14:25, 10 June 2016

River sorge.jpg

"Open design of a fixed probe for water quality monitoring in rivers and lakes" is the bachelor project of an EPFL student, Nils Bonfils, which is done within the Biodesign project and supervised by Robin Scheibler.

The aim of this project is to set up a prototype measurement station in the Sorge (a small river near the EPFL) to collect some data about the water and the environmental conditions. And also make the work reproducible so that someone, somewhere else could also build one to collect data about a specific river or lake. That's why there also is a GitHub for the project, where there are guidlines on how to build your own. These guidlines were made based on my own experience of building such a device.

The data collected is for my prototype restrained to the temperature of the water, the turbidity of the water, the ambient temperature, the barometric pressure and taking a photo of the water. One could easily imagine that it can be extended to collect more data related to pollution of the water like the conductivity or pH. But it's for simplicity reasons that there are only 5 different types of data collected (which seems enough for a prototype) and also to get a functional prototype in a single semester while not working full time on it. And one must not forget that this project is started from scratch !


What is this project useful for ?

For now, basically nothing really interresting, but as mentioned in the intro, it's a prototype and the application of such a device is potentially interresting, like extending the work and change it or add more sensors to collect data related to other parameters that are useful for you. Also this could be nice in some countries where governements aren't willing to spend money in water monitoring, and you don't need to spend 10'000$ to get a professional probe like the ones used in the State of Geneva (Nils had the chance to meet Stephane Odriozola who works there, see his post on the Biodesign blog), maybe a scientific team could build few of those probes and check them in some rivers if the water is polluted and/or dirty.

This project is the frame of something that could become really improved if people contribute to it. This project is also part of of the Biodesign project, which for now the "main" project is to detect Arsenic in water with a bacteria, and the collecting system has to be manually done, it could be interesting to automate it by maybe integrating this kind of measurements in a more advanced version of such a probe.

Developpement from scratch

This project starts from scratch, meaning that at first it was just an idea. The idea of this emerged between Sachiko, Robin and Nils. At first, Robin and Sachiko presented the Biodesign project to Nils and they came to the idea that, as the collecting of sample for the bacteria measurements is not highly developed as well as the recording of the data, it would be interesting to automate some parts of it.

So the idea of having some kind of probe on the field that would do the measurements and sending data through internet came up, but as for the bacteria there are specific protocols and other things, it was more reasonable to start with measurements that are easier to make, like the temperature of the water (etc...). So that's where the idea of such a probe came from.

Once the idea was correctly set up, materials to craft the probe were needed.

Scraping/Buying the materials

One of the project's side goal is to make the building of such a device accessible and affordable, so the more materials can be scraped, the better. And if there is a need to buy something, the cheaper the better. So indeed, for the prototype, the finitions aren't quite "commercial", it is really DIY looking.

What could be scraped for example is the turbidity sensor, which is a basic turbidity sensor comming from a dishwasher (for the prototype it was bought for 2$ on the internet as we hadn't a dishwasher at our disposal). In fact, almost everything could be scraped depending on how good you are at finding and making work stuff, and even if you can't, every materials used for such a probe can be bought on the internet for very cheap.

Software developement

Starting from scratch also means that there is no software for such a probe. Of course, there are already some works out there that were made to make certain of these components work, but not for all of them, and there was a need to figure out those things too. And at the end, putting it all together and have a working server that runs on the device, collects the data and send them.

The choice was made to develop in python 3 as it is a very popular and user-friendly language, although powerful. Python is an interpreted language, that means that it can run on any machine, providing the python interpreter is installed on this machine. And as the Raspberry Pi features a linux system (Raspbian) it is very easy to install and use python on it.

A big part of this project was the testing of each components with Raspberry Pi and integrating the code to read the data for it in a server-script in python. The testing consisted in different steps, first finding a documentation on the component if there was any, then based on that, hook up the component to the raspberry, trying to find a python library if there are any for this specific component and then try to get some data out of the component. Once the component worked, there was a need to integrate it in the server-script that will run inside the probe.

Building the probe

It is a chance that there exists Hackuarium near the EPFL, a place where different people coming from different formations can work and meet. There are also a lot of tools to work with. It is where the prototype was built.

But before building, as there was no plans to build such a probe, the creation of the prototype was made step by step, with lots of tests. A thing that couldn't be done without the apropriate tools were the holes in the mettalic box, those holes were made in order for the cable of the sensors to leave the box and go in the water, and tools were needed so the holes have the right size for the cable clamps. To use these tools following a security formation was needed first.

Fastening the electronics inside the boxes was another challenge, for the small box as there only is a small sensor in it (temperature and barometric pressure), a very simple PCB with the adequat size to fit in and fastened it. And for the big box, cutting a plexiglas plate with the adequate size too seems to do the trick (of course the components need to be fixed to the plate too).

The electronic components are soldered together with the help of wires and a breadborad-like PCB.

Problem faced during the project

Of course in project like this not everything goes as planned and indeed there were a few difficulties.

Notably with the turbidity sensor, such sensor can be found in any standard dishwasher but other than that and tutorials on how to replace the turbidity sensor in a dishwasher there is not much documentation on the internet, so logically as a turbidity sensor give an analog output there is a need for an analog-digital converter, that with a 10k resistor between the analog output of the sensor and the ground showed some acceptable results. And as the ouput result is just a value between 0 and 1024 (10 bits ADC) it needs to be calibrated, the choice was made such that the raw value will be sent to the server leaving the interpretation to the front-end. Although for calibratique physically the sensors some tests were made with water and milk to get actual value that made sense.

The there is the GSM module, it is not a module made for a Raspberry Pi (gsm click) so the figuring out how it worked wasn't as easy as for the other components (such as the temperature sensor). It had the TX and RX pins, typical pins used for serial communication, so using a usb to serial module to connect it to a computer is really interesting. GSM module usually communicate with AT commands and indeed it is the case for this one, then it is required to enter the correct sequence of AT commands in order to connect to the network and sends some informations through internet. Things worked with usb module but when hooked via the GPIO pins of the Raspberry Pi the output wnet randomly garbage, sometime it worked, sometimes not.

The project

"Open design of a fixed probe for water quality monitoring in rivers and lakes" is the bachelor project of an EPFL student Nils Bonfils which is done within the Biodesign project and supervised by Robin Scheibler. The goal is to set a fixed measurement station on Sorge river at EPFL. It will collect different water-related and environment-related data and then send them through the internet to a server to be stored there, and then maybe be displayed with a web interface. The core of the station is a raspberry pi that will be used to interface with the different components like the temperature probe. The advantages of using raspberry pi in such a project is firstly its low power consumption (roughly 2 to 3 W ). There are other advantages, like easy backup storage and internet connexion through USB (like usb dongle for 3g/4g) and there also is an ease of use with the ssh connexion, which provides a direct interface to access the raspberry pi, update the code, etc...

References and links

Currently used in the project

GitHub of the project

Rpi GPIO

adc hook up for reading from sensor - python code to read from adc - Tutorial to connect ADC to raspberry pi

Used Sensor (BMP180) Datasheet of the sensor BMP180 circuit hook up BMP python lib

waterproof sensor(DS18B20) - useful python library (needed to change /boot/config.txt though) - ada fruit DS18B circuit hook up (the resistor is 4.7 or 10k Ohms)

GSM Click - octanis wiki - useful command sequence - some doc on at commands - configure serial on RPi

Witty Pi

LiPo Rider Pro

May be useful for further research/developpement

power consumption of pi 1 - power consumption of pi 2

Grafana tutorial with influxDB on CentOS

Kibana

DIY water quality testing platform

Public Lab open water project

(VIDEO)Some guy doing a pretty similar work

Laboratory of ecohydrology at EPFL has a project for herbicide monitoring in the Chamberonne catchment where meteorological and flow data are available.

Flood monitor in the Flood Network.