DIY Alkalinity Monitor

OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
But let me ask you one thing.

Doesn't this have a schedule function?
The code that I posted here has a choice of 3, 4, or 5 hard-coded choices for running tests on schedule. Each will start on the 20th minute of the hour and will run with either 6 hours, 4 hours or 3 hours interval.

if(last_hour_checked!=h && !DEBUG_MODE)//check if alk monitor needs to be run
{
if(m==20)
{
last_hour_checked = h;
if(
((h==6 || h == 12 || h==18) && schedule_tests_per_day==3)
||
((h==6 || h == 10 || h==14 || h==18) && schedule_tests_per_day==4)
||
((h==6 || h == 9 || h==12 || h==15 || h==18) && schedule_tests_per_day==5)
)
{
runAlkalinityTest();
}
}
}
 
CLICK TO VIEW

bread1973

New Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 11, 2023
Messages
18
Reaction score
15
Review score
+0 /0 /-0
Location
korea
Rating - 0%
0   0   0
여기에 게시한 코드에는 일정에 따라 테스트를 실행하기 위해 3, 4 또는 5개의 하드 코딩된 선택 항목이 있습니다. 각 시간은 매시 20분에 시작되며 6시간, 4시간 또는 3시간 간격으로 실행됩니다.

if(last_hour_checked!=h && !DEBUG_MODE)//alk 모니터를 실행해야 하는지 확인
{
만약(m==20)
{
last_hour_checked = h;
만약에(
((h==6 || h == 12 || h==18) && schedule_tests_per_day==3)
||
((h==6 || h == 10 || h==14 || h==18) && schedule_tests_per_day==4)
||
((h==6 || h == 9 || h==12 || h==15 || h==18) && schedule_tests_per_day==5)
)
{
runAlkalinityTest();
}
}
}
Thank you.

I'll fix it to only check twice a day. Thank you for your always kind reply.
 
OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
Thank you.

I'll fix it to only check twice a day. Thank you for your always kind reply.
Just FIY - you may have wondered why 20th minute of the hour? I have a 12v PSU to which both Alk monitor and the 3-head doser are connected. The PSU only provides 2A - so if both the doser and the Alk monitor start to run motors at the same time there would be an issue (the would both not be able to run). So i programmed the doser to dose at 0 min, 5 min and 10 min times of the hour (there are 3 dosing heads - so same issue, I have to run each head in a separate time interval, otherwise there is not enough current) and then chose the Alk monitor to run on the 20th minute.

Eventually I will rework my aquarium controller - and it will provide 6A @12v which will be ample to provide power to all my 12v devices simultaneously.
 

bread1973

New Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 11, 2023
Messages
18
Reaction score
15
Review score
+0 /0 /-0
Location
korea
Rating - 0%
0   0   0
Just FIY - you may have wondered why 20th minute of the hour? I have a 12v PSU to which both Alk monitor and the 3-head doser are connected. The PSU only provides 2A - so if both the doser and the Alk monitor start to run motors at the same time there would be an issue (the would both not be able to run). So i programmed the doser to dose at 0 min, 5 min and 10 min times of the hour (there are 3 dosing heads - so same issue, I have to run each head in a separate time interval, otherwise there is not enough current) and then chose the Alk monitor to run on the 20th minute.

Eventually I will rework my aquarium controller - and it will provide 6A @12v which will be ample to provide power to all my 12v devices simultaneously.
[HASH=42478]#include[/HASH] <WiFi.h>
[HASH=42478]#include[/HASH] <Wire.h>
[HASH=42478]#include[/HASH] <WebServer.h>
[HASH=70522]#define[/HASH] WIRE_SLAVE_ADDRESS 9
[HASH=42478]#include[/HASH] "time.h"
[HASH=42478]#include[/HASH] <Arduino.h>
[HASH=42478]#include[/HASH] <ESP32_MailClient.h>
// Replace with your network credentials
const char* ssid = "chengyu-xiaomi";
const char* password = "xxxxx";
unsigned long last_update_time = 0;
unsigned long current_time;
unsigned long startup_time;
unsigned long time_update_interval = 12*3600*1000; //2 times a day
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 32400;
const int daylightOffset_sec = 0;
String alkMonitorState = "off";

