Help needed (and mu...
 
Notifications
Clear all

Help needed (and much appreciated) with reading a pulse output with ESP8266

5 Posts
4 Users
3 Likes
1,129 Views
(@notsogoodatcode)
Member
Joined: 3 years ago
Posts: 3
Topic starter  

I should have asked for help on this long ago.  I was trying to build off of Bill's video with the laser and ultrasonic distance sensors where pulse outputs are counted using an arduino, but I am using an ESP8266.

I'm trying to use an ESP8266 to read the pulse output from a water meter that I installed.  Critically, the meter output has only 2 wires.  This is a link to the water meter in case a picture helps.  Short story is that I don't know how to wire this up to read the pulse output.

What I have done to date:

The water meter is in a location over an hour from me so I bought a cheap electric pulse generator to work on the project and test it at home.  I got everything working well with the pulse generator standing in for the water meter.  The pulse generator also has 2 output wires (a ground and a signal).  However, I somehow overlooked the fact the pulse generator has another two wires that are used to supply power to the pulse generator itself.  The pulse output sensor on the water meter has no equivalent input to provide power.  The wiring setup that worked with the pulse generator did not work with the actual water meter output wires.

After much searching I came across a wiring schematic online that I thought might work.  The diagram is towards the bottom of this page just under the heading for Reed Switches.  I interpreted this diagram as saying to connect one end of the water meter pulse output to ground and split the other between power and an input pin.  I tried this using a reed switch that I bought but it just seems to short out the ESP8266 unit.  For completeness, I used D8 and 3.3V for the side of the circuit not connected to the ground pin.  I also activated the pullup resistor on pin D8.

Any suggestions for how to connect this 2-wire pulse output to a ESP8266 would be much appreciated.  I have a variety of meters that I want to read and all have the same 2-wire pulse output setup.  I have a feeling this is some very basic misunderstanding on my part, but I haven't been able to piece this together on my own through web and youtube seaches.

Thanks!

 

Josh


   
Inst-Tech reacted
Quote
(@davee)
Member
Joined: 3 years ago
Posts: 1657
 

Hi Josh @notsogoodatcode,

   Welcome to the forum ... hopefully we can help you get started.

I am pleased to see you have carefully prepared your question above, and hope you won't mind if I suggest you add a schematic diagram of the test circuit you are trying to get to work.

I am only imagining a photo of a very basic pencil sketch - you might already have done one for your own purposes - it will make it much easier to follow your text.

Thanks. Best wishes, Dave


   
ReplyQuote
(@notsogoodatcode)
Member
Joined: 3 years ago
Posts: 3
Topic starter  

Dave,

Thanks for the response.  I fell ill right after the prior posts and am just getting back to it now.  BTW, how do I upload a picture to the forum?  All I see is a notice saying no more uploads are allowed today.

Also, I think I've had a bit of a revelation on this.  I was trying to implement the circuit in this diagram. However, I am doing this on NodeMCU-32 instead of an Arduino.   I now think I misunderstood the diagram and the resistor pictured is actually the pullup resistor on the NodeMCU.

I think I can reframe the question now. Assume that I am going to use GPIO22 on the NodeMCU to read pulses.  The water meter has a simple reed switch pulse output (2 wires).  One side of the reed switch will connect to GPIO22.  Would it be best to: (A) connect the other side of the reed switch to 3.3V and use the pulldown resistor on GPIO22 or (B) connect the other side of the reed switch to ground and use the pullup resistor on GPIO22?  I believe that I've found different diagrams with both configurations.

Thanks,

Josh


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2507
 
Posted by: @notsogoodatcode

Thanks for the response.  I fell ill right after the prior posts and am just getting back to it now.  BTW, how do I upload a picture to the forum?  All I see is a notice saying no more uploads are allowed today.

You might not be able to post a picture until you've made a few more posts. I think there's a "trial period" before you become fully accepted; during that period your posts have to be vetted by an administrator before they show up here.

To re-state the obvious, to post a picture you can either use the "Attach Files" icon below and navigate to the file you want to add as an attachment or just drag and drop the file onto the post you're creating.

Note that not all file types are acceptable to the drag and drop option, so you may need to resort to the icon method.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@notsogoodatcode Pullup on 22 via the builtin pullup, INPUT_PULLUP vs INPUT in the pinMode statement. 

No actual resistor needed.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote