|
Post by papa on Aug 4, 2015 19:59:38 GMT
I appreciate those who contributed to this DIY Home Automation project. Eric Tsai’s Instructable first inspired me. I avidly followed questions & improvements especially by CompuTourist. I intend here to summarize my DIY Home Automation experience & features I added.
Mostly based on CompuTourist’s excellent implementation, I built & have had running a network of the gateway & 11 nodes. Most use Buono Uno clones switched to 3.3 volts. All use RFM69HW transceivers. The Gateway is built just on a Buono Uno Arduino Compatible ( See this Oct 8 post & following.) Most End Nodes have DHT11 temperature & humidity sensors, a button, & a solid state relay (SSR) (See the posts Oct 10 8:01am & following). One of my additions is a jumper (& an added device) on the gateway to indicate an “ Away Mode,” when one is away from home & wishes lights, etc to toggle on & off to simulate activity for security’s sake. Another is a node with a Infrared LED to turn a TV on & off. I adapted or added code & node devices to handle these features. On a solderless breadboard, adapting from Eric Tsai & my previous experiences, I assembled a bare bones Arduino node that can be battery powered. Another addition is pulsing a solid state relay to open & close our garage door Another is using a reed switch & magnet for sensing if the garage door is all closed or not. (See Sep 18 12:55pm post below & the new Garage End Nodes thread). Added on 5/4/2016 is a switch sensor to report if the Garage's people entrance is dead bolted or not. Update 2/8/2016: As mentioned below, in this thread, a Windows computer hosts OpenHAB, which can work on several operating systems. So you could use this thread to help build your Arduino nodes (computer operating system does not matter). Then to install OpenHAB on a Linux computer, you might use my thread, Linux Laptop: How to Install OpenHAB-Mosquitto. If you have a Raspberry Pi running Raspian version of Linux, you might use Raspberry Pi: How to Install OpenHAB-Mosquitto. I first implemented OpenHAB on a Windows 7 laptop (See the posts Oct 16, 2015 8:52am thru Oct 17, 2015, 9:45am) & using OpenHAB Designer, I made a basic User Interface (UI). The UI reports Temperature & Humidity from nodes. It also has switches to toggle the SSRs. I found & used rules to postUpdate those switches if node buttons toggle the relays. The UI also has contacts to report the state of the garage door & the Away Mode. Also a Node page of the UI reports some system states (RSSI & voltage) from nodes. I found & used rules to somewhat randomly schedule node SSRs & remote to toggle lights & TV when Away Mode is active. (OpenHAB items, sitemap, & rules file will later be available to download below.) Below at the Oct 16, 2015, 4:30pm post, I even provide a set of OpenHAB configuration files (openhab-papa.zip) to work with this project. I registered with my.openHAB & am able to view & control the UI over the internet including via the OpenHAB app on my iPhone. (See the post Oct 17, 2015 at 6:10pm I learned that an Arduino D9 pin signal could light an SSR’s LED but not close the switch to turn on a main’s powered device. So using a circuit I found, when I send the D9 signal to the base of a BC547 transistor (via a 2.2K ohm resistor), it switches on an SSR whose positive input is connected to the FIVE volt Arduino socket. For during-construction & future fixes & changes, I like to plug together many of each unit’s pieces. My gateway is mostly the Buono Uno with Ethernet Shield on top. LEDs for MQTT connection & Radio signals plug ok into Shield headers. ( See this Oct 8, 2015 post below) Resistor & jumper for the Away Mode plug into a section of added female headers with bottom pins suitably soldered together. I build a Gateway with just an Arduino compatible & plug in parts. ( See this Oct 8, 2015 post) I designed a limited function End Node built with just an Arduino compatible & plug in parts. (See the post Oct 17, 2015, 6:10pm) With these 2 minimal assembly units built plus the Mosquitto & OpenHAB installs & configuration, one could have a basic, working OpenHAB network to get a feel for the possibilities. To build a full-function DHT End Node on top an Arduino, I use double-sided proto shields made for 20 pin integrated circuits (IC). Besides the usual Arduino female headers, they have 5 power headers & 5 ground headers. In the middle of the IC area are power & ground strips. For each IC pin is a strip of 3 holes. I solder female headers on some IC pin strips to create plug in connections (like when one connects a node button to a resistor & power). I created a 3.3 volt friendly shield by cutting a trace on the bottom & connecting the power header & a power strip to the shield’s 3v supply header. I usually solder resistors, but otherwise plug RFM69 wires (8), transistor, SSRs, & jumpers into the Arduino headers & my add ons. (See below starting with this Oct 10, 2015 post.) On this forum, I've documented other nodes that feature: PIR sensor, liquid & enclosed space temperature sensor, water level sensors (2 kinds), Soil Moisture Probe, Mailbox notification, Air Temperature & Humidity, AC Device Control, Irrigation Automation, Wireless Programming, LCD (4-pin I2C interface). A Multi-Choice Node sketch can be customized to program several nodes. I put gateway & nodes all over my home’s 3 levels & tested the battery powered node in my yard. Once I worked out shortcomings, it’s worked mostly reliably. Again I thank all who contributed to this project. I'd love to see us take this project much further. It has so much potential. Beside gaining practical results, I learned much doing this & have other things I might try. There are holes in what I understand & can code so far, but I hope this summary is useful to others. As my contribution, I’m willing to answer questions & provide more details to the best of my time & ability. (As I have been doing in several posts below & in other threads on this proboards forum.) << My diagram of DIY Home Automation using OpenHAB, MQTT, Arduinos, & RFM69 wireless transceivers (Click on the picture to enlarge)To gain local home automation control on the host computer, one must have the wired & wireless connections from the home host computer (running MQTT service & OpenHAB server) to the home router to the gateway (electronics & program) to the end nodes (electronics & programs). To gain home automation control from any computer or mobile device, one adds the internet connection through my.openhab.org.
|
|
|
Post by Jon on Aug 5, 2015 8:52:41 GMT
Great, someone that has gone further. I got here from the original Indestructable that was very detailed and 'beginner' proof. The move to the design you mentioned from Trombly, DemonD, Bouillot, and CompuTourist is a step in the right direction but needs information along the lines of the original Indestructable. Anything you can share with diagrams etc I am sure would be of most use to everyone, thanks.
|
|
|
Post by papa on Aug 5, 2015 11:09:52 GMT
Sure, Jon, thanks for you reply. I can supply more. Given what I described, what specific functions would you & others like to hear more about? For example: "code & schematics for the garage door opener & garage door state function." "Making a 3.3 volt friendly Arduino shield."
|
|
|
Post by graham on Aug 5, 2015 13:17:16 GMT
Hi Papa,
About 1 month ago I ordered some parts from HK to recreate this project and most of it has arrived. Still waiting on the 3.3V mini boards.
I intend to take it a tiny step further and rather than use a SSR, use a mosfet to PWM Dim LED Downlights. This should provide far superior LED dimming than triac style dimmers commercially available and isn't limited by minimum circuit loads. I have purchased a box of LED down lights and still need to install them. They are 240V -> LED Driver (240V to 30VDCish) -> 13W LED downlight (COB style LED).
We only recently moved house and are still painting the new house and trying to rent out the previous house so I am very time short to work on this project atm.
I intend to monitor the wall switch to still be able to turn the light on and off from the wall (using the local node), and also control it from openhab. openhab will be used to change brightness levels, set default brightness levels, and have scenes.
I am most excited about using motion sensors to actually 'Automate' lighting and ventilation. It is 2015 - why dont the hall, kitchen, bathroom, and toilet lights automatically come on at a low brightness between the hours of 10pm and 5am if someone gets up? In the bathrooms we have lights, heating lamps, and ventilation fans. I hope to detect movement and an increase in humidity to run the fans, movement and cold room temperature to turn on the heat lamps, and just movement to turn on the lights. I will also use time of day conditions around everything.
Also being able to turn all the light off when you go out via your mobile is awesome. Occasionally I have been known to go out leaving lights on (especially if you leave for work before the sun is up).
I will also be playing around trying to automate the garage to open when I get close to home.
Enough rambling about what I intend to do....have you got the voice commands working?
|
|
|
Post by papa on Aug 5, 2015 15:46:53 GMT
Hi Graham, Interesting to hear what you propose to do. I'm not sure what you mean by "have you got the voice commands working?" Say more about that. My garage door opener might be a start for your purpose. Right now, I could use the User Interface on my phone to open the door from anywhere I have cell or wifi connection, but I assume you mean for OpenHAB to sense your nearness & open. To get the rest of the way, there's hints out there about having OpenHAB do certain things when your phone is close enough to connect to wifi or bluetooth. I Googled "OpenHAB sense presence" & came up with a few hits like groups.google.com/forum/#!topic/openhab/S79q1Kde9cg and groups.google.com/forum/#!topic/openhab/BXUkdGa_Ec0 Similar searches might provide solutions to consider & adapt. Do you or anyone else want me to provide more details on the garage door opener OR do you want the satisfaction of figuring it out yourself? As I aim to do, I hope you will report what you accomplish & supply some documentation to benefit others. & above all, have fun with it.
|
|
|
Post by papa on Aug 5, 2015 18:56:57 GMT
OK, Graham, I Googled OpenHAB voice control & see the possibility. No, I have not tried that. I did book mark it for future consideration.
|
|
|
Post by graham on Aug 6, 2015 12:26:22 GMT
My wife and I use android phones. I think the voice control for android is almost built in, just need to add a script to decode what goes where. I book marked some German code somewhere... github.com/openhab/openhab/wiki/Controlling-openHAB-with-your-voiceI have the openhab demo running on my RaspPI, I guess I should get voice working with that... then chop and paste that project when i start setting up my actual home. With the garage, I was going to try to use something like Llama to send a command when I am near to home based on cell phone towers (and time of day). Llama is a phone 'automation' app I use to turn my wifi/gprs on and off and switch profiles to quiet when I am work and loud when I am at home... www.makeuseof.com/tag/llama-automate-android-phone-location-profiles/
|
|
|
Post by Ray on Sept 11, 2015 13:00:43 GMT
Papa, fantastic work! My question is, would you be willing to pick one node (e.g. the garage door node) and post all the details for that node? For a newbie like me, seeing the gateway code, node code, a schematic/wiring diagram of the node, and the corresponding components in OpenHab all working as designed would be a great help. Are you able and willing to share that?
Thank you, Ray
|
|
|
Post by papa on Sept 17, 2015 23:55:42 GMT
Ray, sorry for the delay in responding. I just got back from a long trip & currently have a few busy days ahead. Yes, I have a good start on documenting what you request. After I meet current responsibilities, I'll aim to recheck what I have & post it here. As I said above, my stuff is "mostly based on CompuTourist’s excellent implementation." So in the meantime a good start for you would be to study CompuTourist's documentation & Arduino sketches at github.com/computourist/RFM69-MQTT-client, especially documentation under Gateway_2.1, and sketches & documentation under Gateway_2.2 & DHT end node. (some of the documentation is comments WITHIN the arduino sketches. CompuTourist did not say much about OpenHAB config files, but I can supply related examples when I get a chance.
|
|
|
Post by papa on Sept 18, 2015 17:55:27 GMT
Ray said "Papa, fantastic work! ... would you pick one node (e.g. the garage door node) and post all the details for that node?" As of 5/5/2016, ALSO see the new Garage End Nodes thread for more information & updates. For the Gateway, from computourist's github, I basically used the schematic & Arduino sketch for Gateway 2.4, EXCEPT I used a Buono Uno switched to 3.3v mode instead of a ProMini. RFM_MQTT_GW_24_pub4.ino << From here, download the Gateway 2.4 sketch, tweaked again 3/15/2017. For the garage door nodes, I started with the schematic & Arduino sketch for the DHT end node. Since I use a Buono Uno (supplies higher 3.3v current than the ProMini), I removed the power supply circuit at the upper left & middle of CompuTourist's schematic & connect directly to the Buono's 3.3v. On one Buono's 3.3 volts, trying to power a DHT11 temp/humidity sensor, Solid State Relay, & a reed switch to detect the garage door being open or closed, I seemed to bump against current limitations & things were erratic. So I built 2 garage devices to spread the functions & current needs. To get reliable operation on other nodes, I later used the 3.3v arduino digital pin (D9) to trigger a transistor to send the Buono Uno's 5 volts to activate the relay. Using the 3.3v to trigger 5 volts to the relay may allow me to combine all garage functions into one device, but I have not tried that yet. I'll share the garage door opener device now & maybe later the other garage unit. << Schematic, simplified 2/1/2017 First, the unit which only opens & closes the garage door (by closing a relay switch that passes 24volts DC to the garage door motor circuit board). The schematic above removes the pushbutton & DHT sensor & replaces the LED & resistor with the solid state relay. I assembled the unit on & to a Buono Uno Arduino compatible. Using the schematic just above, solder short (color-coded?) wires to the RFM69HC transceiver & the other end of these wires are stripped & inserted to the proper Arduino female headers indicated by the schematic. Since my garage door uses 24 volts DC, I used a DC to DC solid state relay (SSR). Connect SSR's POSITIVE INPUT terminal to Arduino D9. Connect SSR's NEGATIVE INPUT terminal to an Arduino ground socket. See schematic above for parts & connection.
Next, Code for the Arduino sketch to be uploaded to the Buno Uno for the Garage Door opener node: See the Garage End Nodes thread for a multi-choice sketch that can be customized for a Garage Door opener node & another Garage End Node with DHT temp/humidity sensor, a reed switch to detect the garage' vehicle door status & another switch to detect the status of the dead bolt on the garage's people entrance door.
Next for the Garage Door Opener node, the lines needed in the OpenHAB config files (Note I still use OpenHAB version 1.7.0. Perhaps the below will work for OpenHAB 2, but I don't know that yet.) My.items config file (in your version of the folder C:\openhab\configurations\items) : // signal strength from gateway to garage door opener node Number Node98Rssi "Node98 RSSI [%.3f db]" <network> (Nodes) {mqtt="<[mosquitto:home/rfm_gw/nb/node98/dev02:state:default]"} // On OpenHAB sitemap, will show a virtual switch for open / close garage door (with PushBtn icon) Switch Act_Node98 <PushBtn> {mqtt=">[mosquitto:home/rfm_gw/sb/node98/dev16:command:ON:ON],>[mosquitto:home/rfm_gw/sb/node98/dev16:command:OFF:OFF]", autoupdate="false"} Contact garagedoor "Garage Door Status [%s]" <garagedoor> {mqtt="<[mosquitto:home/rfm_gw/nb/node99/dev41:state:OPEN:ON],<[mosquitto:home/rfm_gw/nb/node99/dev41:state:CLOSED:OFF]"} in your version of the folder path: C:\openhab\webapps\images, you will need to download, & save the following .png icon files for items to work. (Other icons needed came with OpenHAB 1.7.0 install. These I downloaded/adapted.) nodes.png (will offer more images in next post) My.sitemap config file (in your version of C:\openhab\configurations\sitemaps:
sitemap label="My House" Group item=Nodes label="__Nodes__" icon="nodes"
Frame { Switch item=Act_Node98 label="Node98_Garage_Door_Opener" Text item=garagedoor }
My.rules config file (in your version of C:\openhab\configurations\rules): // These addons came in handy in my rules file (not all needed for garage door opener node) import org.openhab.core.library.types.* import org.openhab.core.persistence.* import org.openhab.model.script.actions.* import org.openhab.model.transformation.actions.* import java.lang.Math import java.util.Calendar import java.util.Date import java.util.TimeZone import java.text.SimpleDateFormat import java.util.Random
|
|
|
Post by papa on Sept 18, 2015 20:52:29 GMT
More needed for the Garage Door opener node to work, specifically icons listed in OpenHAB items config file: In your version of the folder path: C:\openhab\webapps\images, you will need to download, & save the following .png icon files. (Don't worry about icon size differences. OpenHAB makes them all the same size.) garagedoor-closed.png garagedoor-open.png PushBtn.png
I believe this short post & the long post above it pretty well documents what's needed for my version of a garage door opener (alone) node. When I get time, I'll aim to post documentation for another garage node that reads temp/humidity & (via a reed switch & magnet) whether the garage door is open or closed. As I wrote above, one might be able to combine the two garage nodes as long as activating the relay does not totally depend on the 3.3 volt current coming from the Buono Uno's D9 socket.
|
|
|
Post by computourist on Sept 19, 2015 19:07:18 GMT
Hi papa, good to see some activity again.. Seems you are having fun with Openhab ;-) Like you, I had some problems with the limited amount of current the Arduino can deliver on 3.3 Volts. I switched over to using a separate step-down circuit to derive 3.3 Volts directly from 5 Volts. A voltage regulator (AMS1117-3.3) together with some decoupling capacitors do the trick. Schematics are all over Internet:
|
|
|
Post by papa on Sept 19, 2015 20:05:54 GMT
Yes, CompuTourist, having fun & practical results from OpenHAB, RFM69s, & Arduino compatibles. When gone from home for a couple weeks, I had my setup somewhat randomly simulate our presence with TV & lights on & off around typical times we'd use them. Thanks for suggesting the circuit to step down from 5 volts to 3.3 volts? Could you say more about it? What was the source of the 5v, the Arduino's 5v socket or something else? Did this provide 3.3v with higher current THRU the Arduino or did this provide another source of 3.3v current that supplemented what came from the Arduino's 3.3v socket & digital outputs. And to where did you output the 3.3v, the power connection for things like the DHT11, the button, etc? So far it's worked well for me to use 5v to power a relay's input & in turn using the D9 signal to switch on the 5v with a transistor. However, the step down circuit might help if I decide to add more 3.3v current draws on a node.
|
|
|
Post by papa on Sept 19, 2015 21:27:08 GMT
Expanding 3.3 volt & other Arduino connections as needed for Home Automation nodes. A 3.3 volt friendly shield, Version 1: (Also see Version 2 at Oct. 10 - Oct. 16, 2015 posts below, where I describe building a complete DHT End node that reports temperature & humidity, has a working push button, & can activate an attached solid state relay to control AC devices. While adding more solder points for adding 3.3 volt connections, it also avoids tricky soldering to the B3 location on the shield.) In the following, labels starting with “A” or “B” are ones I added to indicate places on the Prototype Shield. Adapted & expanded from my first post above: To build a node, on top an Arduino compatible, I plug a double-sided prototype shield made for 20 pin integrated circuits (IC) seen below. As is, besides the usual Arduino header sockets, it has 5 more power sockets (FIVE volts, not 3.3), & 5 more ground sockets. The push button at the board's corner can restart the attached Arduino. In the middle of & outside the IC area are 2 each power (5v) & ground strips. For each IC pin is a strip of 3 holes. I solder female headers on some IC pin strips (in the strip rows labeled A5 & A6 below) to create plug in connections (like when one connects a node button to a resistor & power. See the revised September 22, 2015 post below.) Female header sockets A1 & power strip A2 will be changed from 5 volts to 3.3 volts. To do this, cut trace B1 on the shield's bottom. (Before soldering the following wire, put 2 short pieces of heat shrink tubing at its middle. When soldering, you may melt insulation near solder points, so move the tubing over bare areas & shrink with a little heat.) Carefully & accurately solder an insulated 24 gauge solid wire from solder hole B2 to 3 volt pin B3, keeping solder off near locations. Now you can solder things like one lead of a pull-up resistor to 3.3v on the strip A2 & plug leads needing 3.3v power into one of the A1 sockets. (Below I show how I wired the resistor needed by the schematic's push button.) Where I show the A1 label on the top view pic below, I put a 3v stick on label to remind me where 3.3v is available (the nearby header sockets & the strip that extends horizontally left from the header). Five volts is still available at the 5v Arduino socket AND the horizontal 5v strip at the middle of the IC pin strips. Update, 6/11/2016: To avoid needing pull-up resistors, see my thread Simplify End Node w Arduino internal pullup resistors. For nodes I sometimes solder resistors, but otherwise plug RFM69 wires (8), transistor, Solid State Relay wires, & jumpers into the Arduino shield sockets & my add-on female headers. When component leads are too thin to fit securely in a socket: I add just enough solder to enlarge them OR I bend a socket-length of lead back on itself & crimp where the lead is bent. The Prototype Shield push button labeled A4 (near the Arduino RST & 3v sockets) can be used for the DHT End Node button. See the Sept. 22 post below for this. On eBay, this Prototype Shield has had several China sources & maybe a couple U.S. sources. (Click on the images for a larger view.)
Prototype Shield, top view, labelled Prototype Shield, bottom view, labelled
|
|
|
Post by computourist on Sept 20, 2015 19:36:20 GMT
Just looked it up: Buono already has such a circuit on-board, so it can source much more current on 3.3 Volts compared to Pro mini... No need for this circuit. I use this circuit because the RFM module needs more current than the 3.3 Volts supply on Pro mini can deliver... My nodes are powered by cheap USB (5 V) power supplies. Yes, CompuTourist, having fun & practical results from OpenHAB, RFM69s, & Arduino compatibles. When gone from home for a couple weeks, I had my setup somewhat randomly simulate our presence with TV & lights on & off around typical times we'd use them. Thanks for suggesting the circuit to step down from 5 volts to 3.3 volts? Could you say more about it? What was the source of the 5v, the Arduino's 5v socket or something else? Did this provide 3.3v with higher current THRU the Arduino or did this provide another source of 3.3v current that supplemented what came from the Arduino's 3.3v socket & digital outputs. And to where did you output the 3.3v, the power connection for things like the DHT11, the button, etc? So far it's worked well for me to use 5v to power a relay's input & in turn using the D9 signal to switch on the 5v with a transistor. However, the step down circuit might help if I decide to add more 3.3v current draws on a node.
|
|
|
Post by papa on Sept 21, 2015 1:20:43 GMT
Yes, CompuTourist I had done similar current research on 3.3v current from Pro Mini & Buono. Even though the Buono has more 3.3v current, I still seemed to run into current limitations with push button, DHT sensor, Solid State Relay (SSR), & Reed Switch. Hence in one case, I split functions between two nodes. In other cases, I used D9 3.3v current to switch on 5v curent to a SSR via a transistor. This latter solution may allow me to combine functions I split to two nodes (when I get to it ;-)
Comment added on 9/23/2015: Comparing our two versions of your end node schematic, I noticed your power supply circuit at the upper left & middle to get more 3.3v current than the ProMini provides. Since I use a Buono Uno with higher 3.3v current, I removed your power supply circuit & connected directly to the Buono's 3.3v socket. That worked fine in some cases, but adding more functions reached current limits & required other techniques.
|
|
|
Post by camblonie on Sept 22, 2015 15:53:46 GMT
Thanks for the node details Papa!
|
|
|
Post by papa on Sept 22, 2015 21:44:34 GMT
Some background circuit-related posts from Sep 2015 were moved to this thread (link included).
Circuit Hints & Tutorials
Schematics
Electronic Parts like Resistors, LEDs ...
Soldering for Beginners, including tools
|
|
|
Post by Ray on Sept 23, 2015 11:18:13 GMT
Papa, thank you very much for sharing all the details. It's going to take a lot of time to digest all the materials and compare it to what I've done thus far.
Again, fantastic and awesome work!
|
|
|
Post by papa on Sept 23, 2015 15:27:38 GMT
Your welcome, Ray & others. Documentation is a time-consuming, painstaking process. It's also a way to give back in appreciation for others' work & documentation. Another reward is people like you using the documentation & giving feedback. I hope to keep adding to my contributions. Part of that is reviewing what I posted above AND trying to augment, correct, clarify previous posts. You viewers might benefit from re-reading previous posts. They might make better sense after my editing. ;-) Added 3/28/2017: I've also begun collecting posts into categories & then indexing them with links. ========================================== Expanding 3.3 volt & other Arduino connections as needed for Home Automation nodes. Version 2, starting from the beginning to create a 3.3 volt friendly shield for a DHT End Node. This post was moved & augmented in the Oct. 10 - Oct. 16, 2015 posts, starting here.
|
|
|
Post by papa on Sept 23, 2015 15:53:05 GMT
Responding to another thread, I am reminded that starting out I wondered how to size & shape the antenna attached to the RFM69 wireless transceiver mini board's ANT solder hole. The following is where I am at the moment: According to my research, a good antenna for 915mHZ RFM69 is about 3 inches. Using insulated 24 gauge wire, I've made them straight or coiled (wrapped around like a pencil & the pencil removed) which has worked well throughout my 3 level home & into my yard. The coiled antenna is certainly more compact & not as likely to get bumped as the straight version. I prefer an insulated antenna to avoid shorting with other things. In the thread homeautomation.proboards.com/thread/67/pictures, CompuTourist posted a coiled bare antenna he obtained from AliExpress. If the copper spring antenna was made a straight wire, I wonder how long it would be. I did not see that dimension in the AliExpress listing. ========================================================= Near here, there were two long posts about using the Arduino IDE (for writing, editing, compiling, & uploading Arduino sketches). They include key info about using the software libraries (including essential editing) needed by this Home Automation project & troubleshooting Arduino code errors. I moved those posts to their own thread, Arduino IDE Hints & Tutorials. ========================= Also near here was a post that started, " Learn to use other available troubleshooting tools besides the IDE indicators & reported error messages" seen there. I moved that post to this Troubleshooting & Debugging thread.
|
|
|
Post by papa on Sept 24, 2015 13:31:23 GMT
Reserved for breaking up the next long post.
|
|
|
Post by papa on Oct 8, 2015 23:40:10 GMT
A Post on assembling & programming the Gateway node:
For the original materials, I adapted from computourist's github. For an overview of this Home Automation network, read this file by computourist. Also see the summary diagram at the end of this post. For my Gateway, I basically followed CompuTourist's schematic & Arduino sketch for Gateway 2.4, EXCEPT I used a Buono Uno Arduino compatible switched to 3.3v mode instead of a ProMini." You could instead use a regular Arduino Uno compatible hacked to 3.3 volt operation like this. Caution: A regular Arduino that runs on 5 volts & sends 5 volts through the digital pins (D2, etc) will make your RFM69 radio defective.More caution added 5/26/2017: I recommend you use a Buono Uno (link above) which provides the amount of 3.3 volt current needed by the RFM69 radio. 3.3 volt Arduino ProMinis & CH340 boards may not be able to provide. If not a Buono Uno, your options are the regular Arduino Uno hacked to 3.3 volts (link above) or an added power supply circuit to provide sufficient 3.3 volt current (via a 5 volt adapter. a 3.3 volt regulator, & capacitors.) See this computourist circuit. Connect the circuit's 3.3 volt output to wherever a gateway or node needs a VCC or 3.3 volt connection. My Gateway schematic has some similarities to the adapted End Node schematic (see below). However, the Gateway has an Ethernet Shield plugged on top the Buono & has signal LEDs. Caution: on the Gateway, the RFM69's NSS wire plugs into D8,while it plugs into D10 on the end node. The main similarities between Gateway & End node are that both use Buono's or some 3.3 volt Arduino compatible AND all RFM69 wires EXCEPT NSS plug into the same Arduino locations. (Click on the images for a larger view.) << Gateway schematic. ^^ Note on schematic: computourist used 1 kilo ohm resistor with LEDs. I prefer 100ohm which lets the LED be somewhat brighter without burning out. For dimmer LED & to reserve more current to other node parts, use higher than 100 ohms. May 19, 2016, computourist said: With 100 ohms, current will be around 15 mAmps, well within specs. The Gateway pictured above is before I shortened all its wires. In the following, I underline the parts needed: I use ONE Buono Uno Arduino compatible (See the top of this post for source, explanation & other options.) Also needed: a W5100 Arduino Ethernet Shield & an RFM69 radio module (at your chosen frequency). Have a supply of 22 gauge insulated wire (at least red, black, & yellow) & 3/32 inch heat shrink tubing (at least red, black, & yellow). You need 2 LEDs (2 different colors), 2 resistor's (one for each LED, 100 ohms or 220 ohms or 1 kilo ohm) & an Ethernet Cable. More optional, but helpful: Other colors of wire & heat shrink tubing can help with color coding. RFM69 radios are sold at frequencies of 433 MHz, 868 MHz, & 915 MHz. See here about antenna sizes. I also adapted the following from this site. It gives appropriate regions for the frequencies. Antenna sizes may be close but a little different from other tables: Available Unlicensed Frequency Bands Frequency Antenna length Regions 433 MHz 173 mm Europe, Asia, Australia, U.S. (limited) 868 MHz 78 mm Europe only 915 MHz 82 mm U.S. and Australia (& Canada ??) Computourist here: "433 Mhz should give you a bit more range in comparison to 868 or 915 Mhz. However the 433 MHz frequency is crowded with many 'noisy' devices that could interfere." Gateway Assembly: Plan & solder (See the first Oct. 10, 2015 post below) the needed 22 gauge wires (color coded?) to the RFM69 module & strip the other wire ends to fit into the right Ethernet Shield sockets for each Arduino connection. Into the Ethernet shield's schematic-indicated Arduino sockets, plug the indicated wires soldered to the RFM69 transceiver mini board. As the Gateway schematic indicates, SCK connects to D13, MISO to D12, MOSI to D11, NSS to D8, DIO0 to D2, 3.3v to a source of Arduino 3.3 volts, & one RFM69 GND to an Arduino GND. As all diodes, LEDs (Light Emitting Diodes) allow current to pass in one direction & block it in the other direction so they must be placed properly. For each of the signal LEDs, (maybe applying heat shrink tubing to protect the bare wire leads) solder a resistor to the LEDs longer wire lead (the plastic LED base above that lead is usually round). Plug one LED's resistor into the Ethernet Shield's D7 & its shorter, remaining LED wire lead in a Gnd socket on the other side (the plastic LED base above that lead is usually flat). This first LED's steady shine will indicate the gateway is connected to the MQTT service on the computer. Plug the other LED's resistor into the Ethernet Shield's D9 & its free LED wire lead in a Gnd socket on the other side. This LED flashes to indicate radio signals being sent.). (Resistor & LED leads are small gauge & fit loose in sockets. You can "bulk them up" by spreading some solder along each end. Experiment with amount until lead solidly enters & stays in socket.) (The Gateway would work without LEDs, but with them, it's easier to see that it is working.) Have a power source: an adapter that plugs into the Arduino's barrel connector or via the Arduino's USB socket. With the Ethernet cable connect the Ethernet Shield (& thus the Gateway) with your home network. A hack fix to protect the Gateway's RFM69 radio from damaging voltages: (See full explanation in this thread.) Rising up from one side of the Buono Uno are a group of 6 pins called ICSP, one pin is VCC (power) Holding the Buono as it's oriented in the picture below, VCC is the upper right pin (& is labeled in the pic) << Click on the pic for a larger view. The ICSP pin labeled "1" is MISO, & VCC is pin 2, the pin paired with pin 1. The hack fix is ... bend out only the Buono's ICSP VCC pin so it will not connect to the matching Ethernet Shield (ES) socket above. Sufficiently insert all the other ES pins into the Buono Uno which is switched to 3.3 volt operation. The Gateway sketch program (RFM_MQTT_GW_24_pub4.ino) by CompuTourist:
To get this sketch, download this file. Open the Arduino IDE (program for loading, editing, & uploading Arduino sketch programs). From the Arduino IDE, open the sketch RFM_MQTT_GW_24_pub4.ino. << This version includes the rhyssman correction in computourist's github posting of Gateway version 2.5.Sometimes we are told to "comment out a code line" which means put two forward slashes ("//") at the start of the code line to make the rest of a line a "comment" (not programming code) & disables the code. To uncomment a line means to remove the two forward slashes ("//") at the start of the line to make the rest of the line into working code except "//" later in the line still indicates comment there. For example in the Gateway sketch, line 69's "// #define DEBUG" is a comment, not active code. The line "#define DEBUG // uncomment for MQTT debugging" starts with active code & ends with a comment. Be sure your computer has the code libraries that the Gateway sketch program needs & in the right location. Important: See the Oct 7, 2015 post about Downloading, Editing, & Installing Libraries. This contains two important library edits that help make gateway <> node communication reliable.Look through the Gateway sketch & choose the options that apply to your setup. (That is, commenting out what does not apply, uncommenting what does apply.) ... Speaking of options, I recommend that for test & troubleshooting purposes, you use the debug modes (one at a time) in the Gateway sketch (see the customizing paragraph below). This may make the sketch big enough that (after uploading) the Arduino IDE will warn you that the remaining memory for operation is limited. The Gateway will still work. If your computer has a "dynamic" IP address via your router's DHCP, the address can change & disconnect it from the Gateway & other things. Get the present IP address of your computer: For example, click Windows Start button. In the search box type cmd [enter]. In that black & gray window type ipconfig [enter]. Look for Ethernet adapter, IPv4 Address ….. 192.168.x.y Make note of the numbers in the “x” & "y" positions. I recommend that you log in to your router & make sure your computer has a static or fixed IP address. You can use the same IP address you just found for the static IP address. Also use those 192.168. . numbers below. Here's where to edit & customize the Gateway sketch for your setup: (In the Arduino IDE, when the cursor is on a line, the IDE tells the line number in the lower left corner.) About line 73 (byte mac ...), you can leave it as is to assign the Gateway its MAC address. About line 74, byte mqtt_server[] = { 192, 168, x, y } finish the IP address to match that of your "computer" where MQTT service is running. (For example, if your computer's IP address is 192.168.1.100, then x = 1 & y = 100.) About line 75 byte ip[] = { 192, 168, x , z } "x" will be the same as in mqtt_server & "z" will be a higher, but available network number than that in mqtt_server (following our made up example x = 1 & z could be 140). About lines 84-86 ( radio hardware version), uncomment (no "//" at the start) the one that matches frequency of your RFM69 transceivers & comment (start the line with "//") the rest. About line 88, choose your own unique 16 character encryption key for your network, make note of it, & use it also for all end nodes. About line 89 (#define IS_RFM69HW), leave it uncommented ONLY if your RFM69 transceivers have "H" in their part number. About line 68, comment out #define DEBUGRADIO (change it to // #define DEBUGRADIO...) About line 69, make sure #define DEBUG is uncommented (NO "//" at the line's start). Later you will reverse the comment / uncomment of these two lines. Using the upload feature of the Arduino IDE, while the Arduino connects to your computer via USB, send the Gateway sketch program (ending in .ino) to the Arduino. Before uploading, I find it helpful to use the verify feature & let it tell me if it finds sketch problems to fix. (See the Oct 8, 2015 1:59pm & 3:18pm posts about troubleshooting.) With the programmed Gateway's Arduino / Ethernet shield connected to your Ethernet network & to your computer via USB, with Arduino IDE serial monitor running at same baud as set in the Gateway sketch, with the sketch using Debug mode (no DEBUGRADIO yet), the serial monitor will show if Gateway is connected to your home network. With all that in this paragraph, plus MQTT running on your computer, you want the serial monitor to show MQTT connection & the Gateway's MQTT LED to light up. You want to see something like "GW Version GW V2.4 xxx Mhz... connecting ... MQTT-link OK" You won't see more good messages on the serial monitor nor a flashing Gateway radio signal LED until an end node is assembled, programmed & connected. Once your Serial Monitor says "MQTT-link OK," reverse the commenting in debugging lines 68-69. About line 68, UNcomment #define DEBUGRADIO (NO "//" at the line's start). About line 69, make sure #define DEBUG is commented (change it to // #define DEBUG...). This will aid your debugging when the Gateway AND an end node are running. << [added 3/7/2017] This change of debugging ends serial monitor feedback about DHCP & MQTT connection. In fact, until an end node is also working, you'll see little from the gateway on the serial monitor, just the gateway program version & its communication frequency. You may want to wait on reversing this commenting UNTIL you have built & powered an end node. Some hints about getting your RFM69 Gateway going: I recommend that your computer (where the MQTT service is running) connects via Ethernet cable to your home network. I had some trouble when my computer connected to the home network via WiFi. If your Gateway does not get connected to your home network (assigned an IP address) & thus not connected to MQTT service on your computer, it can help to restart your router & the Arduino / Ethernet Shield (by pressing the RESET button). If you see no results from the Gateway on the serial monitor ... You can reduce Gateway components to a minimum & test that. Try this: (with Gateway sketch line 68 commented & line 69 UNcommented) From the Ethernet Shield on top, unplug the LEDs/resistors and unplug all the RFM69 wires. That should leave the Buono Uno (3.3 volt mode), Ethernet Shield plugged on top, USB cable just connected to the Arduino (& not the computer yet) & NO Ethernet connection yet to the Ethernet Shield. Follow the sequence above for starting a fresh Arduino IDE & connecting the Arduino to the computer's USB, & opening the serial monitor. What do you now see in the serial monitor window? Something like "GW Version..." "No DHCP" ? If you get like that start up & error message, then connect the Ethernet Shield to your home network. Now what do you see in the serial monitor? If serial monitor reports a MQTT connection ("MQTT-link OK"), you can unplug from USB, plug in the MQTT LED/resistor, replug to USB, & MQTT LED should light. Then in similar way, you can plug in the RFM69 module. Maybe with this progressing assembly you can isolate a component that's not working. Note: Posts on Building a DHT End Node moved to this separate thread
|
|
|
Post by papa on Oct 16, 2015 12:35:34 GMT
On 1/28/2017, the following thread post was updated to my Multi-Choice End Node Sketch Based on computourist's RFM_DHT_node_22.ino
Sometimes we are told to "comment out a code line" which means put two forward slashes ("//") at the start of the code line to make the rest of a line a "comment" (not programming code) & disables the code. To UNcomment a line means to remove the two forward slashes ("//") at the start of the line to make the rest of the line into working code except "//" later in the line still indicates comment there. For example in the Gateway sketch, the line "// #define DEBUG" is a comment, not active code. The line "#define DEBUG // uncomment for MQTT debugging" starts with active code & ends with a comment. Be sure your computer has the code libraries that the DHT End Node sketch program needs & in the right location. See the Oct 7, 2015 post about downloading, editing, & installing libraries. Look through the Multi-Choice End Node sketch & choose the options that apply to your setup. (That is, commenting out what does not apply, UNcommenting what does apply.) ... Speaking of options, I recommend that for test & troubleshooting purposes, you turn on the debug mode in the Multi-Choice End Node sketch (see next paragraph). The following customization will tailor things to your components AND to work with the OpenHAB configuration files I will supply in a later post. Here's where to edit & customize the Multi-Choice End Node sketch for your setup: (In the Arduino IDE, when the cursor is on a line, the IDE tells the line number in the lower left corner.) About line 202, replace the "xxxxxxxxxxxxxxxx" with the same 16 character key you created & put into the Gateway Node sketch above. Make sure the next line (DEBUG), about line 203 is uncommented (NO "//" at the start). To select the frequency of the RFM69 radio transceivers you have, about lines 204-207, be sure that the same line is uncommented & activated as you did for the Gateway Node & that the other lines are commented. About line 201, if & when you build more end nodes, be sure you give each node a unique NODEID. The following assumes NODEID 02.
About line 208 (#define IS_RFM69HW), leave it uncommented ONLY if your RFM69 radio transceivers have "H" in their part number. Lines 153-154, comment one line & UNcomment the other, depending on whether you want a Celsius or Fahrenheit temperature scale. Uncomment line 159 for the DHT humidity & temperature sensor. Look at many lines starting at 1622 (which start with sendXX = true). As is, depending on what lines are UNcommented & meet the test of #ifdef ..... before them, the node (usually every 45 seconds per line 211), will "push" the data (to OpenHAB via the Gateway). For example, lines 1625 & 1626 send the data for radio signal strength & node voltage. Sketch lines 24-49 describe all the possible devices. Using the upload feature of the Arduino IDE, while the DHT Node's Arduino connects to your computer via USB, send the customized Multi-Choice End Node sketch program (ending in .ino) to the Arduino. Before uploading, I find it helpful to use the verify feature & let it tell me if it finds sketch problems to fix. (See the Oct 8, 2015 1:59pm & 3:18pm posts about troubleshooting.) Getting results: With the programmed Gateway's Arduino / Ethernet shield connected to your Ethernet network & to your computer via USB, with Arduino IDE serial monitor running at same baud as set in the Gateway sketch (115200), & with the Gateway sketch using debug mode, the serial monitor will show if Gateway is connected to your home network. With all that in this paragraph, plus Mosquitto Broker service (MQTT) running on your computer (see below), you want the serial monitor to show MQTT connection & the Gateway's MQTT LED to light up. With all that previously in this paragraph plus the DHT End Node powered & your computer running a rightly configured OpenHAB server (see below), the serial monitor may show "MQTT msg: ...." You should also see the Node's temp & humidity data on the serial monitor. On the OpenHAB user interface in a browser tab, you can also see such data & more. (See below.) You'd have a budding DIY Home Automation Network. Awesome, eh? Uhhh, you may also get errors which try to point you where to troubleshoot. Don't despair, that will help you learn how & why things are supposed to work. Suggested first steps: re-check Gateway & end node wiring with the schematics. Use a multimeter to continuity check the wiring (Are the correct things truly connected & did you avoid connecting the wrong things?). Did you download & extract the latest Gateway (2.4) & DHT node (2.2) sketches? Recheck how you customized the 2 sketches. Use the sketches' debugging mode & Serial Monitor output to give you clues.
|
|
|
Post by papa on Oct 16, 2015 13:52:48 GMT
=======================================================
Update 2/8/2016: This thread describes a Windows computer hosting OpenHAB, which can work on several operating systems. If you're not using Windows, you can skip those parts of this thread. You can still use this thread to help build your Arduino nodes (computer operating system does not matter). Then to install/configure OpenHAB on a Linux computer, you might use my thread, Linux Laptop: How to Install OpenHAB-Mosquitto. If you have a Raspberry Pi running Raspian version of Linux, you might use Raspberry Pi: How to Install OpenHAB-Mosquitto.
Important decision: What computer will run Mosquitto Broker & OpenHAB server for you? I recommend a computer with battery back up like a laptop or a desktop computer running from a UPS (Uninterruptible Power Supply). That way the computer won't shut down during a short power outage & require you to restart to get OpenHAB running again. Installing the needed Mosquitto Broker (MQTT) service on a Windows computerAt present, I use a Windows 7 laptop for OpenHAB. Eric Tsai’s Instructable & elsewhere said it could be done on Windows, but much of what I saw used Raspberry Pi. For my own & others’ documentation, I’ll try to describe that implementation from what I found & practiced. That was a couple months & much process ago, so forgive me & ask more if I miss something. I believe I have rechecked all the links provided as being still active. For me a Windows laptop has worked reasonably well with this project. I'm familiar with Windows. I have OpenHAB & Mosquitto running on the same computer where I research & edit config files; research, download, edit, & upload Arduino libraries & sketches; watch Arduino's serial monitor output from a sketch; research building Arduino devices; & prepare documentation as I have for this forum. The laptop battery provides backup power when mains power goes out. I put a OpenHAB shortcut in my Windows startup folder so when Windows updates & restarts, it also restarts OpenHAB. Installing Mosquitto on Windows:A readme file that may have come with the Mosquitto download & this web page (which I adapt in the following) helpfully address this. Mosquitto needs some .dll files that do not come with it. (download information was updated 4/24/2016)
From OpenSSL, Mosquitto needs libeay32.dll & ssleay32.dll Go here & scroll to "Download Win32 OpenSSL" From the top of the download list, download & install the latest version of Win32 OpenSSL xxxxxxx Light, currently Win32 OpenSSL v1.0.2g Light. The OpenSSL install offers to put its .dll's in the windows system folder. By authorizing that, the 2 files ended up in C:\Windows\sysWOW64From pthreads, Mosquitto needs pthreadVC2.dll I downloaded this file: sourceware.org/pub/pthreads-win32/dll-latest/dll/x86/pthreadVC2.dll I moved pthreadVC2.dll to C:\Windows\sysWOW64 & C:\Windows\system32If the above does not fully work, you may need to install Visual Studio redistributables. The packaged Mosquitto versions are compiled with Visual Studio 2010, which can be found here. From my notes, when I installed OpenSSL, it said I needed to install Microsoft Visual C++2008 Redistributables. Install Mosquitto: At mosquitto.org/download/ get the latest Mosquitto binary installation for Windows Vista up, currently this. Use that file to install the Mosquitto Broker service. Then in services.msc on your Windows computer, make sure the Mosquitto Broker’s startup type is automatic & that it is started. Important instruction, added Oct 21, 2015 & updated April 24, 2016: For Mosquitto to work, you probably need to open the inbound port 1883 in Windows Firewall. To do so go to Control Panel\All Control Panel Items then Windows Firewall \ Advanced Settings \ Inbound Rules \ Actions: New Rule. Make the following selections: Rule Type = Port. Protocol... = TCP, specific local ports, 1883. Action = Allow connection. Profile = all 3 checked. Name = Mosquitto Broker. When finished, click the Finish button to apply the new rule settings. To check & edit this Firewall rule, select Mosquitto Broker in the Inbound Rule list & click on Properties. In the General tab you should see the Name, Mosquitto Broker & the settings: Enabled & Allow the connection. In the Protocol & Ports tab, Protocol type: TCP; for Local port, specific ports & 1883; for Remote port, All ports selected. Other rules settings should be ok as is. This thread continues on Page 2.
|
|
|
Post by papa on Oct 16, 2015 21:30:15 GMT
Installing & Configuring OpenHAB Server on your Windows computer:
Updated Feb 6, 2017: I currently have version 1.8.3, which works well for me. However, Kai Kreuzer announced on January 23, 2017, "openHAB 2.0 release replaces openHAB 1.8 as the officially recommended runtime, only the openHAB 1 compatible add-ons will be further maintained. They are now available in version 1.9.0 and can be used on existing openHAB 1.8 installations. We have reached far more than 200 add-ons in this package by now and most of them can also be used in conjunction with openHAB 2." For now, version 1.8.3 runtime & addons should work for us, except for remote access, we need to install org. openhab.io.openhabcloud_1.9.0.201612192331.jar & make additions to the openhab.cfg file ( found here in the Configuration section). I give some hints in this thread. I believe much of what we've done (in version 1.x) with the OpenHAB config files will work with version 2, perhaps with some adaptation. However, if you're just beginning, it looks like you should go with OpenHAB 2.0. I intend to do that fairly soon & will aim to post what I learn.Warning: What follows applies to installing OpenHAB 1.8.3. It may not be up to date & I probably will not be maintaining it.
The following assumes you've built a working Gateway & DHT End Node 2 (see above). The following configuration will display DHT End Node 2's temperature & humidity readings & signal strength & voltage, weather information, & date & time. It gives you examples to build on. What you need: (I selected from & amplified earlier documentation)
If you don’t already have it, (first uninstalling any previous versions) install Oracle’s latest Java ( java.com/) . Updated, 2/6/2017: Download the following zip files to where you can find them: Runtime core, Addons, Demo setup, & (Windows version of) openHAB Designer. Extract & if necessary, move Runtime core files so the top folder is C:\openhab. Extract/move Addons to C:\openhab-addons. Extract/move Demo setup to C:\openHAB-demo. Extract/move OpenHAB Designer to the C:\openhab-designer. Configure OpenHAB server to run on your computer & work with your RFM69 network: (Adapted from this.)
Important note (that you may have addressed before): If your computer has a "dynamic" IP address via your router's DHCP, the address can change & disconnect it from the Gateway & other things. Get the present IP address of your computer: Click Start button. In the search box type cmd [enter]. In that black & gray window type ipconfig [enter]. Look for Ethernet adapter, IPv4 Address ….. 192.168.x.y Make note of the numbers in the “x” & "y" positions. I recommend that you log in to your router & make sure your computer has a static or fixed IP address. You can use the same IP address you just found for the static IP address. Make note of your computer’s IP address for use below. From the folder C:\ openhab-addons to the folder C:\openhab\ addons, copy the latest version of the following 8 files ( Updated, Oct. 12, 2016) org.openhab.action.mail-1.8.x.jar org.openhab.binding.http-1.8.x.jar org.openhab.binding.mqtt-1.8.x.jar org.openhab.binding.ntp-1.8.x.jar org.openhab.binding.weather-1.8.x.jar org.openhab.io.myopenhab-1.8.x.jar org.openhab.persistence.logging-1.8.x.jar org.openhab.persistence.rrd4j-1.8.x.jar org.openhab.io.openhabcloud_1.9.0.201612192331.jar << Updated 2/6/2017: Download this file to your \openhab\ addons folder. I give some hints in this thread. Caution: Apparently, editing OpenHAB config files with Windows Notepad or Wordpad can create problems, especially when the files are used on a Raspberry Pi. In the download below, I've aimed to correct some errors found & rebuild the files using Notepad++ which is supposed to work better. On 10/11/2016, the .zip of sample config files was updated & renamed to openhab-papa4.zip. I did some testing using these files & believe they are correct if edited as shown just below. Let me know how these files work for you & any errors you find.
openhab-papa4.zip (235.6 KB) << Download this zip file & extract & if necessary, move it to so the top folder is C:\openhab-papa4 (with the folders \configurations & \webapps nested inside it). I packaged these configuration files especially for the Gateway & DHT End Node built earlier. Using these should save time getting started with OpenHAB & will give something relatively simple to learn from & build on. Now copy the downloaded files to the OpenHAB configurations folders: Copy this:
| From this folder:
| To this folder:
| openhab.cfg | C:\openhab-papa4\configurations | C:\openhab\configurations | My.items | C:\openhab-papa4\configurations\items | C:\openhab\configurations\items | My.rules | C:\openhab-papa4\configurations\rules | C:\openhab\configurations\rules | My.sitemap | C:\openhab-papa4\configurations\sitemaps | C:\openhab\configurations\sitemaps | Both files | C:\openhab-papa4\configurations\persistence | C:\openhab\configurations\persistence | 15 image files | C:\openhab-papa4\webapps\images | C:\openhab\webapps\images |
Update, 5/13/2017: My.items has the line Number Humidity_Node02 "Humidity_Node02 [ %d %%]" <humidity> {mqtt="<[mosquitto:home/rfm_gw/nb/node02/dev49:state:default]"} According to pato, in OpenHAB2, that line above now needs to be: Number Humidity_Node02 "Humidity_Node02 [ %s %%]" <humidity> {mqtt="<[mosquitto:home/rfm_gw/nb/node02/dev49:state:default]"} I believe I already did most of the openhab.cfg edits that you will need so far, except, do these: Use Notepad++ to open C;\openhab\configurations\openhab.cfg
1) Hold [ctrl] & tap the [f] key for “find.” In the Find box type security:netmask [enter] In the decimaled number ( 192.168.x.0/24), change the “x” to the 3rd number of your computer's IP address which you noted above. 2) Get your location's latitude & longitude at www.distancesfrom.com/Latitude-Longitude.aspx In openhab.cfg, find weather:location & replace the nearby ##.######'s with your location’s latitude & longitude. 3) Register at Weather underground (Wunderground) & get an api key: Follow the helpful instructions here. 4) In openhab.cfg, find the line weather:apikey.Wunderground= Put your Wunderground api key following the “=” sign at the end of the line. 5) Save the changed openhab.cfg file ( hold [Ctrl] key & tap "s" key ). Continuing to edit openhab.cfg: 1) Find Mail Action configuration. 2) a) If you use gmail, at mail:username= & mail:from=, replace yourEmailaddress with your address & at mail:password=, replace yourPassword with yours. 2b) If you don't use gmail, for your email service, you'll need to get the right values for: mail:hostname, mail:port, mail:username, mail:password, mail:from, mail:tls, & mail:popbeforesmtp. [To make lines active, be sure they are UNcommented (no # at the line's start) “#” before a line means its “commented” (not active & relying on the default value shown nearby.] Caution added 3/9/2017: In any openhab file that ends in .cfg (like openhab.cfg), to "comment" (to deactivate a code line or to provide an explanatory note), be sure you start each line with the # character. In a .cfg file, do NOT start a commented line with "//" (how we start a commented line in .item, rules, etc files & Arduino sketches) because the .cfg file will become unreadable & throw errors ("openhab.cfg' cannot be read").On a Windows computer, to edit the other config files, use Notepad++ or you may use OpenHAB Designer as follows ... Run / launch C:\openhab-designer\openHAB-Designer.exe. (It takes a little while to come up.) I encourage putting a shortcut to Designer in your Start Button, your task bar, or your desktop. The first time you launch Designer, click on the open file folder icon & choose the folder where the config files are located, C:\openhab\configurations. Then & ever after, a list of configuration folders (Items, etc) & files will show in the upper left window. Edit the openhab/configurations/rules/My.rules file: 1) Find "email Node02 Humidity" 2) Twice nearby, replace yourEmailaddress with your actual email address. 3) IF you want an email beyond the provided humidity range (less than 35% or more than 50%), edit accordingly. 4) Save the My.rules file. Note: The My.items & My.rules files have comments about changing between Celsius & Fahrenheit temps. As you add to your openHAB configurations later, you (again) should not use just any Windows text editor because edited files may choke in some computers. For editing, OpenHAB Designer & Notepad++ have advantages like being able to have more than one configuration file open in adjacent tabs so one can compare & copy between them. Designer & Notepad++ also help you use correct syntax. Plus they don't introduce end of line problems. If you have trouble with Mosquitto & OpenHAB working, you did open the inbound port 1883 in Windows Firewall, right? Follow the instructions at the end of the Oct 16, 8:52am post about installing Mosquitto on Windows.
|
|
|
Post by papa on Oct 17, 2015 14:45:28 GMT
Launching OpenHAB Server
In the Start button’s search box: type C:\openhab\start.bat [enter] A black background OpenHAB console should open & start displaying OpenHAB's booting & then node data. I encourage you to put a shortcut for the start.bat file in your start menu & Startup folder. The latter will insure that OpenHAB restarts when your computer restarts (like sometimes after Windows updates. [ To stop OpenHAB server, enter exit [enter] [enter] even if data interrupts what you type.]
Getting results with Your Basic OpenHAB Home Automation Network
With the programmed Gateway's Arduino / Ethernet shield connected to your Ethernet network & to your computer via USB, with Arduino IDE serial monitor running at same baud as set in the Gateway sketch (115200), & with the Gateway sketch using debug mode, the serial monitor will show if Gateway is connected to your home network. With all that in this paragraph, plus Mosquitto Broker service (MQTT) running on your computer (see above), you want the serial monitor to show MQTT connection & the Gateway's MQTT LED to light up. With all in the previous paragraph plus the DHT End Node powered & your computer running a rightly configured OpenHAB server (see above), the serial monitor may show "Message sent to node" .... You should also see Node02 temp & humidity data on the serial monitor. You'll have a simple, but working DIY Home Automation Network to build on. Awesome, eh? But it gets better ...
In a browser tab on your computer running OpenHAB, enter this address http://localhost:8080/openhab.app?sitemap=My The OpenHAB user interface should show in the browser tab showing data & virtual controls. In the user interface, you should see a virtual switch for Node02’s relay, & Node02’s temp & humidity. If you click on the Outside Temp (from Yahoo weather for your location), you get more weather info including a representation of comfort level. To return to the main user interface window, at the top, click on My House or the browser back button. At the bottom is date & time info, current to the last 10 minutes. Default was 15 minutes, I’m not sure why. In openhab.cfg, you can change this at ntp:refresh= (divide the number by 1,000 to get how long between refreshes) At the top left of the interface, see a link for Nodes. When clicked, it shows you Node02’s radio signal (RSSI) strength & voltage. This data make take a while to show up. Whatever RSSI is good enough if you get data. Added on 12/26/2015: Using the OpenHAB User Interface on Another Computer in Your Local Network
Here's another good reason to assign a fixed IP address to the computer Hosting the OpenHAB server program (See the Oct 8, 2015 at 6:40pm post above where it was updated on Oct. 19). In your local network, say OpenHAB server is running on a computer with the fixed address 192.168.1.12 & in your C:\openhab\configurations\sitemaps folder you have the config file My.sitemap. In a browser address box on another computer in your local network, enter 192.168.1.12:8080/openhab.app?sitemap=My [enter key] Your sitemap user interface should appear within that browser so you can view & control your openHAB network from there. You might put that [192.168... ] address in your bookmarks so you don't need to type it again. Again this works on another computer within your local network where your OpenHAB computer has an ip address. To use another computer in ANOTHER local network, you must work through the internet as described below.
|
|
|
Post by papa on Oct 17, 2015 23:10:21 GMT
The openHAB Cloud Service has moved so this post was updated on 1/30/2017 Getting Internet Access to your OpenHAB network via MyOpenHAB ( myopenhab.org/ ) Control your OpenHAB user interface on ANY computer with internet connection & an internet browser.
Exit the OpenHAB server, that is, type exit [enter] [enter] & wait for OpenHAB black & white cmd window to close. If like me you used the OLD openHAB Cloud site (my.openhab.org) ... In openhab.cfg, I did not see any old my.openhab.org stuff to disable. I removed org.openhab.io.myopenhab-1.8.3.jar from addons folder & parked it elsewhere. Documentation for OpenHAB 2 is here. Since I use OpenHAB 1 ... Documentation for OpenHAB 1 is here. Below I summarize that plus other things I learned: Download org.openhab.io.openhabcloud_1.9.0.201612192331.jar to your \openhab\addons folder It's part of an upcoming 1.9.x version, but supposed to work with 1.8.x In my own openhab.cfg file, just before Binding Configurations, I added the following At first, I left them as is & did not edit them. ############################## openHAB Cloud Connector #############################
# The URL of the openHAB Cloud service to connect to. # Optional, default is set to the service offered by the openHAB Foundation # (https://myopenhab.org/) #openhabcloud:baseURL=
# Local port that the openHAB runtime is available through HTTP. # Optional, default is 8080 #openhabcloud:localPort=
# Defines the mode in which you want to operate the connector. # Possible values are: # - notification: Only push notifications are enabled, no remote access is allowed. # - remote: Push notifications and remote access are enabled. # Optional, default is 'remote'. #openhabcloud:mode=
# A comma-separated list of items to be exposed to external services like IFTTT. # Events of those items are pushed to the openHAB Cloud and commands received for # these items from the openHAB Cloud service are accepted and sent to the local bus. # Optional, default is an empty list. #openhabcloud:expose= With a text editor like Notepad++, see & note the contents of C:\openhab\webapps\static\uuid & C:\openhab\webapps\static\secret Prepare a robust password. A password technique I like is aiming for at least 9 characters, choose a phrase from a song or a made up sentence, reduce each word to a single letter (keeping capitalization), maybe add a symbolic mark (like < . , & ^ $ # if permitted) & add a number like a year. For example, "When Johnny comes marching home again 2015" becomes the password: WJcmha2015 This way is a challenge for others to guess, but memorable to you. Register as a NEW USER here. (<< Caution: the site address no longer has a period after "my") You will supply your email address (must be all lower case), a password (see above) for your myopenhab account, AND the information you copy from the uuid & secret files. Notice you are providing like TWO passwords, one for your account & "secret," the code for connecting with your OpenHAB server. Added April, 24, 2016: If you do a new install of OpenHAB later, you must update your myopenhab account with the NEW uuid & secret. Here login to myopenhab by giving your previously registered email address & ACCOUNT password. Then at the upper right, click on your email address then Account. Enter the NEW uuid & secret there. In the Getting Started Guide at is the section “Adjusting openHAB security settings to work with my.openHAB” I included most of this in your downloaded openhab.cfg files. If you followed the directions above, you should have finished the rest. << Not sure about this. Need to check. Restart OpenHAB server (C:\openhab\start.bat). Once all this is accomplished you can use any computer to log in to your OpenHAB user interface via myopenhab.org/loginEven Better: Controlling OpenHAB with your (internet- or cellular- connected) Apple or Android device
Get OpenHAB iOS App at App Store. Or get OpenHAB Android App at Google Play. Also updated, 1/30/2017: Configuring openHAB iOS and Android apps can't be easier. Just set remote URL to myopenhab.org in your app's settings and set username (email address) and password (account password) to the same ones (see above) you use to log in to myopenhab.org website, and you are done. << If you used the OLD openHAB Cloud Service, the remote URL must be changed (no period after "my"). Change the password if you registered with one different than what you used with the old openHAB cloud site. Once you’ve registered at myopenhab.org & your app is configured as above, you can use the app to see & control your OpenHAB server with the same user interface you see on the browser where the server is running.
|
|
|
Post by papa on Oct 18, 2015 21:08:27 GMT
This post was "Installing the needed MQTT service on a Raspberry Pi"
Now it's called "Using OpenHAB & Mosquitto (MQTT) on Other Operating Systems
As said above, OpenHAB on a Windows laptop has worked well for me. However, I foresaw possible advantages to other operating systems ... Added 1/29/2016: Like me, do you have an older (originally Windows) laptop or desktop on which you installed Linux & now you want to use it for OpenHAB with Mosquitto? I recently finished installing & troubleshooting that. I then aimed to document just what is needed for the install.
I could also foresee some potential advantages in using a Raspberry Pi. Once the Pi was working, OpenHAB on the PI would run on a separate device & not tie up the more expensive laptop. I assume a Pi, like an Arduino, would restart its programming when power goes off & back on. Once getting more familiar with Linux & installing OpenHAB / MQTT on Linux, I purchased a Raspberry Pi 2 B & pretty smoothly installed OpenHAB / MQTT & connected my RFM Gateway & DHT End Node to it.
|
|
|
Post by papa on Oct 18, 2015 23:23:06 GMT
Using the OpenHAB Apple or Android app via MyOpenHAB
See at the end of the Oct 17, 6:10pm post.
|
|