|
Post by papa on May 4, 2016 17:47:46 GMT
One end node sketch can generate various nodes with a variety of sensors & features (devices).
I continue to adapt and augment computourist's DHT End Node 2.1, which gandalph had started to make multiple choice. For convenience, this sketch allows the user to select desired features. For learning purposes, one can see what coding relates to those features. Note: For me, Gateway 2.2 & compatible end nodes work just fine. Perhaps a future version of this sketch will include an option of adding Gateway 2.4 compatible end node code. Updated 5/31/2016
As downloaded, this sketch assumes a computer (including Raspberry Pi) running Mosquitto (Mqtt) & an OpenHAB like version 1.8.1 (Last I checked, with OpenHAB 1.8.2, the Classic UI does not update without refreshing the browser page). Chosen options may also need corresponding entries in OpenHAB config files (items, sitemap, & perhaps rules.). It also assumes I've mainly used this sketch's nodes with computourist Gateway 2.2, but it also seems to work fine with Gateway 2.4. As downloaded, the sketch's options include programming a node 2 using a DHT11 temp/humidity sensor, communicate via a 915MHz RFM69Hx radio, & generate debugging info on the Arduino IDE serial monitor set at 115200 baud. Sketch options are highly customizable. You can find much support info in sketch comments, including a note at the top "Customize your node starting line 128." Below I'll provide some more documentation like a schematic. In other past & threads, I may go into more detail. If asked, I'll try to answer questions.
|
|
|
Post by papa on May 4, 2016 19:23:36 GMT
computourist_node_v2.1L_choices sketch, Options So Far: In the Sketch, Uncomment the Desired Options
#define HT // for DHT11 temp / humidity sensor // #define ACTOR // for Actuator of Node LED or Relay via OpenHAB user interface // ^^ AND later, define ALSO with BUTTON (pointless ?? without ACTOR) // #define GOPENER // for Garage Door opener, augments ACTOR // #define PIR // for PIR presence / motion sensor // #define PIRHACK // for using PIR hacked as above in lines 48ff. & avoid false triggers // #define DS18 // another temperature sensor on d3 (can use one or two sensors) // #define BUTTON // for node push button (automatically includes ACTOR) // #define SWITCH1 // switch (reed?) on d5 connected to GND via 10K ohm, closed = HIGH, ON // #define SWITCH1 // switch (reed) on d5 connected to GND via 10K ohm, closed = HIGH, ON // Caution, pick only one: SWITCH2A (normally open) OR SWITCH2B (normally closed // #define SWITCH2A // switch (reed?) on d6 connected to GND via 10K ohm, closed = HIGH, ON // #define SWITCH2B // switch on d6 connected to 3.3v via arduino pull up, closed = gnded, LOW, ON // node on batteries? use SLEEPY with DS18 OR PIR (not both due to watchdog interference) // #define SLEEPY // Sleep Arduino / radio / DHT to use battery slowly To see & learn from the code for each option, search the sketch for ifdef OPTION & infdef OPTION, for example ifdef ACTOR & ifndef ACTOR.
|
|
|
Post by papa on May 4, 2016 19:29:51 GMT
computourist_node_v2.1K_choices sketch, Options Tested So Far:
Papa tested the listed options below with success/fail indicated: (incl with sending RSSI & Voltage) DHT11 alone compiled, uploaded, function on bare bones Arduino DHT11 + SLEEPY (Battery) compiled, uploaded, function on 3.3 v bare bones Arduino DHT11 alone, H version compiled, uploaded, function on 3.3 v bare bones Arduino DHT11 + SLEEPY, H version compiled, uploaded, function on 3.3 v bare bones Arduino DHT11 + BUTTON + ACTOR compiled, uploaded, function on 3.3v Arduino compatible No hacks, PIR power from 5v, 10K ohm pull down resistor on data pin: Also hacked PIR, PIR power from 3v, 10K ohm pull down resistor on data pin: PIR alone, compiled, uploaded, function on 3.3v Arduino compatible PIR + DHT11, compiled, uploaded, function on 3.3v Arduino compatible PIR + DHT11 + SLEEPY (Battery), compiled, uploaded, function on 3.3v Arduino compatible PIR + DHT11 + SLEEPY (Battery), compiled, uploaded, function on bare bones Arduino DHT11 + SWITCH1 & SWITCH2A (switches as sensors) compiled, uploaded, function on 3.3v Arduino compatible SWITCH2B (pulled up switch as sensor) compiled, uploaded, function on 3.3v Arduino compatible DS18B alone & with DHT, FAHR: compiled, uploaded, function on 3.3v Arduino compatible DS18A with SLEEPY, FAHR: compiled uploaded, function on 3.3v Arduino compatible GOPENER alone: compiled, uploaded, function on 3.3v Arduino compatible An Interesting Option Combo to try ?? : PIR + ACTOR (a PIR triggered by motion would turn on a light for a period of time)
|
|
|
Post by papa on May 4, 2016 20:05:08 GMT
|
|
|
Post by papa on May 4, 2016 21:23:33 GMT
^^ Schematic for POSSIBLE node options. Caution: Not all options are possible at the same time. (Click on pic for larger view) See above for options tested together so far. Experiment to see what other combinations might work.
|
|
|
Post by papa on May 4, 2016 21:35:06 GMT
This updates documentation in my Success... thread starting Sep 18, 2015 at 12:55pm. One node has only one function: Open/Close the garage door (vehicle entrance) using a DC-DC solid state relay (SSR). In previous attempts the Arduino was only able to power the solid state relay directly via a digital pin. Adding other sensors seemed to cause problems due to current limits. In other nodes, I did not use an Arduino digital pin to directly power an SSR. I used the digital pin to trigger FIVE volts to power the SSR via a transistor. I have not yet tried that transistor method with this node so other functions might be added. The other garage node has a DHT11 temp/humidity sensor, a normally open reed switch AND another switch. The reed switch detects if the vehicle entrance door is open or closed. The other switch lets the node detect if the garage's people entrance door is dead bolted or not. The third node only has a "switch" that detects if a door is dead bolted or not.
|
|
|
Post by papa on May 23, 2016 1:21:38 GMT
I created another new thread, Node Senses Temps in Enclosed or Liquid Areas. It describes a "Freezer" Node that senses temp & humidity outside a freezer (or other enclosure or liquid) AND senses temps inside a freezer (or other enclosure or liquid). A variation on this node uses TWO waterproof temperature sensors, one of which replaces the DHT11 temp & humidity sensor used in the first variation. Both can be programmed with a new version of this multi-choice sketch.
|
|
|
Post by papa on May 26, 2016 0:26:37 GMT
I created another new thread, Battery-Powered Node for Mailbox, etc. It gives my take on building & programming a battery-powered node that senses & publishes when a mailbox door (or something else) opens & closes. One programs it with a new "Mb" version of my multi-choice sketch.
|
|
|
Post by papa on May 31, 2016 18:31:53 GMT
computourist_node_v2.1Mb_choices_pub.ino (47.35 KB) ^^ Corrected version of computourist_node_v2.1Mb_choices_pub.ino & a suggestion to try. Line 1154 in one of the #ifdef SWITCH2B sections did read send4 3 = true; It now correctly reads send45 = true;This is the switch on an internal Arduino pullup resistor, used in a garage node & dead bolt sensing nodes. The mistakes explains why detecting a change in dead bolt state worked sometimes & sometimes not. So far the correction has made the device more reliable. Suggestion to try:When I first started in this DIY project & was frustrated to see results, I wanted to see much output from every device I installed on a node. So I often uncommented every such device in the Periodic Transmission section of the main loop(), lines 1228-1298 in computourist_node_v2.1Mb_choices_pub.ino. If txinterval is 30 (seconds), this means every such device's data is sent every 30 seconds whether it is a changed state or not. On reflection, this frequent sending seems generally unwarranted for devices whose state should stay the same for long periods. Perhaps one might use such frequent sending of devices for debugging & disable for working, stable nodes. I will consider setting these up for some type of debug definition. In the version of computourist_node_v2.1Mb_choices_pub.ino that I am currently using, I have disabled lines 1266-1276, i.e. I disabled the periodic sending of devices 43-45 (MAIL's state is only sent when a change wakes the node from sleep) Via the main loop() DETECT INPUT CHANGE section, devices 43-45 will be sent only when their state changes. To do this disabling, one could put /* (by itself) on line 1265 & */ (by itself) on line 1277. Disabling lines 1266-1276 should decrease the traffic on the network & postpone overloading the network.
I'll be watching to see if this change is effective & whether I can give a similar treatment to other devices. Update 6/7/2016: Disabling lines 1266-1276 does decrease traffic, but it can leave a status on the OpenHAB User Interface as undefined until the door is locked or unlocked again. As I believe computourist has done, I'll lean toward leaving lines like 1266-1276 active & instead increase the txinterval variable to decrease network traffic.
|
|
|
Post by papa on Jun 8, 2016 2:22:34 GMT
I created a new thread, <success> Wireless Programming>Anarduino Miniwireless</success>. It includes documentation & sketches for accomplishing Wireless Programming with an Anarduino miniwireless (tested & working) & also maybe much of what is needed for a Moteino (untested) One of the sketches is the latest version (Md) of my choices sketch.
|
|
|
Post by papa on Jun 21, 2016 19:00:24 GMT
I added a new thread, Multi-choice Node Sketch incl Gateway 2.4 Compatibility. The new sketch there includes a GW24 option for making a node that takes advantage of the computourist Gateway 2.4 (latest version). Important update, 12/4/2014: In the thread mentioned just above, I corrected a serious error in the sketch available to download there. See also the 12/4/2016 post below.
|
|
|
Post by papa on Nov 21, 2016 16:53:35 GMT
I've added a new thread, Sump Monitor Node (Ultrasonic Sensor). It contains a new version of the Multi-choice Node Sketch that includes use of an ultrasonic sensor, especially for the purpose of monitoring the fill level of a tank, like a sump pump hole. 12/4/2016 Update: I added a new thread, Water Level Monitor Node, Type 2. It provides schematics & a new version of the Multi-choice Node Sketch that includes use of probes for another way to measure levels in a water container. The wiring is more complicated than using an ultrasonic sensor, but so far, more reliable.
|
|
|
Post by papa on Dec 5, 2016 3:33:46 GMT
lucidbuddha discovered that the multi-choice node sketch, mentioned in the Jun 21, 2016 at 2:00pm post above, computourist_node_v2.2Md_choices_pub, had a serious error. In just that version, the NETWORKID in line 193 should be 100 to match NETWORKID in the Gateway sketch (not 200). With this error, Gateway & node will not connect. I corrected the Md version in its original thread. The Me & Mf versions do NOT have this error. They have the same node options as the Md version plus more options. The Me version is in this thread. The Mf version is in this thread. My apology for connection problems & frustrations I may have caused you.
|
|
brump
Junior Member
Posts: 81
|
Post by brump on Mar 30, 2018 12:56:17 GMT
Hi Papa, I saw the code in your computourist_node_v2.2MhB_choices_pub.ino. My code for the light dimmer which that sketch includes is an earlier version for primary tests. In the last post of My home automation project incl dimmers I updated the code and included a functional dimmer control, potentiometer reading and current sensor for acs712. Since you've implemented a lot of cool stuff in your last sketch, I think it would also be cool to include a more functional dimmer control. Thanks! papa: brump, you are correct, I had not finished merging in your code. At the end of "My home automation project ..." I posted a Multi-Choice Node Sketch with your & Joshua's latest code & also a Gateway sketch with your latest code.
|
|
|
Post by papa on Apr 1, 2018 19:55:17 GMT
Latest Version of the RFM69 Multi-Choice Node SketchBased on computourist's original DHT End Node Sketch, this one sketch uses #defines to select one or more possible RFM69 node functions among many choices. This latest version includes the latest code provided (& tested) by brump & the latest code provided by Joshua. Separate threads document achieving the functions & often include related OpenHAB entries. See this post for links to the threads that document the various node functions.Note: To use each thread's info on customizing the sketch, you may need to rely on the mentioned contents of a sketch line rather than the line's number. A node programmed by this multi-choice sketch also needs an RFM69 Gateway. Beginners should use this thread to get started with building & programming their first gateway & end node. At this post within the Beginner thread ... forum members may download the multi-choice sketch. (Membership only requires free registration.)
|
|