Skip to content

matheusschreiber/Arduino-based-turbidity-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

inside

ARDUINO BASED TURBIDITY SENSOR

Project DescriptionHow to build itPhotosVideoAbout the codeSimplicitySpecial Thanks


Project Description

As a real turbidity sensor (which is sold in electronics stores) usually has a high price, the idea of this project came to replace such equipment with lower-priced ones and obtain a similar result. Consisting basically of an Arduino UNO and an LDR resistor, the project also becomes more customizable depending on the purpose for which it is intended.

Through an external light source that passes through the glass of water, it is possible to capture the voltage of the LDR resistor and transform this data into a certain level of turbidity of the liquid. The higher the voltage, the dirtier the water is.


How to build it

Materials

  • 1 Box
  • Cup holder
  • Flashlight
  • Arduino UNO
  • Protoboard
  • 1 LDR resistor
  • 5 led's
  • 6 330Ω (Ohms) resistors
  • Jumpers

Mounting

  • First you have to make the cuts in the box to fit the elements and then place them in the right position, with the LDR just below the cup. It is advisable to paint the box black to help retain more the light. Afterwards, the necessary connections of the components are made on the protoboad, always remembering to position the LEDs in order to facilitate their visualization. Finally, the Arduino is connected to the computer to pass the code and put the system into running. To use, just place your water sample in the appropriate place and see the result based on the color of the LEDs.

operation gif


Photos


Video

The full presentation can be found here -> https://youtu.be/-e1VBkAoZOs


About the code

At the beggining, we manually calibrated the software to get the right values of voltagem as each level of turbidity. But that proved to be really not practical and so we decided that the program has a loop at the beggining, that automatically calibrates itself for the next readings of samples.

The mantioned part of the code can be seen in here

int calibra(){
  double lido = analogRead(LDR);
  double anterior=0;
  double diferenca=0;


  int vezes=0;

  while(vezes<1000){
    lido = analogRead(LDR);
    diferenca = anterior-lido;
    
    if (diferenca < 100) {
      vezes++;
    } else vezes=0;

    anterior = lido;
  }
  
  parametros[0] = lido;
  parametros[1] = lido+10;
  parametros[2] = lido+20;
  parametros[3] = lido+30;
 }

The rest of the code is pretty simple, and can be directly seen on the git files in this repository.


Simplicity

As you can see, despite having a set of relatively simple materials (with components easily found in computer stores and other home materials), the system has a very useful and interesting application that can be extended to some research or extension project, such as a future improvement and implementation in needy communities that, with the help of this equipment, could analyze the quality of the water that arrives in the place where they live and who knows, make an appeal to the authorities, directly improving their quality of life.


Special Thanks

The owners of this code sincerely thanks the help from the UFES's Teacher and Lab Manager Vinicius Motta during this project development.



Made with 🤍 by


About

Simple mechanism using leds and a LDR (Light Dependent Resistor)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages