Need help with automatically changing aquarium water setup

Hi, I have no experience in electrical circuits. Over the past week, I have done a lot of research and put together the following plan. Would really be happy if someone can help me with this.

Objective :

To develop a system that can do aquarium water changes.

The Setup

  1. Place the submersible 5v dc water pump at the lower level of aquarium (the level until which we want to remove).

  2. Connect a host to the solenoid valve which is then connected to a mechanical valve which will stop flow once aquarium is filled.

  3. A water flow sensor is attached to the pump and the solenoid valve each to detect flow.

The Plan :

  1. A button (switch) is pressed, start the water pump. Turn off water pump after 1 minute. The water should continue to flow out even with no power until water level reaches pump level.

  2. NodeMCU will wait till the flow in the pump stops (as detected by the water flow sensor).

  3. After water drained to the desired level, Solenoid valve should switch on allowing water from the host to flow in. Once water reaches the mechanical valve, it will stop. (once flow is stopped as indicated by the flow sensor), the Solenoid valve should close.

End of process.

Problems faced

  1. I am not sure where to connect the sensors wire from the relay to the NODEMCU (IN1 and IN4).

  2. I am also not sure where to connect the sensor wire from the water flow to NodeMCU (the yellow line in the Image.

  3. I would also be grateful if someone can look at my drawing and advice me if this will work or if I’m doing something wrong.

The pumps and water flow sensors are 5v. The solenoid valve is 12v.

Any other advice will be much appreiated. Thank you.


Are you sure that this is your exact board? Pin outs vary. Also this is an 8266 that requires a 3.3v power supply not 5v.

Nodemcu boards require a 5vdc VIN. It then has an onboard power regulator that steps it down to 3.3vdc for the other uses.

What software are yiu using to program the nodemcu? Esphome? Arduino IDE? Those connections should be defined there.

Also this us for community guides that people post to help others do other things. It’s not supposed to be used for asking for help on this kind if thing.

You should change the category.

But once you get it finished and working THEN post your guide back here. :slightly_smiling_face:

I concede it seems that some do have 5v step downs like d1 mini’s. Still I have a few that are 3.3v only goes back to accurately listing the parts you are using.

Absolutely not. ESP 8266 is 3.3v only. The newer model ESP32’s are 5v both are referred to as nodemcu’s. OP has a 8266 in his diagram.

No, the OP has a NODEMCU board in his diagram that contains an ESP8266 chip.

As far as I know all ESP8266 NodeMCU’s are 5vdc in. I’ve used them for several years now and they have all been 5vdc input voltage. And now that I think about it I believe they even have a higher range than that even. I haven’t looked it up but I seem to recall the VIN range being as high as 12v. I’ve never used anything like that to test it out tho. I just stick to 5vdc USB power supplies.

The ESP8266 chip is supplied by the onboard regulator.

Now, if they were using a standalone ESP8266 board apart from a dev board then I completely agree with you. 3.3vdc it is.

EDIT:

I just looked it up and the VIN spec is 4.5 - 12vdc depending on your source. I saw either 7-12vdc or 4.5-10vdc (mostly 4.5-10)

Hi guys, thanks for the replies.

The one i have has lolin ch340g written on it. Sorry i assumed they were the same

I did read somewhere that it could take 12v. However there is a discussion here said its not recommended and can lead to heating issues Can I power nodemcu v3 with 12v? - General Electronics - Arduino Forum .

I’ve also come across this baseplate

It says it can take up to 24v. Does it mean if i use this i can make do with just 1 power supply? So i power all the devices with a single 12v power source. Will that work?

I plan to use esphome. I havent used it before but it dont look too complicated.

they are the same.

the CH3340g isn’t the nodemcu board. it’s the board you use to flash it. But you can use others as well.

I use the Lolin boards too and it is 5vdc in.

I don’t think the NodeMCU can take 12v. the reference I saw was 10.5v max for the Lolin Boards.

Yeah definitely not recommended. Stick to 5V.

Just to confirm that we are on the same page, 12v is not recommended even if i use the base board as in the picture below?

Sorry for the confusion.

I have no idea. I’ve never used one of those.

1 Like

We were not on the same page. I was referring to the bare ESP board. That base board does appear to have a built in regulator that would enable you to use from 6 to 12V.

Thanks for confirming. Do you also happen to know which pin would supply 12v? It appears to me that there is no 12v output. Does it mean i have to tap the power from the source directly?

Im sorry if my questions sound stupid, this is my first time doing this.

What about these pins marked in pink:

They should be the same voltage as the voltage you apply to the DC barrel jack.

I am not sure about that. If you look at the base board, that vi (circled in red) seems to correspond with the 3.3v out in the nodemcu also circled in red.

So i assumed those pins a 3.3v .

Again im not an expert on these so i dont know if im right

While looking for the manual/schematic of the board I found this:

It says “power in” but you can use it as 12V out as well. If you connect 12V via the barrel jack or that header pin row I highlighted.

Follow the arrow next to Vi. It’s just pointing at the header pin row. Nothing connected to the row the name is next to.

Awesome, thanks for clarifying. Now i just need to figure out where to connect the sensor pins

Some good advice on which pins to use here (scroll down to the table):

EDIT: also as your fishes lives depend on this working correctly I would not use it unsupervised until you are very confident that it is working correctly.

Great. Really appreciate your help. I have ordered the parts. Will update on the status once its all put together.

Yes definitely.

Just to make sure i got it right, i should be able to connect my flow sensors (yellow line in the picture ) to either D1, D2, D5, D6, D7.

And i should also be able to connect IN on the relay to either D1, D2, D3, D4, D5 D6 D7.

Since there are more available output pins than input, i plan to connect the flow sensors to D1 and D2.

Then I can connect the relay IN to D3 and D4.

This will leave me another 3 input pins empty for any sensors i plan to connect in the future. Will that be correct?