|
Post by papa on Jun 11, 2017 23:27:22 GMT
Leak Detector NodeLeaks can happen & do damage in a laundry room, a basement, at a water heater, etc. A node could detect this & warn us. This node assumes building & programming a gateway device. For that, see here. It also assumes installation of MQTT & OpenHAB. For those, see here. This node is a truncated version of the Water Level Node that I documented earlier. You might scan through that thread for more information. ================================== Next: Leak Detector Node, Schematic
|
|
|
Post by papa on Jun 11, 2017 23:29:40 GMT
Leak Detector Node, Schematic << Click on pic for larger view. ^^ Note that there are a range of choices for the parts used. For one resistor, choose a value between 470 ohms & 1 kilo ohms. I have successfully used 550 ohms & 1 K (1,000) ohms. For another resistor, use a value between 220 kilo ohms & 470 kilo ohms. For the transistor, choose an NPN type. I used BC547.
|
|
|
Post by papa on Jun 11, 2017 23:37:48 GMT
A Multi-Choice End Node Sketch with Coding & Needed Customization for a Leak Detector Node computourist_node_v2.2MgE_choices_papa.ino (70.93 KB) << Download this sketch ( new version 6/11/2017), source of the Leak Detector Node Programming. (Note: this sketch can be customized for several types of nodes with separate or combined functions. See the list here.) With the Arduino IDE, appropriately customize the sketch, as follows: Lines 128-193, Leave all node options commented (// at the start of a line before #define), Except UNcomment (no // at the start) this one item: #define LEAK ======================= Line 195, use a NODEID unique to your system. I'll assume 17 in the following. Line 196, change "xxxx..." to YOUR 16 character key used on ALL your nodes. Lines 199-201, UNcomment one line according to your RFM69 radio’s frequency. Comment out the other two lines. Line 202, UNcomment it ONLY IF your RFM69 radio has "H" (high power) in its part #. Note: If you UNcomment line 197, the Arduino serial monitor can use 115200 baud (line 217) to display node debugging output, at least while you test the node. With the Arduino IDE running on a computer & the Leak Detector Node connected via USB, upload the sketch program to the node. Then with the node still on USB, the Gateway successfully running connected to your Ethernet network & the IDE serial monitor running at 115200 baud, the serial monitor (in DEBUG mode) will display connection & data info about the node. << Fulfill the conditions in this paragraph to see if things are working so far. On the Serial Monitor, on the device 66 line in the Ival (integer value), you want to see 0 (zero) when a "puddle" of water does not touch the bare ends of BOTH probes. You want to see 1 (one) when a "puddle" of water does touch both probes. As explained in the Water Level Node thread, that node generates a compound code. More simply for the Leak Detector Node (as translated by the leak.map transform file), 0 (zero) means "No Leak." A 1 (one) means "Leak Detected." OpenHAB config entries (next post) will display this information on the User Interface. This includes dynamic icons that change with the status. For testing, the bare ends of the probes can touch & be removed from any continuous water. To deploy the node, weight the probe ends down (for example, wrapping some of their insulated wires around a bolt) where a leaked puddle could touch both probes. Put the bare ends of the probes on or very near the surface that might flood. Next: OpenHAB Config Files Entries To Communicate with A Leak Detector End Node
|
|
|
Post by papa on Jun 11, 2017 23:44:05 GMT
OpenHAB Config Files Entries To Communicate with A Leak Detector End Node
(Presupposes NODEID is 17. In the following, replace 17 with the NODEID you assign) ================== Add a leak.map file in OpenHAB's transform folder with the entries below: For Windows, C:\openhab\configurations\transform For Linux (incl. Raspberry Pi), /etc/openhab/configurations/transform ------------------------ 0=No Leak 1=Leak Detected undefined=UNKNOWN -=UNKNOWN ================== Add to .items file entries: ------------------------ Number Leak_Stat17 "Leak Status_17 [MAP(leak.map):%s]" <drip> {mqtt="<[mosquitto:home/rfm_gw/nb/node17/dev66:state:default]"} ================== No new entries yet for .rules file (See next post). ================== Add the icons below to the \webapps\ images folder: For Windows, go to C:\openhab\webapps\images For Linux (incl. Raspberry Pi), go to /usr/share/openhab/webapps/images/ drip.png drip-0.png drip-1.png ================== Add to .sitemap file entries: ------------------------ Text item=Leak_Stat17 Note: The next post will document having OpenHAB send data notices to us about the Leak status.
|
|
|
Post by papa on Jun 12, 2017 0:01:54 GMT
Every 45 seconds (line 205), the Leak Detector customized sketch will power the node's probes (via D7) & read them for the presence of a leak. Send Yourself an Email when the Leak Status Changes See this thread for setting up OpenHAB for email. Add this to a .rules file (using your own gmail address) rule LEAK_Update when Item Leak_Stat17 changed then if(Leak_Stat17.state == 1) { sendMail("Myusername@gmail.com","from openhab","Leak Detected at Node 17") } if(Leak_Stat17.state == 0) { sendMail("Myusername@gmail.com","from openhab","No Leak at Node 17") } end This same thread describes sending yourself a text notification.
|
|