water meter reed switch 2 wire and sim800l

excuse me

I am newbie with Arduino, and I am being given a project by my company, namely Arduino uno to find out the air debit using a water meter reed switch 2 cables (red, black) with a delivery system to the consumer cellphone number. The reading results on the water meter. What I am confused about is how to wiring and coding for these two rounds? Because all this time I have opened blogs / forums about this discussion very rarely, and some are different from the way they are delivered, metered water or otherwise, I will feel happy if I help. Sorry for my English

*Note: -I also use Keypad 4x3 with 7 digital ports for start the number at the beginning of the month
-LCD I2C

raha

Cool looking device.

And what company do you work for? Why would they give a self confessed "newbie with Arduino" a complex Arduino project? Do they have money to burn, or did you convince yer boss that you could find the answer on an internet forum? Maybe, but this place is about education, not ready made solutions or projects. You should look at instructables.com, as that is kinda their thing.

If on the other hand, you want to learn how to make the project, stick around. You will need to make an earnest start to it first though. Gather the data sheets for all the components. and write an Arduino program that does something related to the project. Inquire here about what to do next, and you will get a flood of ideas, specific recommendations, and lots of top-notch help.

ps, your English is beautiful.

ChrisTenone: Cool looking device.

And what company do you work for? Why would they give a self confessed "newbie with Arduino" a complex Arduino project? Do they have money to burn, or did you convince yer boss that you could find the answer on an internet forum? Maybe, but this place is about education, not ready made solutions or projects. You should look at instructables.com, as that is kinda their thing.

If on the other hand, you want to learn how to make the project, stick around. You will need to make an earnest start to it first though. Gather the data sheets for all the components. and write an Arduino program that does something related to the project. Inquire here about what to do next, and you will get a flood of ideas, specific recommendations, and lots of top-notch help.

thank you for your advice, I only need a basic sketch of what water meter and port reading I should use, do you have it? there will definitely be a lot of changes later because there will definitely need a lot of adjustments to this tool.

You should post the make and model of the water meter and ideally a link to its technical specification. It sounds as if the reed switch just opens and closes and there is no power connected to it.

You should take a look at this example; https://www.arduino.cc/en/Tutorial/Button

I have a similar water meter on my shelf, but the reed switch is more integrated.

Code for reading the reed switch is dead easy - connect one wire to a digital pin, the other to GND, and treat it as a push button. Lots of code to count button presses, that's what you need. Just check what one "tick" means: I guess 10 litres, but it may trigger twice per rotation.

The SIM800 is a very popular GPRS module, you will be able to find lots of code examples out there. There are various variations that all work with the same AT command set.

For your display, and maybe even for your keypad, there will also be plenty of example code out there. Not knowing the exact types that's all I can say about those.

You probably also need to add an RTC to keep track of time (and not lose time between resets), so you can send your notifications at regular intervals and know when a month has passed and so. Also look into using the EEPROM to keep track of your meter counts over a power cycle.

Quite a complex project for a beginner but if you take your time and break it down into the smallest possible parts it's perfectly doable. At least they don't ask you to have the thing run on 2xAA batteries for 1-2 years (that's why I have this water meter here :-))

ardly: You should post the make and model of the water meter and ideally a link to its technical specification. It sounds as if the reed switch just opens and closes and there is no power connected to it.

You should take a look at this example; https://www.arduino.cc/en/Tutorial/Button

Thank you Ardly for your attention, God Bless U:)

wvmarle: I have a similar water meter on my shelf, but the reed switch is more integrated.

Code for reading the reed switch is dead easy - connect one wire to a digital pin, the other to GND, and treat it as a push button. Lots of code to count button presses, that's what you need. Just check what one "tick" means: I guess 10 litres, but it may trigger twice per rotation.

The SIM800 is a very popular GPRS module, you will be able to find lots of code examples out there. There are various variations that all work with the same AT command set.

For your display, and maybe even for your keypad, there will also be plenty of example code out there. Not knowing the exact types that's all I can say about those.

You probably also need to add an RTC to keep track of time (and not lose time between resets), so you can send your notifications at regular intervals and know when a month has passed and so. Also look into using the EEPROM to keep track of your meter counts over a power cycle.

