I’m trying OpenSprinkler using Paolo Becchi’s ESP32 implementation (on a little ESP32 LoRa board). It runs fine over the web, etc, though not connected to any sensors or valves… Currently waiting for a couple of his Smart Solenoids to try the LoRa portion!
Looking to hook up a reed switch flow sensor I bought recently, and thinking about how to connect it to the appropriate GPIO pin.
Imagining something like pull-up and pull-down resistors to Gnd and +3.3V, respectively. I thought to use the reference OpenSprinkler implementation as a guide to check my thinking. However, I can’t find a schematic to review, other than Eagle files on Github… does anyone have a PDF, or know how the flow sensor is actually wired to the GPIO pins on the board?
Eagle is free, you can download, install it, and open the circuit design files with it.
Dry contact sensors like rain sensor, reed switch flow sensor, can be directly connected between a GPIO pin and ground. These sensors are un-powered and behave just like switches. Most GPIO pins on ESP8266 (and I believe ESP32 as well) support internal pull-up so you don’t need external pull-up resistors. OpenSprinkler design also adds a 4.7K series resistors which is purely for protection purpose (in the past we’ve seen users carelessly plug in 24VAC into the sensor port, instantly toasting the microcontroller). If you can ensure such accidents won’t happen, there is no need to add the series resistor. If the sensor is placed outdoors, you may consider adding a MOV or TVS diode to protector the GPIO pin from surge voltages.
Thank you @Ray for the thorough answer! (and sorry for the delayed thanks)
That makes perfect sense… I tend to be a belt-and-suspenders guy, so the extra 4.7k resistor makes sense.
BTW I did actually switch to a plan where the flow sensor goes into a stock OSPi and the ESP32 acts as an extender only. This way I get a nice solid platform with the OSPi and also a faster platform to run any monitoring scripts, etc.
It’s a nice product.