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. Proximity Sensor E2F-X2E1:http://www.kynix.com/Detail/5097/E2F-X2E1.html.This is the circuit that is used:
I bought the reed relay (SIL121A7272L) as described in the circuit. However I couldn't get it to work. 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.
Looking at the schematic you posted, the input pin is floating. Have you enabled the internal pull up resistor on the pin it is connected to? This can be done like so:
p = Pin('P10', mode=Pin.IN, pull=Pin.PULL_UP)
where P10 is the pin you are using as an input from the sensor.