Watermeter lezen met raspberry en Inductieve NPN sensor Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

ratjenl
Posts: 16
Joined: Saturday 12 August 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by ratjenl »

gielie wrote: Saturday 12 August 2017 22:04 Your sensor is not working, do you see the led blinking when the water is running, and did connect it to the right pin.
Thank you for your quick reply, everything is well connected but the led isn't blinking at all. I will order a new one
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by gielie »

ratjenl wrote: Saturday 12 August 2017 22:35
gielie wrote: Saturday 12 August 2017 22:04 Your sensor is not working, do you see the led blinking when the water is running, and did connect it to the right pin.
Thank you for your quick reply, everything is well connected but the led isn't blinking at all. I will order a new one
Try hold it near something iron, see if the led goes on, it should. Check if there is enough power from the pi otherwise try another power source
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
ratjenl
Posts: 16
Joined: Saturday 12 August 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by ratjenl »

gielie wrote: Saturday 12 August 2017 22:44 Try hold it near something iron, see if the led goes on, it should. Check if there is enough power from the pi otherwise try another power source
Already tried it. Plugged it into an 12v adapter and nothing changes.... I think i really got an doa one.
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by gielie »

Hobbybob wrote: Saturday 12 August 2017 22:33
gielie wrote: Saturday 12 August 2017 22:02
Hobbybob wrote: Saturday 12 August 2017 13:55 Hello, I want to include water-usage in my Domoticz as well, and although it will be dificult to get a wire running between the metercabinet in the hallway where the water-meter is and my livingroom where I have my Raspberry Pi, I am guessing it is going to be the only way...

So: 2 questions:
First off: the device in Domoticz you have a screenshot of is a counter that is modified to display water. I can reproduce that, but I also see a type "Counter incremental". What is the difference between these two, and following that: what is the correct one to use?
Aside from that: Can I connect the blue and brown wires to another power supply, and just the black one to the Pi or does that not work? That would save me 2 wires that I have to move through the rooms... Also: is it a problem if the signal-wire is relatively long? Say, 10 meters?

Oh, and do you need to use any resistor or anything before the signal-wire goes ino the GPIO, or can the Pi handle the output from the sensor as-is?
Maybe you can use a second pi for your water meter.
That is also an option. I already ordered the sensor on Ali, so I guess I'll wait for that to come in first, and test with a longer wire before I buy a second Pi (I only have one).

Do you know if there are any resistors or other components involved in this setup?
No resistor needed, just the 3 wires connected to the pi. I ordered this from Ali http://s.aliexpress.com/yUFbiQBZ, makes the connection much easier.
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
D'rMorris
Posts: 138
Joined: Thursday 01 May 2014 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands - Sittard
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by D'rMorris »

ratjenl wrote:Well i am trying hard but cannot get it to work. I followed al the steps as described but still this error keeps popping up :

Callback function called!
Traceback (most recent call last):
File "/home/pi/domoticz/scripts/watermeter.py", line 41, in Interrupt
if GPIO.input(21) == 0:
RuntimeError: You must setup() the GPIO channel first

Can someone push me in the good direction ?

Thnx
Did you setup your GPIO pin correctly? You have to export it first in sysfs. Is GPIO21 listed in /sys/class/gpio? And if it's listed, is the direction set to in?
ratjenl
Posts: 16
Joined: Saturday 12 August 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by ratjenl »

D'rMorris wrote: Saturday 12 August 2017 23:06
Did you setup your GPIO pin correctly? You have to export it first in sysfs. Is GPIO21 listed in /sys/class/gpio? And if it's listed, is the direction set to in?
It is listed but the file is empty....
oohlaf
Posts: 21
Joined: Monday 06 February 2017 0:57
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by oohlaf »


gielie wrote:
Hobbybob wrote: Saturday 12 August 2017 22:33 Do you know if there are any resistors or other components involved in this setup?
No resistor needed, just the 3 wires connected to the pi. I ordered this from Ali http://s.aliexpress.com/yUFbiQBZ, makes the connection much easier.
Really? Aren't the gpio input pins specified as 3.3v max, not 5v.

Verstuurd vanaf mijn XT1562 met Tapatalk

ratjenl
Posts: 16
Joined: Saturday 12 August 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by ratjenl »

oohlaf wrote: Sunday 13 August 2017 9:02

Really? Aren't the gpio input pins specified as 3.3v max, not 5v.

Verstuurd vanaf mijn XT1562 met Tapatalk
Measured with an multimeter it says 5.12 v.
oohlaf
Posts: 21
Joined: Monday 06 February 2017 0:57
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by oohlaf »

ratjenl wrote: Sunday 13 August 2017 9:32
oohlaf wrote: Sunday 13 August 2017 9:02 Really? Aren't the gpio input pins specified as 3.3v max, not 5v.
Measured with an multimeter it says 5.12 v.
That's the output pin, you have 5v output.
I was talking about the input pin, the wire you connect on PIN 19 as input, is max 3.3volt.
How much does the NPN output on that pin when it detects metal?
ratjenl
Posts: 16
Joined: Saturday 12 August 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by ratjenl »

