openHAB serial communication to Arduino



  • I'm just getting into home automation with arduinos, and am planning an openHAB controller with a couple arduino sensor nodes. I currently have openHAB running on ubuntu on a VM, and only have one arduino UNO at the moment (nano on the way).

    I've loaded the gateway sketch onto the UNO and am getting serial output (0;0;3;0;9;check wires) on the serial monitor of the IDE, which I assume is normal since there is no RF board installed on the UNO yet.

    Where I'm having trouble is figuring out how to pass this data over to openHAB. If I understand correctly, the serial connection would work, but I'm having trouble configuring the openHAB side of things if that is the case. I've uploaded the serial binding to the addons folder. What am I missing?



  • @Tango2 Here is a tutorial for that. Hope that helps 🙂



  • Thanks kunall. That's exactly what I was looking for.

    Being new at just about all of this, I'm still having problems. Things seem to be a little different on Ubuntu, so I'm having to adapt on the fly. Currently, dmesg shows my usb devices as "/dev/ttyACM0". I adjusted the rules file to match the corresponding values in dmesg on my machine. I believe the rules file is not working correctly, as I don't have a ttyUSB99 listed. I tried changing the symlink in the rule to ttyACM99 to see if that would make a difference, but it didn't seem to.

    I also tried updating my demo.items file to point to the ttyACM0 that is being detected, however that doesn't seem to work either. I get the following error in my openhab.log file:

    Could not open serial port /dev/ttyACM0@115200: Serial port '/dev/ttyACM0@115200" could not be found.   Available ports are:
    
     at
    

    I'm also seeing this error just before the above error, but can't figure out why the syntax is showing as it is below:

    2015-04-28 13:14:54.004 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'serial' of item ‘Arduino‘ could not be parsed correctly.
    

    This is also after updating to 1.7.0-SNAPSHOT from 1.6.2. Am I missing something simple?



  • @kunall said:

    @Tango2 Here is a tutorial for that. Hope that helps 🙂

    I'm getting closer....

    I have my r-pi2 now, and I'm building openhab on there. I also got my dupont cables I ordered to connect my nRF24L01's up. I now have the r-pi and arduino uno (gateway) connected and wired up.

    Part of the problem I was having before must have been with VMWare ESXI, because now openhab sees my Arduino, however it only sees it on ttyACM0, not ttyUSB99 like it should based on the tutorial above. Should I change the syslink to ttyACM99? The tutorial doesn't specify, and my linux skills are far from good enough to know this off hand.

    I appreciate the help and look forward to setting some of these sensors up!

    EDIT: I did change the demo.items from the link that kunall posted above to reflect ttyACM0, and received the "0;0;3;0;14;Gateway startup complete." message, so I'm making progress, however I'd like to get the static assignment working for stability down the road.


 

286
Online

8.7k
Users

9.5k
Topics

99.6k
Posts