Help needed with reed switch pulsed water meter


Hi, I am having a problem adding a reed switch (that is attached to a water meter) to either a Arduino Uno or a Raspberry Pi (which ever is easiest), to try to make a Smart meter that logs the overall running total reading and sends a daily / weekly / monthly report via Cayenne. I have searched lots of different versions but none have been done using Cayenne. The main issue is with the hardware, does it require pull up resistor, would it be a digital or analog connection and would I need a de-bounce circuit.
Just to add, I am very late to this at 62, and without the help of these forums I would be absolutely stumped. Thanks.


Hi @311, welcome to the Cayenne Community, and apologies your post didn’t get a more immediate response yesterday.

What I would do is break the problem into two steps. This approach works pretty well with troubleshooting Cayenne things since our software is fairly straightforward – sending and receiving sensor and actuator data and acting on what it gets.

First get the hardware/circuit working outside the context of Cayenne and logging data to the Arduino serial monitor. That seems to be mostly what you’re asking for in your initial post here. I’ll confess to being much more of a software than a hardware guy (though always learning), so to that end I usually need some sort of guide to tell me when a resistor is appropriate, things like that. I’d start with something like this reed switch hookup guide, and get it working with the example code on that page. Even if you don’t have an LED, you can just output text to the Serial Monitor to debug.

Certainly feel free to ask the forum for help along the way here – we’re happy to have non-Cayenne IoT/hardware/project discussion on the forum, in fact we’d like to see more of it and build our community as a place for makers and hobbyists to discuss these items.

Once you have things working outside of Cayenne, you can add the Arduino to Cayenne, and then a widget to represent the state of the reed switch (likely a 2-state custom widget), and then build off of that.

I’d be happy to walk you through the Cayenne end of things when you get there, but at the risk of typing many paragraphs when they aren’t needed (as I’m want to do), I’ll leave you with the getting started guide for Cayenne with Arduino which walks through setting up your device, the Arduino IDE, connecting the device, and adding basic widgets. By all means, if this raises more questions, or if you have trouble or something not covered there, just ask and we’ll do our best to fill in the gaps.


OK, thanks a lot for that, I am on the way now to make a working smart water meter. Looking forward to you counter widget hitting the dashboard.