0
\$\begingroup\$

I have to set up an ESP8266-01S to monitor temperature, raindrop and also water-flow while at the same time controlling a pump. There is also a request to only power the raindrop sensor when needed to read but not permanently to help the sensor live longer without being affected by electro-chemical effect.

Since the ESP8266-01S has only 4 pins available for use, can anyone advise me on how to power the raindrop sensor on demand without using an additional port expander?

JRE
75k10 gold badges115 silver badges197 bronze badges
asked Jun 17, 2021 at 9:21
\$\endgroup\$
0

1 Answer 1

0
\$\begingroup\$

As a part of the question yesterday that has been complained on its feasibility (I did all the thought using my high school knowledge with little further reading so sometime, idea seemed to be stupid and blamed unreliable by some reviewer over here), I have successfully made a pump control for watering my root-top garden and answer the question myself.

Input: Control a pump using blynk app and ESP8266-01S hardware with following requirements:

  1. Temperature sensor with DS18b20
  2. Raindrop sensor: to stop/delay the pump from watering the garden when rain happened for more than 30 minutes and also keep the pump from longer operation if daily temperature is too high.
  3. Water-flow detector: to prevent problem to pump

Design: The schematic is simple, just need a 5V power module(I used a mobile charger 700mA) and a single relay with ESP8266-01S module, ds18b20, water-flow switch, raindrop sensor, few headers and resistors. See my sketch on the link EasyEDA at the end of the post.

ESP8266-01S relay module (Link on this part) This board is a fully function wifi-relay that can switch AC power at 10A, 220VAC (max), has a built in 5V-3.3V regulator and all parts needed for the relay to work and to power ESP8266-01S. I make the breadboard PCB to also use 3.3V power from the relay board as well. De-solder 2 headers and connect with 2 new headers on the PCB breadboard.

Flow switch Link on this part

Rain drop sensor And here

Since raindrop sensor requires power for monitoring, its life will be shorten due to weather and electro-chemical reaction. I tried to use the following approach (that has been mentioned here using a MOSFET - IRFZ44N to power the module when needed and this will require another pin), but instead of a mosfet, i used a normal 2N3094 NPN transistor (and supply upto 200mA current). Since ESP8266-01S has only 4 pins and already used up all by other part, I decided to find a way to use the single Rx pin for both (1) The water flow detector and (2) Power the raindrop module. The boot will fail if Tx pin is pulled low at boot so I have to use a pull up Resistor (10K). Yesterday, I made an unclear question on using a NPN transistor as a switch and it was responded as unreliable and not feasible. After sometime of testing on breadboard, I successfully made this using the schematic as shown below:

Power Raindrop sensor and also work as input for water flow detector R2 is a pull down resistor for Rx pin and R3 is to limit current to the base of the transistor. To allow this to work, in the sketch, I used a timer to monitor rain every 10 minutes. In the function for updating rain status, I used the following approach. Perhaps, a current limit resistor(about 1K) is needed for protecting the Rx pin but I did not use as I have made the board soldered already and the transistor only draw current from the pin in just 1 second for reading rain status, so it would not be a big problem at all)

Function for rain sensor update

At input mode, if the flow detector work, transistor will also work and supply power to raindrop sensor. and all done. Thank you for allowing to post this work here! if anyone need the sketch, please post comment with your email then. Link for the schematic is here! https://oshwlab.com/ngocdd/pumcontroller Here is some images on my work

Final control box

Exit valve and flow detector set up Exit valve and flow detector

My rooftop garden here My garden in action

Schematic Tip: For better soldering on PCB breadboard, I used this type of square routing on EasyEDA for correct placement and nice solder marks Top routing Numbering for correct positioning of parts

Bottom view for soldering Square bottom routing on PCB

Final product

That's is: I have the board with less than 6$. And then just play around with OTA firmware upload and revising of code...

answered Jun 17, 2021 at 10:14
\$\endgroup\$
2
  • \$\begingroup\$ You need a flyback diode across the relay coil to protect the transistor (and the rest of the circuit). \$\endgroup\$ Commented Jun 18, 2021 at 11:17
  • \$\begingroup\$ Thanks Mr. Andrew, the relay itself has the diode already, i made all things around the relay board to expand the use of the esp8266-01S chip only! \$\endgroup\$ Commented Jun 18, 2021 at 14:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.