Skip to main content

You are here

Water Level Indicator system random behavior.

12 posts / 0 new
Last post
dsantosh
Water Level Indicator system random behavior.

Hi,

I designed a water level monitoring system, named WWLMS(Wireless Water Level Monitoring System) using jeenode concept. The sensors used are the reed switches along with resistor network. The output form sensor is fed to analog (A1). The measured level at remote station is sent to a base station and displayed in LCD, an alarm is also attached using relay. The alarm is turned on when the water level crosses some value.

I used RF12demo sketch in the base and a simple sketch on remote side which sends the level data using rf12_easySend() ever second.

Now, on testing the system, it works fine but sometimes following things happen:
1. When starting the system, the alarm goes off quite often.
2. The alarm also goes off sometimes when the water level is below the danger level.

I am quiet new to Arduino and Jeenode. A little help is all I need :)

timhoffman

Hi

I measure water level with arduino/jeenodes. However I am using a milone level sensor (a big variable resistor affected by water pressure). Things I do include averaging the water level. This means the first samples on startup are generally ignored. You may find that you are getting some bogus readings on power up. Without seeing you code it's difficult to tell. In addition even with the milone sensor, stuff stuck to the sensor (algae, azola, leaves etc) can affect the measurement. Ducks or other wildlife can momentarily affect readings as water level suddenly changes. Again a reason to use averaging.

You have mentioned if the alarms are triggered by the sensor end or the receiving side so you could have some faultly logic in terms of you decision making process.

Also you haven't outlined you resistor network which would also help understanding how your setup works

Cheers

Tim Hoffman

dsantosh

Hi Tim,

Sorry for late reply. At this part of world, I can find only reed switches, hence used them.I am yet to install the system,at the moment I am testing it. Your comment on averaging value is a good solution to startup random behavior, but sometimes the alarm goes off in the middle of testing before the predefined level. Following are the two sketches I used.

In the remote node: void setup () { // initialize the serial port and the RF12 driver Serial.begin(57600); Serial.print("\n[pof66]"); rf12_config(); // set up easy transmissions every 1 second rf12_easyInit(1); // enable pull-up on analog input pinMode(A5, INPUT_PULLUP); } void loop () { // keep the easy tranmission mechanism going rf12_easyPoll(); // convert analog 0..1023 readings to a 0..255 level byte value = 255 - analogRead(A5) / 4; rf12_easySend(&value, sizeof value); }

In receiver side I used the RF12demo sketch(I have uploaded in .txt format here, since the code tag made it messy)

P.S My programming is a bit rusty, so feel free to comment. :)

Regards,

D. Santosh

AttachmentSize
RF12demo_edited.txt25.1 KB
padvinder95

I think you're picking up noise: the RF12 demo sketch shows the entire message if the checksum (rf12_crc) is zero; otherwise (if it's not in quiet mode) it shows the first 20 characters of the garble. This happens, depending on the amount of noise in its frequency band, anywhere from every few seconds to once every few minutes.

You have put the test for water level (and lcd writing) in the part that always gets evaluated, even if the checksum is incorrect (!=0), so my guess is your false alarms are due to some noise that happens to be in the proper integer range.

What I would change is: chuck out the whole part from rf12_recvDone() to (and including) the for-loop that prints each byte. Then replace this with if(rf12_recvDone()&&rf12_crc==0). (You don't need the loop because you're only sending one byte always.) The loop code will look like this:

void loop(){ if (Serial.available()) handleInput(Serial.read()); if (rf12_recvDone() && rf12_crc==0 && rf12_len==1){ //your message is always 1 byte, so if you have other transmissions that are of different length; ignore them byte level = rf12_data[0]; if(x <= level && level <= y) { /// etc. etc. process data, write lcd } } }
timhoffman

padvinder95 has found you problem I believe, you should only be processing the incoming data if it has a valid CRC.

You can get the milone liquid level sensor through sparkfun https://www.sparkfun.com/products/10221 . They are quite expensive, but give you a much higher incremental resolution, you may or may not need such a thing. For me it allows me to work out water loss rate through evaporation etc... more accurately (which is heavily influenced by the wind here (though I haven't really done much with that as yet - too busy ;-(

dsantosh

I had never thought about interference till now. Thanks..

I thought the CRC part and the acknowledgement part were not supposed to effect the data. There should be a blog called RF12demo demystified.

And I think the following chunk of code is of no use after I change the code as you suggested.

if (rf12_crc == 0) { activityLed(1);

if (df_present()) df_append((const char*) rf12_data - 2, rf12_len + 2); if (RF12_WANTS_ACK && (config.nodeId & COLLECT) == 0) { Serial.println(" -> ack"); rf12_sendStart(RF12_ACK_REPLY, 0, 0); } activityLed(0); }

padvinder95

The CRC part and ack part do indeed not affect the data. However, the RF12demo sketch has the option (enabled by default) to show incoming messages even if the checksum is incorrect: it'll either be random noise, or a garbled message from a faraway node. If you ignore the checksum (which you basically did because of the location where you put your processing&LCD code), then you will also use the noise and garbled messages as if they were real.

The chunk of code you pasted takes care of adding the received message to the dataflash log card (in the case of a jee link, which comes with external memory for this purpose) and sending an ACK reply to the node. Since you use the easySend, you do need this ACK, so you have to put in this bit of code somewhere---at least the ACK part. I suggest you put the if(RF12_WANTS_ACK) statement (so those 4 lines) somewhere in the big if-statement in my post (if(recvDone&&crc==0&&len=1)).

Gadjet

Hi, This may not be your problem (yet) but we used reed switches in an application to detect low liquid level (no jeenodes/Arduinos involved) and we had a problem with the reed switches sticking, this is because we didn't pass enough current throught the switches and therefore they didn't self clean.

We found, with our reed switches, we had to pass 10mA through them to get them to operate reliably over time.

zooer

I've had the same problem with (low cost eBay) reed switches. 1st thought it was something peculiar in the code and it took awhile to realize what was happening.

Didn't know there's minimum current needed for reliable long-term operation. Thanks for the info, Gadjet.

dsantosh

Thanks, appreciate it. Will check it soon, and follow up. Jeelabs forum is a wonderful community btw.

Cheers D. Santosh

dsantosh

Till now I have not problem with reed switches. But soldering reed is a hectic job though. How to solder the reed array without breaking them?

D. Santosh

martynj

@dsantosh, you need a medium size iron and a heat shunt to protect the reed switch.
A fine-nosed pair of pliers works fine.
Grip the straight connector firmly between the solder end and close to the glass body.

The metal mass of the pliers shunts away the heat trying to get to the reed switch, but the solder pad still gets hot enough. Let the pliers cool down between soldering attempts.

Premium Drupal Themes by Adaptivethemes