unsigned long currentTime = millis();
unsigned long previousTime = 0;
const long timeoutTime = 2000;
String header;
String display_volume = "";


WiFiServer server(80);
IPAddress local_IP(192, 168, 0, 154);
IPAddress gateway(192, 168, 0, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(61, 41, 153, 2); //optional
IPAddress secondaryDNS(1, 214, 68, 2); //optional

[HASH=70522]#define[/HASH] GMAIL_SMTP_SEVER "smtp.gmail.com"
[HASH=70522]#define[/HASH] GMAIL_SMTP_USERNAME "[email protected]"
[HASH=70522]#define[/HASH] GMAIL_SMTP_PASSWORD "xxxxxx"
[HASH=70522]#define[/HASH] GMAIL_SMTP_PORT 465



Thank you for your detailed reply.

I seem to have no problem using the main board and power supply for the 3d printer.

Let me ask you one more question.

The test is completed and the result value should come by e-mail, but it is not coming.

Is it a connection problem between mega2560 and esp32?

However, the date data seems to be delivered just fine.
 
OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
[HASH=42478]#include[/HASH] <WiFi.h>
[HASH=42478]#include[/HASH] <Wire.h>
[HASH=42478]#include[/HASH] <WebServer.h>
[HASH=70522]#define[/HASH] WIRE_SLAVE_ADDRESS 9
[HASH=42478]#include[/HASH] "time.h"
[HASH=42478]#include[/HASH] <Arduino.h>
[HASH=42478]#include[/HASH] <ESP32_MailClient.h>
// Replace with your network credentials
const char* ssid = "chengyu-xiaomi";
const char* password = "xxxxx";
unsigned long last_update_time = 0;
unsigned long current_time;
unsigned long startup_time;
unsigned long time_update_interval = 12*3600*1000; //2 times a day
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 32400;
const int daylightOffset_sec = 0;
String alkMonitorState = "off";

unsigned long currentTime = millis();
unsigned long previousTime = 0;
const long timeoutTime = 2000;
String header;
String display_volume = "";


WiFiServer server(80);
IPAddress local_IP(192, 168, 0, 154);
IPAddress gateway(192, 168, 0, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(61, 41, 153, 2); //optional
IPAddress secondaryDNS(1, 214, 68, 2); //optional

[HASH=70522]#define[/HASH] GMAIL_SMTP_SEVER "smtp.gmail.com"
[HASH=70522]#define[/HASH] GMAIL_SMTP_USERNAME "[email protected]"
[HASH=70522]#define[/HASH] GMAIL_SMTP_PASSWORD "xxxxxx"
[HASH=70522]#define[/HASH] GMAIL_SMTP_PORT 465



Thank you for your detailed reply.

I seem to have no problem using the main board and power supply for the 3d printer.

Let me ask you one more question.

The test is completed and the result value should come by e-mail, but it is not coming.

Is it a connection problem between mega2560 and esp32?

However, the date data seems to be delivered just fine.
When you send emails via gmail from an application, you need to create an app password, this is described here:


You then use that password (not your normail gmail password) to send emails.

Have you done that yet?

Borat.
 

cliffE

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 31, 2023
Messages
40
Reaction score
15
Review score
+0 /0 /-0
Location
Alaska
Rating - 0%
0   0   0
I am new to coding. I tried to upload the sketch onto my arduino mini but I continue to get the message "Compilation error: MemoryInfo.h: No such file or directory". When codes note "#include", where are these files coming from?
 
www.dinkinsaquaticgardens.com

cliffE

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 31, 2023
Messages
40
Reaction score
15
Review score
+0 /0 /-0
Location
Alaska
Rating - 0%
0   0   0
Figured it out. Finished the code install but it notes my file is too big. Trying to upload on the arduino mega pro min. I read I can remove "float" from the sketch where decimals are not needed. Other thoughts. Should I try a Arduino mega, which would mean changing up the wiring scheme.
 
OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
Figured it out. Finished the code install but it notes my file is too big. Trying to upload on the arduino mega pro min. I read I can remove "float" from the sketch where decimals are not needed. Other thoughts. Should I try a Arduino mega, which would mean changing up the wiring scheme.
Great that you did sort this out..

For wider audience - at some point I was experimenting with a library that I downloaded from GitHub - it allows you to query memory availability. The code does not use that library now (I think) , so it should be safe to simply comment it out.
 
OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
Figured it out. Finished the code install but it notes my file is too big. Trying to upload on the arduino mega pro min. I read I can remove "float" from the sketch where decimals are not needed. Other thoughts. Should I try a Arduino mega, which would mean changing up the wiring scheme.
Have you made changes to the code? It should not be large for Mega, Mega mini 2560 amd Mega 2560 is exactly the same board, just the arrangement of pins is more compact.
 
Top Shelf Aquatics

cliffE

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 31, 2023
Messages
40
Reaction score
15
Review score
+0 /0 /-0
Location
Alaska
Rating - 0%
0   0   0
Have you made changes to the code? It should not be large for Mega, Mega mini 2560 amd Mega 2560 is exactly the same board, just the arrangement of pins is more compact.
Selected the wrong board. The mega 2560 and the mega 2560 mini got me confused.
Good to go now!
 

bread1973

New Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 11, 2023
Messages
18
Reaction score
15
Review score
+0 /0 /-0
Location
korea
Rating - 0%
0   0   0
When you send emails via gmail from an application, you need to create an app password, this is described here:


You then use that password (not your normail gmail password) to send emails.

Have you done that yet?

Borat.

Yes, I will try to fix it like that. thank you ^^
 

BassamKassem

Community Member
Review score
+0 /0 /-0
View Badges
Joined
Mar 8, 2023
Messages
91
Reaction score
33
Review score
+0 /0 /-0
Location
Egypt
Rating - 0%
0   0   0
Hello @Borat . Here is the final enclosure hope you like it

I can't thank you enough for your contributions help and support
Screenshot_20230422-214433_Gallery.jpg 20230420_043833.jpg 20230420_043841.jpg 20230420_043856.jpg 20230420_100152.jpg 20230422_214725.jpg 20230420_100221.jpg 20230420_100045.jpg 20230420_100036.jpg 20230420_100100.jpg 20230419_232701.jpg 20230419_202126.jpg 20230420_100242.jpg 20230420_100019.jpg 20230419_232706.jpg
 
OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
Nutramar Foods
OP
OP
Borat

Borat

Valuable Member
Review score
+0 /0 /-0
View Badges
Joined
Apr 4, 2021
Messages
1,000
Reaction score
1,102
Review score
+0 /0 /-0
Location
United Kingdom
Rating - 0%
0   0   0
The one thing I would recommend thinking about is the acid concentration you use. I am currently using 0.1N hydrochloric acid, however I am thinking of potentially diluting it further to perhaps 0.05N.

The weaker the acid - the more precise your DKH calculation will be (just because the dosing amount is more accurate for larger volume). Your DKH calculation formula is as follows:

DKH= acid_vol/sample_vol*2800*ACID_CONCENTRATION (here ACID_CONCENTRATION = 0.1 as it currently used)

Generally the dilution formula works as follows. Let N1 and V1 be concentration and volume of solution before dilution and let N1 and V2 be concentration and volume of solution after dilution.

Then the following will hold : V1*N1 = V2*N2

.. from this we can calculated V2 =V1*N1/N2 and thus the amount of RO water you need to add to your N1 concentration to get N2 concentration is equal to V_RO = V2-V1 = V1*N1/N2-V1 = V1(N1/N2-1)

For example, you are diluting from strength 0.1N to 0.05N: take 1 litre of 0.1N solution (V1=1) add the amount of RO water equal to:

V_RO = 1*(0.1/0.05-1) = 1 LITRE

..and your DKH formula for 0.05N acid concentrration would be:

DKH = acid_vol/sample_vol*2800*0.05 =acid_vol/sample_vol*140

The only disadvantage of having very diluted acid is that your reagent container needs to be large (every test will use more reagent volume), otherwise you run out of reagent too quickly. Also bear in mind that your reaction chamber needs to be sizeable enough for both test volume and acid volume. Mine is approximately 150ml, so I have approx. 50ML spare size for acid (which is plenty - and would roughly work for acid concentration down to 0.01N). You can always reduce the sample size (from currently assumed 100ml) to allow for more accid to be added.

Good luck to everyone to try this marvelously simple technology for which you don't need to pay extraordinary amounts of money.

Borat.
 
Last edited:

Gogo007

Active Member
Review score
+0 /0 /-0
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
63
Review score
+0 /0 /-0
Location
Egypt
Rating - 0%
0   0   0
BRS

Gogo007

Active Member
Review score
+0 /0 /-0
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
63
Review score
+0 /0 /-0
Location
Egypt
Rating - 0%
0   0   0
The one thing I would recommend thinking about is the acid concentration you use. I am currently using 0.1N hydrochloric acid, however I am thinking of potentially diluting it further to perhaps 0.05N.

The weaker the acid - the more precise your DKH calculation will be (just because the dosing amount is more accurate for larger volume). Your DKH calculation formula is as follows:

DKH= acid_vol/sample_vol*2800*ACID_CONCENTRATION (here ACID_CONCENTRATION = 0.1 as it currently used)

Generally the dilution formula works as follows. Let N1 and V1 be concentration and volume of solution before dilution and let N1 and V2 be concentration and volume of solution after dilution.

Then the following will hold : V1*N1 = V2*N2

.. from this we can calculated V2 =V1*N1/N2 and thus the amount of RO water you need to add to your N1 concentration to get N2 concentration is equal to V_RO = V2-V1 = V1*N1/N2-V1 = V1(N1/N2-1)

For example, you are diluting from strength 0.1N to 0.05N: take 1 litre of 0.1N solution (V1=1) add the amount of RO water equal to:

V_RO = 1*(0.1/0.05-1) = 1 LITRE

..and your DKH formula for 0.05N acid concentrration would be:

DKH = acid_vol/sample_vol*2800*0.05 =acid_vol/sample_vol*140

The only disadvantage of having very diluted acid is that your reagent container needs to be large (every test will use more reagent volume), otherwise you run out of reagent too quickly. Also bear in mind that your reaction chamber needs to be sizeable enough for both test volume and acid volume. Mine is approximately 150ml, so I have approx. 50ML spare size for acid (which is plenty - and would roughly work for acid concentration down to 0.01N). You can always reduce the sample size (from currently assumed 100ml) to allow for more accid to be added.

Good luck to everyone to try this marvelously simple technology for which you don't need to pay extraordinary amounts of money.

Borat.
you are right Mr borate i am using 0.025 this is not that much dilute and make a good accuracy @0.1DKH which will be
0.128 ml of the acid to volume of 100ml of sample the 0.128 could be handled accurately through the steeper pump with 2*4mm tubes .. the accuracy now only depends on how accurate and linear is the ph module and ADC of the microcontroller is .. which is fare is very good the normal usage of acid is about 11.5ml to KH of 9DKH at 0.025N acid and sample of 100ml i found that is good for me so normally with 3 tests per day gonna be 34.5ml daily usage and 1.035Liter per month so drum of 2liter will hold me for 2month
 

Polyp polynomial: How many heads do you start with when buying zoas?

  • One head is enough to get started.

    Votes: 27 10.6%
  • 2 to 4 heads.

    Votes: 145 57.1%
  • 5 heads or more.

    Votes: 65 25.6%
  • Full colony.

    Votes: 10 3.9%
  • Other.

    Votes: 7 2.8%

New Posts

AAF
Back
Top