Hi Blynkers,
I came up with an idea for my aquarium. Every week I have to do a 25% water change over and over again. So I tougth of programming a Wemos board to do all the draining and filling by it self. The system will consist of 4 float sensors. Two in the aquarium where the water needs to stop draning and another one at the top to prevent over flowing. One other sensor at the top of the drain bucket and the other one at the bottom of the bucket to prevent me from burning the pump due to low water. I will have a relay to control the pump to fill the aquarium and a solenoid valve to drain pipe coming from the aquarium to the drain bucket. I think I wont need another pump to drain the aquarium I will be using the power of gravity the drain the water. As a sefety procedure I will have a soil water sensor of of ebay the stop the pump and alert me if there is water on the floor near the aquarium. I will think that will come in handy someday . In the Blynk app I will have 4 buttons. One to start filling the aquarium, one to turn the water valve on and off to drain the aquarium just till the stop sensor. Another one the start the whole process on and the forth button the stop everything.
This is the code so far but I got stuck due to my lack of skills Withe this code the Board is resetting and giving a lot of garbage when you toggle the button. I also attached a copy of my dashboard. Can some one help me with this code I an completely lost?
This is the garbage I was talking about in the serial monitor. After the arduino resets.
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define drain_bucket_full 16 //D0
#define fill_bucket_empty 14 //D5
#define aquarium_empty 12 //D6
# define aquarium_full 5 //D1
#define Fill_Pump 15 //D8 Relay
#define drain 13 //D7 Solenoid
#define watersensor A0
char auth[] = "501xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx71a2";
char ssid[] = "ClxxxxxxxxxxxxxxxxxxxxxxxxxxWi-Fi";
char pass[] = "clxxxxxxxxxxxxxxx3";
BLYNK_WRITE(V0) // At global scope (not inside of the function)
{
if ( param.asInt() == 1 ) {
while (digitalRead(fill_bucket_empty) == HIGH && digitalRead(aquarium_empty) == LOW) {
digitalWrite(Fill_Pump, HIGH);
}
}
}
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
while (Blynk.connect() == false) {}
pinMode(drain_bucket_full, INPUT);
pinMode(fill_bucket_empty, INPUT);
pinMode(aquarium_empty, INPUT);
pinMode(watersensor, INPUT);
pinMode(Fill_Pump, OUTPUT);
pinMode(drain, OUTPUT);
}
void loop() {
Blynk.run();
}