Building a water meter counter using a Pycom Lopy



  • I am in the process of building a water meter counter using a Pycom Lopy. The Lopy operates at 3.3v but my input sensor which is a metal detector (K1208065) uses 12V.

    Someone else has already build a similar counter using a raspberry PI with a piface. This is the circuit that is used:
    0_1517384407758_VzWuz.png

    I bought the reed relay (SIL121A7272L) as described in the circuit. However I couldn't get it to work.(I've read a relavant article which help me to comprehend relays,read it if it can help you too: http://www.apogeeweb.net/article/65.html ) What I did to troubleshoot is:

    • Measured resistance between pin 3 and 5 (1k resistance as expected)

    • hooked up a multimeter in continuity mode on pins 1 and 7, I expected that when detecting metal (pull down the signal) the continuity mode would buzz. However that did not work.

    • Tried swapping the coil and switch pins (opposite from what is described in the circuit)

    • Tried using another reed relay, I actually bought two.

    After I could not get the circuit to work, I decided to protect my input pin using a simple voltage divider. I used 100k and 33k values, because that is what I had laying around. The result was a voltage of 2.98V which is detected by the Lopy as "HIGH", but the signal is not stable. It jumps around from "HIGH" to "LOW" every now and then. My thought is that this might be because of the resistor values being to high, is this correct?

    Any thoughts on getting the reed relay to work, or getting the voltage divider stable are very welcome. Any other solutions to protect the input are welcome as well.



  • @jiancha For the input of the Lopy Youll need some kind of Pull-up. That could be an internal pull.-up resistor, or an external one, like 4k7 to 3.3V. Otherwise the input is floating when the switch is open. Which Pin of LoPy are you using for input, and how do you control it?
    Using the reed relay is in principle a good idea to protect the Lopy from transitions. But the values of 33k/100k for the voltage divider are also suitable. The resistor values are not too high. The input resistance of the Lopy is several MOhm.


Log in to reply
 

Pycom on Twitter