Water Tank Level Indicator with Low Level Warning Notifications

Begineer Actually i am just copying the code do some alterations if needed nmot more than that but for the pump controlling using relay i need the code to place in pervious code kindly write a code. Please I need it .Much appreciation from another globe side.

I’m not going to write your code for you, I have other things to do with my time.

If your coding skills were better then I’d give you some pointers about how to configure and control the relay and set-up the variables and widgets to give you the parameter inputs and how to do the comparisons of readings against these parameters. But, I don’t think that would really help.

Pete.

2 Likes

I’m building a water storage system, I really like this idea. I’m in the US on the west coast. Where can I go to learn how to change this code to read inches and gallons. I have been google ing, with no real results except the inch distance = duration/148; … this should be the calculation for inches. I’m sure there is more, I’m wanting to learn.

1 litre = 0.264172 US gallon
1 centimetre = 0.393701 inches

The simplest way is probably to change these two lines:

to:

Blynk.virtualWrite(V12, smoothDistance*0.393701); // Distance in inches not centimetres
Blynk.virtualWrite(V4, volume1*0.264172); // Volume in US gallons not litres

Pete.

1 Like

Thanks Mr. Knight. I will give it a go. Still waiting for some of the hardware to show up. Regards Grumpy.

Hi,
I trying multiple code, your code seems impressive . My Tank is rectangle how do i calculate the volume. I tried diff formula not sure its occurate. Can you help me with it.

Thankyou @sheikinet. First place to start would be this line

volume = ((waterTankHt*(PI*(sq(waterTankDia/2))))-(distance*(PI*(sq(waterTankDia/2)))))/1000;

Instead of formula for circular tank you will need formulae for rectangular tank.

1 Like

Thanks @GG07 For quick response sure will try it.

Hi GG07,
Thanks for sharing! Since I am a beginner for Blynk 2.0 (have done POCs on Blynk older version and RemoteXY) I found exactly what I need with your project.
I wonder if you could share your Dashboard or have considered to migrate the project to Blynk 2.0. ? I will give it a shot and let you know the status (don’t think I will complete…)
Thanks in advance
Y3G

I glad you found what you need. I will migrate over to Blynk 2.0 eventully. I have already moved a couple of projects over.

I have changed my water level project slightly to make it easier to input tank dimensions. Here are a couple of screen shots.

Thanks GG07,
Looking forward to, meanwhile I just prepared the dashboard but still struggling.
Not that easy to get info because most of the docs are related to Blynk legacy app.
Keep us posted
BR
Y3G

Blynk 2.0 is fairly simplistic… Just create a data stream for each virtual pin then connect that data stream to the correct widget… With a bit of trial and error you will get it right.

1 Like

I have a rectangular water tank. how to Calculate it. And what changes need to be made in the code

It’s a pity you can’t be bothered to scroll up a little and find the same question and it’s corresponding answer…

Pete.

2 Likes

BLYNK_WRITE(V10) {
levelAlert = param.asInt();

Can this command retrieve data from Blynk SuperChart?

No.
BBLYNK_WRITE(vPin) is triggered when the value of a datastream changes as the result of widget or the HTTP(S) REST API.

Calling Blynk.syncVirtual(vPin) will cause the server to send the current virtual datastream value to the device, triggering the corresponding BLYNK_WRITE(vPin) function.

Pete.

Pete,
I send data sensor to this vPin, and will changes the datastream in SuperChart. it could update the current datastream. Or is there any way I can retrieve datastream in SuperChart to my device?
I send sensor data with one device and want to retrieve it with another device with the same token

I really don’t understand your question.

The type of widget that is attached to your datastream doesn’t really matter. If you want to retrieve the last value sent then you can do it in the way I described above. However, in most cases that isn’t necessarily, as you know what the last value was, because you just sent it from the device to the datastream.

Pete.

Thank you Pete. for your guidance. I can retrieve data from Blynk Server to the device by the same function but for all widgets by this function:

BLYNK_CONNECTED() {
Blynk.syncAll();
}

before I call out BLYNK_WRITE(vPin) function.

Regards,
Ted

@teddkn when you post code to the forum you need to place triple backticks at the beginning and end so that it displays correctly.
Triple backticks look like this:

```

I’d never use Blynk.syncAll, it’s a sledgehammer to crack a nut.
You should synchronise only the datastreams that you need the current values from.

BLYNK_CONNECTED runs once when Blynk is connected, and again if there are subsequent re-connections.

If what you are trying to achieve is to retrieve the datastream values from the server when your device boots-up then it would have been helpful if you’d stated that at the beginning.

I suggest you read this for more info…

Pete.