mine does 5 volt all the time, got it connected on pin40 (GPIO21)
oohlaf
Posts: 21
Joined: Monday 06 February 2017 0:57
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by oohlaf »

ratjenl wrote: Sunday 13 August 2017 14:54 mine does 5 volt all the time, got it connected on pin40 (GPIO21)
so by putting 5v on a pin that is meant to receive 3.3v you potentially break your pi.

https://learn.sparkfun.com/tutorials/vo ... ll?print=1
ratjenl
Posts: 16
Joined: Saturday 12 August 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by ratjenl »

oohlaf wrote: Sunday 13 August 2017 15:09
so by putting 5v on a pin that is meant to receive 3.3v you potentially break your pi.

https://learn.sparkfun.com/tutorials/vo ... ll?print=1
Hmmz, well it has been on for 24 hours now. I pulled it off and i am happy my pi is still working. Thank you for the link. I hope everything is still working and i can still use the pins.
Hobbybob

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by Hobbybob »

oohlaf wrote: Sunday 13 August 2017 15:09
ratjenl wrote: Sunday 13 August 2017 14:54 mine does 5 volt all the time, got it connected on pin40 (GPIO21)
so by putting 5v on a pin that is meant to receive 3.3v you potentially break your pi.

https://learn.sparkfun.com/tutorials/vo ... ll?print=1
Is there also any good solution for this? I followed the link, but when it starts to give me diagrams I get a bit confused as I'm not into those at all...
Hobbybob

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by Hobbybob »

Okay, I've tried to read up on the information about this, and I came up with the following wiring-scheme. As said, I am not very good at reading diagrams with symbols, so I made something a litte more visual for myself.

Can anybody with a little more knowledge than me check if this would be a good way? I calculated the 1kOhm and 2kOhm on the site oohlaf mentioned, and fiddled with the Ohms to get two values that I can actually buy, and produces as close to 3.3V as possible.
Schakeling watermeter.jpg
Schakeling watermeter.jpg (299.74 KiB) Viewed 4787 times
oohlaf
Posts: 21
Joined: Monday 06 February 2017 0:57
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by oohlaf »

Hi,

Yes, you got it right, you can also have a look at this topic:
viewtopic.php?f=17&t=1103&start=40
Hesmink
Posts: 168
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by Hesmink »

Never realised it would put 5v on the gpio pin.
On the bright side, the rpi still works fine after doing this a few months.
Hobbybob

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by Hobbybob »

oohlaf wrote: Tuesday 15 August 2017 22:22 Hi,

Yes, you got it right, you can also have a look at this topic:
viewtopic.php?f=17&t=1103&start=40
Great, thank you!

The sensor should be on a boat between China and the Netherlands by now :)
Milifax
Posts: 69
Joined: Friday 23 June 2017 9:27
Target OS: Linux
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by Milifax »

Hobbybob wrote: Tuesday 15 August 2017 23:34
Great, thank you!

The sensor should be on a boat between China and the Netherlands by now :)
Or you could use a cleaner option like a level converter:
https://m.nl.aliexpress.com/s/item/32 ... #autostay

Whatever your choice might be, check the voltage of the signal at the end of your 10m cable. Maybe the voltage drop in the cable gets you to the 3v3. Not plausible, but that way you have your real voltage at the Rpi-end.
And with that measurement, calculate what you need.

Edit: just read a bit more of your thread. Using a separate powersuply for the sensor and only wire the signal is not to be adviced. The GND could have potential difference, or better GND WILL have potential difference. Currents flow and bad readings could occur. Just use the power from the GPIO pins.

Next, why use an extra Pi if all others fail. An Arduino Nano would be a far cheaper and cleaner option. A Rpi for just 1 signal is overkill.
The arduino could be used for some pre calculation if you want as well.
Hobbybob

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by Hobbybob »

Milifax wrote: Tuesday 15 August 2017 23:59 Or you could use a cleaner option like a level converter:
https://m.nl.aliexpress.com/s/item/32 ... #autostay

Whatever your choice might be, check the voltage of the signal at the end of your 10m cable. Maybe the voltage drop in the cable gets you to the 3v3. Not plausible, but that way you have your real voltage at the Rpi-end.
And with that measurement, calculate what you need.

Edit: just read a bit more of your thread. Using a separate powersuply for the sensor and only wire the signal is not to be adviced. The GND could have potential difference, or better GND WILL have potential difference. Currents flow and bad readings could occur. Just use the power from the GPIO pins.

Next, why use an extra Pi if all others fail. An Arduino Nano would be a far cheaper and cleaner option. A Rpi for just 1 signal is overkill.
The arduino could be used for some pre calculation if you want as well.
Thanks for the pointers! Will take them into account!
pvangorp
Posts: 70
Joined: Tuesday 28 March 2017 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest B
Location: The Netherlands
Contact:

Re: Watermeter lezen met raspberry en Inductieve NPN sensor

Post by pvangorp »

Instead you can connect a 3.3v zener diode on the black wire and your GPIO's are safe. They are verry cheap and perfect for low power. https://www.kiwi-electronics.nl/zenerdiode-3v3-500ma.

For accurate measurement use a 9 or 12 volt adapter instead of 5v from the PI.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest