Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2022-154
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-154
2022-154
Commits
95f46db8
Commit
95f46db8
authored
May 11, 2022
by
Samaranayake S.L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nutrition dosing 1st phase
parent
c4d808d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
iot/Chembot/nutrition_dose.ino
iot/Chembot/nutrition_dose.ino
+48
-0
No files found.
iot/Chembot/nutrition_dose.ino
0 → 100644
View file @
95f46db8
#include <EEPROM.h>
#include "GravityTDS.h"
#define TdsSensorPin A1
GravityTDS
gravityTds
;
const
int
RELAY_PIN
=
A5
;
// the Arduino pin, which connects to the IN pin of relay
float
temperature
=
25
,
tdsValue
=
0
;
void
setup
()
{
Serial
.
begin
(
115200
);
gravityTds
.
setPin
(
TdsSensorPin
);
gravityTds
.
setAref
(
5.0
);
//reference voltage on ADC, default 5.0V on Arduino UNO
gravityTds
.
setAdcRange
(
1024
);
//1024 for 10bit ADC;4096 for 12bit ADC
gravityTds
.
begin
();
//initialization
pinMode
(
RELAY_PIN
,
OUTPUT
);
}
void
loop
()
{
//temperature = readTemperature(); //add your temperature sensor and read it
gravityTds
.
setTemperature
(
temperature
);
// set the temperature and execute temperature compensation
gravityTds
.
update
();
//sample and calculate
tdsValue
=
gravityTds
.
getTdsValue
();
// then get the value
Serial
.
print
(
tdsValue
,
0
);
Serial
.
println
(
"ppm"
);
if
(
tdsValue
>
350
){
digitalWrite
(
RELAY_PIN
,
LOW
);
// turn on pump
delay
(
1000
);
Serial
.
println
(
"pump off"
);
tdsValue
=
gravityTds
.
getTdsValue
();
// then get the value
}
else
if
(
tdsValue
<
350
){
digitalWrite
(
RELAY_PIN
,
HIGH
);
// turn on pump
delay
(
500
);
digitalWrite
(
RELAY_PIN
,
LOW
);
// turn on pump
delay
(
1000
);
Serial
.
println
(
"pump on"
);
tdsValue
=
gravityTds
.
getTdsValue
();
// then get the value
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment