0% found this document useful (0 votes)
26 views8 pages

Arduino Uno:: Main Components: Main Brain of The Device

The document outlines the components and wiring for a device using an Arduino Uno, including an LCD screen, temperature sensor, pH level sensor, and a DC-DC buck converter. It provides detailed instructions for connecting each component and includes example code for reading temperature and pH values, displaying them on the LCD, and printing to the Serial Monitor. The code also includes calibration parameters for accurate sensor readings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views8 pages

Arduino Uno:: Main Components: Main Brain of The Device

The document outlines the components and wiring for a device using an Arduino Uno, including an LCD screen, temperature sensor, pH level sensor, and a DC-DC buck converter. It provides detailed instructions for connecting each component and includes example code for reading temperature and pH values, displaying them on the LCD, and printing to the Serial Monitor. The code also includes calibration parameters for accurate sensor readings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Main Components:

Arduino Uno: Main brain of the device

LCD Screen: To provide visual output for data, messages, or sensor reading
DS1820 ( TEMPERATURE SENSOR): Used for measuring ambient temperature in
Environment like homes, geenhouses, or Industrial settings. It can also be use to monitor temperature in
liqiuds

pH Level Sensor: Used to measure the acidity or alkalinity of a solution which is essential in
many scientific, industrial, and Environmental applications
DC- DC Buck Converter: Used for stepdown high voltage from a power source to a lower voltage
suitable for electronics devices.

Battery: Source of power of the device


Wirings:

1. LCD Screen: For LCD screen, 1st connect the SDA Pin to the Analog Input 4 (A4) of Arduino Uno.
2nd Connect the SCL Pin to the Analog Input 3 (A3) of Arduino, and 3rd Connect the VCC PIN
(Posotive Supply Voltage) to the 5 volts Power Source and Connect the GND PIN( GROUND) to the
negative Supply Voltage of the Power Source.

2. pH Level Sensor: For pH Level Sensor, 1st connect the sensor probe to the pH sensor module. 2nd
From pH sensor module connect the signal pin of the sensor to the A0 of the arduino, and 3rd Connect
the VCC and ground the positive and negative supply voltage of the power source.

3. Temperature Sensor: For Temperature Sensor, 1st connect the VCC (Red Wire) and Ground (Black
Wire) to the positive and negative side of the supply voltage. 2nd Connect the signal pin (Brown wire)
to digital Pin 2 of arduino with 4.7k Ohm Pull up resistor
4. DC – DC Buck Controller: For DC – DC buck controller, Connect the positive and negative output
to the 5v input Pin and ground pin to arduino uno.

5. Battery: Connect the battery to the DC – DC Buck controller.

Program:
“””
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#define ONE_WIRE_BUS 2
#define SensorPin A0
“””
- This code sets up the necessary libraries and pin configurations for:

1. Reading Temperature data from a tempsensor connected to pin 2


2. Reading analog voltage from pH sensor Connected to pin A0.
3. Displaying the data on an 12C LCD Screen

“””
//set LCD address
LiquidCrystal_I2C lcd(0x27,16,2);

// Calibration parameters (adjust during calibration)


float calibrationOffset = 0.0;
float calibrationSlope = -3.5;

// Temperature Sensor
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

“””
What Does This Code Do?
1. Sets up the LCD:

• Prepares the LCD to display information (like temperature or pH).


2. Prepares for Calibration:

• Defines two values (calibrationOffset and calibrationSlope) that can be adjusted to make
sensor readings more accurate.
3. Sets up the Temperature Sensor:

• Prepares the Arduino to read temperature data from a DS18B20 sensor connected to a
specific pin.
“””
void phGravitySensor() {
float measure = analogRead(A0); //Read pin A0
double voltage = measure*5/1024; //Analog-to-Digital Conversion

// PH_step (Voltage/pH Unit) = (Voltage@PH7-Voltage@PH4)/(PH7 - PH4)


float pH = 7+((2.70 - voltage)/0.1841); // PH_probe = PH7-((Voltage@PH7-
Voltage@probe)/PH_step) //Calibrating
Serial.print("PH: ");
Serial.println(pH);
lcd.setCursor(1, 0);
lcd.print("pH:");
lcd.setCursor(4, 0);
lcd.print(pH);
if(pH <= 7){
Serial.println(" - Acid");
lcd.setCursor(8, 0);
lcd.print(" - ACID"); // ACID
}else{
Serial.println("- NTRL"); // Neutral
lcd.setCursor(8, 0);
lcd.print(" - NTRL");
}
if(pH >= 8){
Serial.println("Alkaline"); //ALKA
lcd.setCursor(8, 0);
lcd.print(" - ALKA");
}
}
“””
- This code is a function named phGravitySensor() that reads the pH value from a pH sensor connected
to an Arduino, calculates the pH level, and displays the result on both the Serial Monitor and an LCD
display. It also categorizes the pH level as Acidic, Neutral, or Alkaline.

“””
void tempSensor() {
// Send the command to get temperatures
sensors.requestTemperatures();

//print the temperature in Celsius


lcd.setCursor(3, 1);
lcd.print("Temp");
lcd.setCursor(7,1);
lcd.print(":");
Serial.print("Temperature: ");
lcd.setCursor(8,1);
lcd.print(sensors.getTempCByIndex(0));
Serial.print(sensors.getTempCByIndex(0));
Serial.print((char)176);//shows degrees character
Serial.print("C | ");

//print the temperature in Fahrenheit


Serial.print((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);
Serial.print((char)176);//shows degrees character
Serial.println("F");

//delay(500);
}
“””
- This code defines a function named tempSensor() that reads the temperature from a DS18B20
temperature sensor, displays it on an LCD, and prints it to the Serial Monitor in both Celsius and
Fahrenheit.

You might also like