Quite a complex project for a beginner but if you take your time and break it down into the smallest possible parts it's perfectly doable. At least they don't ask you to have the thing run on 2xAA batteries for 1-2 years (that's why I have this water meter here :-))

Hallo Wvmarle, i'am so lucky to meet with u in this forum, it looks like you look very good at projects with this 2 wire water meter, if possible I ask what sketch you made so that the output of digital coding is not 1 2 3 4 5 ... but he should count. and think which digital port should I use? is it up to my will? because my digital port has been used 7 for 4x3 keypad :( thank you wvmarle, God Bless U:)

Any pin will do (you have 18 of them on an Uno or equivalent). Try to avoid 0 and 1 (TX and RX) and 13 (built-in LED). After that it's a simple matter of counting pulses.

...the output of digital coding is not 1 2 3 4 5 ... but he should count.

If I am understanding your question correctly; you input a digital signal from the water meter reed (very similar to button example I posted).

Within your sketch you use a variable to count how many pulses you have detected. You might therefore have a variable called pulseCount and it might hold a value of say 4523 (which would increase as more pulses came in). To start with you should just print out the value of the variable each time you see a pulse. Then you would include that value in the text message you are going to send via GPRS.

There are a couple of things to watch out for. Firstly you are almost certainly going to loose pulses at some point because, for example, the Arduino has lost power or been rebooted. So you need some way to set the Arduino so that its reading matches what is displayed on the water meter. Secondly you may or may not need to debounce the signal from the reed switch. The switch is mechanical so when it is switched from OFF to ON you may actually see something like OFF OFF OFF OFF ON ON OFF OFF ON ON OF ON ON ON ON happening quickly.

wvmarle: Any pin will do (you have 18 of them on an Uno or equivalent). Try to avoid 0 and 1 (TX and RX) and 13 (built-in LED). After that it's a simple matter of counting pulses.

sounds good, can u give me a simple example coding or keyword if i can search sir for convert 1 2 3 4 5 to 203 244(pure number resulting from accretion 1+2+3=6 ). sorry for my english:(

ardly: If I am understanding your question correctly; you input a digital signal from the water meter reed (very similar to button example I posted).

Within your sketch you use a variable to count how many pulses you have detected. You might therefore have a variable called pulseCount and it might hold a value of say 4523 (which would increase as more pulses came in). To start with you should just print out the value of the variable each time you see a pulse. Then you would include that value in the text message you are going to send via GPRS.

There are a couple of things to watch out for. Firstly you are almost certainly going to loose pulses at some point because, for example, the Arduino has lost power or been rebooted. So you need some way to set the Arduino so that its reading matches what is displayed on the water meter. Secondly you may or may not need to debounce the signal from the reed switch. The switch is mechanical so when it is switched from OFF to ON you may actually see something like OFF OFF OFF OFF ON ON OFF OFF ON ON OF ON ON ON ON happening quickly.

nahh thats right sir, because i need value of increase as more pulse output in serial monitor, i confuse how to convert that value. and now my sim 800l blink 10x and stop for a while, and blink again 10x. do you have problem like this sir?sorry if i ask to much to u.

rahadwi: sounds good, can u give me a simple example coding or keyword if i can search sir for convert 1 2 3 4 5 to 203 244(pure number resulting from accretion 1+2+3=6 ). sorry for my english:(

Why are you even counting in that way? Doesn't make any sense.

To do this calculation you need two variables: an actual count (incrementing by one every time you receive a tick) and a total, to which you add the current count every time you receive a tick.

For your SIM800L: find some example sketches and get that to work, first. Make sure it has enough power available (the things want about 2A surge when connecting to a network). With the odd voltage requirements of the modules this may not even be all too straightforward...

rahadwi: nahh thats right sir, because i need value of increase as more pulse output in serial monitor, i confuse how to convert that value. and now my sim 800l blink 10x and stop for a while, and blink again 10x. do you have problem like this sir?sorry if i ask to much to u.

Try this example program, it will display an increasing pulsCount in your monitor

int pulseCount = 0;

void setup()
{
    Serial.begin(9600); 
}

void loop()
{
    // the real program would count pulses from the water meter
    ++pulseCount;

    // The real program would send an SMS message
    Serial.print("pulsecount = ");
    Serial.println(pulseCount);

    // this delay is just to stop the sketch printing numbers too fast
    delay(1000);
}

wvmarle: Why are you even counting in that way? Doesn't make any sense.

To do this calculation you need two variables: an actual count (incrementing by one every time you receive a tick) and a total, to which you add the current count every time you receive a tick.

For your SIM800L: find some example sketches and get that to work, first. Make sure it has enough power available (the things want about 2A surge when connecting to a network). With the odd voltage requirements of the modules this may not even be all too straightforward...

ups sorry sir, i think thats wrong too, what I mean is how does he increase 1 from the example last 2025 number to 2026 sir, sorry about that.

about sim800l I have tried a lot of sketches and he doesn't want to respond my sketch only blinked 10x and then died, then blinked again 10x and then died. Is this sim800l broken? *nb: i'm using source from 5v arduino and buck converter(3.7v)

ardly:
Try this example program, it will display an increasing pulsCount in your monitor

[code]int pulseCount = 0;

void setup()
{
   Serial.begin(9600);
}

void loop()
{
   // the real program would count pulses from the water meter
   ++pulseCount;

// The real program would send an SMS message
   Serial.print("pulsecount = ");
   Serial.println(pulseCount);

// this delay is just to stop the sketch printing numbers too fast
   delay(1000);
}




[/code]
sory sir, my mean LCD I2C sir not serial monitor, and this is my sketch:
// Water Meter repetition counter
#include<Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

int pulse1 = 2;
int counter1 = 0;
long lastDebounce1 = 0;
long debounceDelay = 500;  // Ignore bounces under 1/2 second, need to calibrate with water meter

void setup() {
 lcd.begin();
 lcd.backlight();
 delay(250);
 lcd.noBacklight();
 delay(250);
 lcd.backlight();
 
 lcd.setCursor (0,0); 
 lcd.print("Water Pulse:");
 delay(1000);
 lcd.setCursor (5,1);
 lcd.print(counter1++);
 delay(1000);
 
 Serial.begin(9600);
 pinMode(pulse1, INPUT_PULLUP); //Pullup Internal Resistor
 digitalWrite(pulse1, HIGH);
 attachInterrupt(0, trigger1, FALLING);
 Serial.println("Water Pulse");
}

void loop() {
}

void trigger1() {
 if ( (millis() - lastDebounce1) > debounceDelay) {
   counter1++;
   Serial.print(counter1);
   Serial.print(" ");
   lastDebounce1 = millis();
 }
}

do you found the wrong sketch here? this sketch don't want  counter to display in LCD I2C, just display 0 even though he continues to increase in the serial monitor sir. Helpppp

Two major issues I see here. 1) you try to print to the Serial console from an ISR. That's asking for problems. 2) you never update your LCD after the first setup.

Pulses from your water meter are likely to be infrequent and long. I would not use interrupts, there is no need for them. You might need to debounce the pulses but keep things simple at first and add the debouncing later if needed. If you do need debouncing I am sure there are library routines already available to do this.

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :)

Interrupts are a necessity if you want to put the device to sleep, but wake up the moment a pulse comes in to register it.