@mfalkvidd Yes i did but has you can see even when the hall sensor is not connected the arduino sends data and the water increases in the the gateway. I can work on the SEND_FREQUENCY and see if it fix this problem.
Thnaks for the replay
@mfalkvidd Yes i did but has you can see even when the hall sensor is not connected the arduino sends data and the water increases in the the gateway. I can work on the SEND_FREQUENCY and see if it fix this problem.
Thnaks for the replay
Hi.
I'm using this water flow sensor using the code available from the pulse water meter but the values i'me getting are all rong...
I'm triyng to adapt the code to this water flow sensor with no luck.
Could anyone give me an help with the code?
Thanks in advance.
@bart59 Yes i'm using the 3,3v from the arduino and i always connect everything with the arduino power off. Give me mor 5 minutes and i'll upload a photo from my sensor going to bring it inside home.
@mfalkvidd i think i don't have anything magnetic on the place were i'm putting the arduino and the sensor at this time.
Thanks for the replays.
Hi. yesterday i disassembled the rain gauge circuit removed from it the reed switch and created a new circuit.
I have connnected the reed switch to GND and PIN3 whit 10kOhm resistor.
I'll post an image tonight.
Up until now the values i'me getting from this new circuit is:
Values i'm getting from serial port:
Rain last 24 hours:
1.80
Rain last 48 hours:
12481.94
Rain last 72 hours:
28210.34
Rain last 96 hours:
43938.74
Rain last 120 hours:
59667.14
read and drop: 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
read and drop: 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
read and drop: 5-5-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
read and drop: 6-6-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
Seeing the graphic and this values it seems the problem i was having is fixed...
But tonight i'm going do spread some water over the bucket to see if i get any values and not just 0
Thanks for the quick reply.
i'm going to change the versions
This is my new code for this sensor and reajusted to library 2.1.1
/**
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2015 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
*******************************
*
* REVISION HISTORY
* Version 1.0 - epierre
* Contribution: bulldoglowell, gizmocuz
*
* DESCRIPTION
* Connect sensor ML8511 / Arduino:
*
* 3.3V = 3.3V
* OUT = A0
* GND = GND
* EN = 3.3V
* Arduino 3.3V = Arduino A1
*
* License: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
*/
// Enable debug prints
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
//#define MY_RS485
#include <SPI.h>
#include <MySensors.h>
#include <SPI.h>
//Hardware pin definitions
int REF_3V3 = A1;
int UVOUT = A0;
#define CHILD_ID_UV 0
unsigned long SLEEP_TIME = 30*1000; // Sleep time between reads (in milliseconds)
MyMessage uvMsg(CHILD_ID_UV, V_UV);
float lastUV = -1;
unsigned long lastSend =0;
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("UV Sensor", "3.0");
// Register all sensors to gateway (they will be created as child devices)
present(CHILD_ID_UV, S_UV, "ML8511_UV");
}
void setup()
{
//gw.begin(NULL, 9, true);
pinMode(UVOUT, INPUT);
pinMode(REF_3V3, INPUT);
}
void loop()
{
int uvLevel = averageAnalogRead(UVOUT);
int refLevel = averageAnalogRead(REF_3V3);
unsigned long currentTime = millis();
//Use the 3.3V power pin as a reference to get a very accurate output value from sensor
float outputVoltage = 3.3 / refLevel * uvLevel;
//float outputVoltage = 5.0 * uvLevel/1024;
float uvIntensity = mapfloat(outputVoltage, 0.99, 2.8, 0.0, 15.0); //Convert the voltage to a UV intensity level
Serial.print("output: ");
Serial.print(refLevel);
Serial.print("ML8511 output: ");
Serial.print(uvLevel);
Serial.print(" / ML8511 voltage: ");
Serial.print(outputVoltage);
Serial.print(" / UV Intensity (mW/cm^2): ");
Serial.print(uvIntensity);
Serial.println();
if ((uvIntensity != lastUV)||(currentTime-lastSend >= 5*60*1000))
{
lastSend=currentTime;
send(uvMsg.set(uvIntensity,2));
lastUV = uvIntensity;
}
delay(100);
}
//Takes an average of readings on a given pin
//Returns the average
int averageAnalogRead(int pinToRead)
{
byte numberOfReadings = 8;
unsigned int runningValue = 0;
for(int x = 0 ; x < numberOfReadings ; x++)
runningValue += analogRead(pinToRead);
runningValue /= numberOfReadings;
return(runningValue);
}
//The Arduino Map function but for floats
//From: http://forum.arduino.cc/index.php?topic=3922.0
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}```
@Boots33 I have change to an arduino nano but still get some strange values. I'm going to make some changes over this project and see again what ill get.
Thanks for all the help.
@zboblamont I have already read that pdf there they say this:
"The design of the Magnetic Transmission reduces the number of components
Operating in the water, increasing the reliability of the meter."
They also say this in the pdf:
"Any of these models can be supplied ready to receive the
Pulse transmission (see tele-count catalog). Ex .: MSV 1520t"
In this last information i made a search for MSV 1520t were i found again another pdf that talks about my water meter.
Here's the link: http://resopre.pt/conteudo.php?fam=CONTADORES,CONT_DOMESTICOS&pag=AGUA_RESOPRE.PT&detail=693
You can see 5 water meters on that link all off them say's Magnetic Transmission "Transmissão magnética" but has you can see none off them look like mine. Has i can understand mine is the more basic off them all i do belive that i have the first generation off this water meters.
I have done one last test yesterday leaving a water tap open and passed the hall sensor all over the water meter from side to side and top to bottom and never got any impulse digital led light turning on.
The led did turned on when i put my finger in the top off the sensor or in cables near the pins of the sensor.
@bart59 and @mfalkvidd Thanks for all the help. Today i toke the sensor to the water meter and for my luck my water meter is too old 1997 and no mater the position i put the hall sensor it just doesn't get any pulse at all at this time i really don't now what to use to get the data from my water meter...
I have already tried also the TCRT5000 and also does not work. Here's an image from my water meter
The TCRT5000 when i put over the glass the green led stays always on but when i remove it from the glass and point it to the black part of my meter the green led goes off the sensor is working ok but the glass from my meter does not help at all.
Any sugestions off other sensors i can try or use ?
I think i have fix my problem. I have been playing with the code and the sensor and notice that the power led and data led on the sensor were always on no mater the digital pin i was trying to use.
This also happened with the analog pin A0.
In one last attempt i decided to use the digital pin 3 with the resistor soldered on the board for sensors like dallas and dht11 or dht22.
Now the first thing i had noticed was the data led was not on and now it only comes on when i passe a magnet under my sensor... it does not count any pulsecount if i passe the magnet over the sensor only under it.
Counted the times i had passed the magnet under the sensor and my gateway received te exact number 30 times = 0.030 volume and now the volume is stop at this number no more ghost encrease numbers.
Tomorrow morning i'm going to mount the sensor over the water meter to see if this finaly works.
The only problem i'm getting now is some NACK over the transmissions... like this:
6604747 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=3,st=OK:30
volume:0.030
604794 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=NACK:0.030
pulsecount:30
634781 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=1,st=NACK:30
volume:0.030
634828 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=2,st=NACK:0.030
Ok here's the photo off my sensor. On my code i'm using the digital pin2 since digital pin3 has a resistor for Dallas and dht sensors but i'm not using them at this time. This arduino is only for water meter.
@bart59 Yes i'm using the 3,3v from the arduino and i always connect everything with the arduino power off. Give me mor 5 minutes and i'll upload a photo from my sensor going to bring it inside home.
@mfalkvidd i think i don't have anything magnetic on the place were i'm putting the arduino and the sensor at this time.
Thanks for the replays.
New update.... have change the arduino mini pro for another one flash a new code a new sensor and again i'm getting volume data when the sensor is not near the water meter. I dont understand what's happening.
@bart59 Thanks have done like you said and did clean the data from the gateway.
All day until 1h ago i had left my arduino connected on my pc and i did like mfalkvidd said connecting the digital pin 2 to gnd and my arduino did not send any strange value to the gateway always seend volume 0.00 this was perfect.
Now that i'm at home i had connect my arduino to the sensor 3.3v gnd and digital pin2 and in the first log there it was value increase on volume when my sensor was in front off me...
I have a arduino nano pro 3.3v on easy pcb board and i'm using the hall sensor i dont see why i'm getting this problem...
I have a WiFi AP inside home and my sensor is outside.
Even the water flow says i have a 2.00 L/min when the sensor is not near the water meter.
@mfalkvidd Thanks. Have now connected the digital pin2 to gnd and in the last 1h the values are always 0.000 going to leave it this way until night since now i'm at work. I would like to find out what was creating the spurious interrupts??
Other thing that ill find out tonight is when i connect the sensor to the arduino will it create rong data or will it only send real data only when the water meter starts running water...
One more thing today at 8:00 when i did the pin2 to gnd the first "boot" over domoticz i got this value as you can see on the image below. Is this normal? Have been trying to deleted but it wont go away.
Once again thanks for your help.
Have been working with the code and have found one strange thing. When my sensor sends data to the gateway "domoticz" the gateway sends a value to the sensor. The strange thing is that my arduino does not have any sensor connected and sow the data send is zero but my gateway sends akways a positive value and increases this value every time it sends data to the arduino.
Even if i go to the arduino code and set the volume and pulseCount to 0 flash it to the arduino, load the value of zero to the gateway and then e flash the same code but this time i remove the volume and pulseCount to 0 the first time the arduino sends data to the gateway it always receive a value insted of zero since i dont have the hall sensor connected to the arduino.
I'm using a arduino mini pro 3.3v on a easy pcb by soundberg81 and i have setup the digital pin2 to connect the hall sensor.
Here's some log from my arduino:
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
3 TSM:INIT
4 TSF:WUR:MS=0
11 TSM:INIT:TSP OK
13 TSF:SID:OK,ID=1
14 TSM:FPAR
51 TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
1032 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
1037 TSF:MSG:FPAR OK,ID=0,D=1
2058 TSM:FPAR:OK
2059 TSM:ID
2060 TSM:ID:OK
2062 TSM:UPL
2065 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
2172 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1
2178 TSF:MSG:PONG RECV,HP=1
2181 TSM:UPL:OK
2182 TSM:READY:ID=1,PAR=0,DIS=1
2187 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
2320 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
2327 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
2335 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
3517 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=1,sg=0:M
3526 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=OK:Water Meter
3535 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=5,sg=0,ft=0,st=OK:2.4.B
3544 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=21,pt=0,l=11,sg=0,ft=0,st=OK:Hall Sensor
3551 MCO:REG:REQ
3589 !TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=NACK:2
5596 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
5665 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1
5670 MCO:PIM:NODE REG=1
5673 MCO:BGN:STP
5677 TSF:MSG:SEND,1-1-0-0,s=1,c=2,t=25,pt=0,l=0,sg=0,ft=0,st=OK:
5683 MCO:BGN:INIT OK,TSP=1
6484 TSF:MSG:READ,0-0-1,s=1,c=2,t=25,pt=0,l=1,sg=0:0
Received last pulse count from gw:2
pulsecount:2
35686 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:2
volume:0.003
35694 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.003
l/min:2.05
65687 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:2.05
pulsecount:4
65695 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:4
volume:0.004
65704 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.004
l/min:0.00
95688 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:0.00
pulsecount:5
95696 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:5
volume:0.005
95706 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.005
pulsecount:5
125689 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:5
volume:0.006
125698 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.006
l/min:2.00
155691 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:2.00
pulsecount:7
155699 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:7
volume:0.007
155708 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.007
l/min:0.00
185691 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:0.00
pulsecount:8
185699 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:8
volume:0.008
185708 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.008
pulsecount:8
215696 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:8
volume:0.009
215707 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.009
l/min:2.00
245693 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:2.00
pulsecount:10
245701 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:10
volume:0.010
245710 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.010
l/min:0.00
275694 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:0.00
pulsecount:11
275702 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:11
volume:0.011
275714 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.011
pulsecount:11
305695 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:11
volume:0.012
305703 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.012
l/min:2.00
335698 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:2.00
pulsecount:13
335707 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=OK:13
volume:0.013
335718 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.013
l/min:0.00
365732 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=OK:0.00
pulsecount:14
365776 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=25,pt=5,l=4,sg=0,ft=0,st=NACK:14
volume:0.014
365788 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=1,st=OK:0.014
376929 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
376934 TSF:MSG:BC
377041 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=21,pt=1,l=1,sg=0,ft=0,st=OK:0
l/min:5.36
395735 !TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=34,pt=7,l=5,sg=0,ft=0,st=NACK:5.36
pulsecount:16
Again since i'm geting this problem i don't have my sensor connected to the arduino.