A turbidity meter is a device that measures the degree to which a liquid is cloudy or opaque. It can be used to measure the concentration of suspended particles in a liquid, such as water. An Arduino can be used to control and read data from a turbidity meter by connecting the meter to the Arduino’s analogue input pins and using the Arduino’s analogue-to-digital converter (ADC) to convert the analogue voltage reading from the meter into a digital value that can be used in code. The digital value can then be used to calculate the turbidity of the liquid being measured.
Turbidity module
A turbidity module is a device used to measure a liquid’s turbidity. It typically consists of a light source and a photodetector, which are used to measure the amount of light that is scattered by suspended particles in the liquid. The module may also include a processor and other electronics to convert the analog signal from the photodetector into a digital value that can be used to calculate the turbidity of the liquid. Some turbidity modules may also include a display or other output mechanism to display the measured turbidity value.
circuit diagram
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
int redled =6;
int greenled=7;
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void setup(void) {
u8g2.begin();
pinMode(redled,OUTPUT);
pinMode(greenled,OUTPUT);
}
void loop(void) {
int sensorValue = analogRead(A0);
// print out the value you read:
int turbidity =map(sensorValue,0,700,100,0);
u8g2.clearBuffer(); // clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.drawStr(0,10,"TURBIDITY:"); // write something to the internal memory
u8g2.setFont(u8g2_font_7Segments_26x42_mn); // choose a suitable font
u8g2.setCursor(0, 60);
u8g2.print(turbidity);
u8g2.setFont(u8g2_font_fub14_t_symbol); // choose a suitable font
u8g2.setCursor(70, 60);
u8g2.print("%");
if (turbidity<50)
{
digitalWrite(redled,HIGH);
digitalWrite(greenled,LOW);
}
else {
{
digitalWrite(greenled,HIGH);
digitalWrite(redled,LOW);
}
}
u8g2.sendBuffer(); // transfer internal memory to the display
delay(1000);
}
Leave a comment