Create a water detector that sends a message over wifi

Hi everyone,

This is my first Arduino project and was looking for some general guidance and thoughts on the project.

Some background:
A few years back, I bought a MEGA 2560 kit ("The Most Complete Starter Kit Mega 2560" on Amazon) to help me learn about Arduino etc and I never really got off the ground. Now, I've done a lot more control/electrical engineering work and I more or less understand the way things work. (I think anyway). So I'm back at it.

I am fermenting cabbage for sauerkraut and a part of that is to keep a water barrier at the lid to prevent more oxygen from forming and allowing CO2 to fill the crock for the fermentation process (at least that's what those directions told me). Regardless, I find myself checking my water barrier daily because my air conditioner is dehumidifying the room essentially (as it's supposed to).

In that kit I bought, there was a water level detector and I thought, wouldn't it be cool if I could have something text/email me if the water sensor goes low? I mistakenly(?) bought a SIM800L EVB after a quick Google search, not knowing what it was outside of it sending texts, yadda yadda, so on and so forth, etc etc, here I am. Maybe I'll use it later or just toss it or donate it since it was like $13.

End of background and beginning of project:
I want to use a water sensor (currently own), MEGA 2560 (currently own), and ???????? [where I need some help], to shoot me a text/email over Wi-Fi that I need to refill water. An additional thought, I was just going to throw the sensor in the water and lean it over the edge, do you have any thoughts on making this pretty with some type of case? Or even to avoid a case?

What would be an appropriate Wi-Fi sensor- I feel like I had found one the other day but since lost my notes on it- I will try to find it again and post it once I find the model # if someone hasn't made a recommendation by the time I finish the below code.

How do I find details on how to write the communication for the Wi-Fi and commands?

I am going to make a quick version of this shortly where I replace the Wi-Fi with a buzzer, just so I have something and will reply with the code on that once it's completed.

Thanks in advance!

Look at using an ESP32 Development PCB.


Suggest you just bring up an audible alarm instead of the complexity of WIFI.

:wink:

1 Like

Hello trswingle11

Take some time and learn how to use the ESP32 controller.
This controller offers everything you are looking for. You just have to tailor it to your project.

Have a nice day and enjoy coding in C++.

p.s. LarryD was faster :slight_smile:

p.s.2. Is sauerkraut an english word?

Yes

:+1: :+1: :+1:

1 Like

@LarryD and @paulpaulson

Thank you both so much! This board seems much easier lol. And yes the audible alarm is probably much easier than Wi-Fi but I also don't want to be woken up in the middle of the night :sweat_smile:.

Do either of you know if there's a project kit to this one?

If you go to the MEGA 2560 Starter Kits menu, there's a download with extremely basic projects that goes over all the different setups you could have in the kit. It helped me learn about setting up the individual components on the MEGA 2560 pretty well.

Thoughts on something similar to for the ESP32?

Unsure how to add a reply to your PS2.
But yes, it's delicious on lots of food, and on its own. It also has good health benefits supposedly. It has a salty flavor from the brining process. 25 Delicious Ways to Use Sauerkraut | Get wilder | wildbrine

I'll say- I've never used it in a dessert or smoothie though.

There is a large learning curve that you must master when you get into WIFI …

Here is a good place to start:

Thanks!

I think this is pretty close-ish....

In my head I was thinking I would somehow write the water detection in that code.... but I feel like that's wrong. Is there a way for me to basically call that routine when my detection is met?

void loop(){
// do water detection 
//if water detection is x
       // call the "Send an Email with HTML or Raw Text with ESP32 (Arduino IDE)"
//end if
}

side note: C++ was brought up earlier, does the MEGA 2560 also use C++. I assume it does since it's in the Arduino IDE. My thought is write everything except the Wi-Fi part to work on the MEGA, then once it's delivered, convert it to the ESP32.

would measuring relative humidity be useful? e.g. bme280-sensor-arduino-pressure-temperature-humidity
works with a ESP32 without problems

Figured out how to quote a post finally.

I don't think I would be able to measure RH in this case due to location (near my AC- I probably need a better location anyway). I would expect RH to be very low most of the time, or at least stable.

And I'm not measuring the inside of the of the crock, just a lip. I put water in the red circled channel, and have to continuously refill it to ensure a vacuum inside. If that water level drops, oxygen/bugs can enter the crock and mess with the fermentation process I believe.

This is a most practical way for a proper system design.

Divide et impera.

how large is the channel? could you fit a water level sensor? I would suggest a capacitive senor

it can fit the water sensor from this kit.

https://www.amazon.com/EL-KIT-008-Project-Complete-Ultimate-TUTORIAL/dp/B01EWNUUUA/

remember the Mega uses 5volt logic the ESP32 3.3V
you may find converting a problem, e.g. connecting 5V logic devices to an ESP32 can damage them

1 Like

hmm... this says to "connect the + (VCC) pin on the module to 5V on the Arduino and the – (GND) pin to ground."

Is there anyway to know if it would work on 3.3v without an issue other than just trying it?

should probably work with VCC 3.3V - try it on your Mega?? should still give a range of analogue readings

1 Like

Nice crock pot !

BTW, after making many gallons of sauerkraut, I’ve never had problems with water levels getting too low. :thinking:

Wellllll. I'm also self taught at that too :rofl:. My liquid level inside isn't really my concern, it's just the water seal from the rim. Maybe I don't need it. But I figured it's a fun little project anyway to get my feet wet. (get it? since it's a water detection project? :rofl:)

image

Okay.

So this is what I have so far.

int adc_id = 0;
int HistoryValue = 0;
char printBuffer[128];
int buzzer = 12;//the pin of the active buzzer

void setup()
{
  Serial.begin(9600);
  pinMode(buzzer, OUTPUT); //initialize the buzzer pin as an output
}

void loop()
{
    int value = analogRead(adc_id); // get adc value

    if(((HistoryValue>=value) && ((HistoryValue - value) > 10)) || ((HistoryValue<value) && ((value - HistoryValue) > 10)))
    {
      sprintf(printBuffer,"ADC%d level is %d\n",adc_id, value);
      Serial.print(printBuffer);
      HistoryValue = value;
    }
    if (value<50)
    {
      //replace below with "Send an Email with HTML or Raw Text with ESP32 (Arduino IDE)" from 
      //https://randomnerdtutorials.com/esp32-send-email-smtp-server-arduino-ide/
      
        int sound_duration = 100;
        //activate the active buzzer
        digitalWrite(buzzer, HIGH);
        delay(sound_duration);//wait for sound_duration ms
        //deactivate the active buzzer
        digitalWrite(buzzer, LOW);
        delay(sound_duration);//wait for sound_duration ms
    }
}

I added the sound portion which works with the if function but not the while function. During the while function, the void loop() ends when the value of the output goes to 50 and it never starts back up. I was not expecting that to occur.

The next step would be figuring out how to replace the sound section with the email of the other function mentioned earlier.

Thoughts on this starter kit?
https://www.amazon.com/Freenove-ESP32-WROVER-Contained-Compatible-Bluetooth/dp/B08FM2NCST/

Side note:
Another reason I can't do a buzzer as standard is because the immediate moment I tested it in my office, my dogs went crazy and started barking :rofl:. I don't want them breaking down the door and eating my sauerkraut :rofl:.

Devices like that are not food-safe.

Duly noted- if you have another recommendation, I'd take it.

Luckily it's not actually going in the food process water, just the lip of the bowl- it's completely separate from the reservoir that holds the brine/sauerkraut. And also luckily (?), me and my gf are the only ones eating it :rofl:.