Home Automation and UDOO

Discussion in 'Automation, Motors & Robotics' started by humblehacker, Apr 28, 2014.

  1. humblehacker

    humblehacker New Member

    Joined:
    Apr 7, 2014
    Messages:
    16
    Likes Received:
    0
    I would like to examine potential use cases for UDOO as a Home Automation controller vis-a-vis the wide variety of open source automation SW platforms including http://www.freedomotic.com, http://www.openHAB.org, homA (https://github.com/binarybucks/homA), and http://www.nodered.org/. In the increasingly cluttered marketplace of small-form MiniPC/Microcontroller boards, its possible that Home Automation might represent a perfect niche for specific capabilities offered by the UDOO.

    Thus far the the Home Automation market has suffered from a lack of interoperability between various hardware devices. Interoperability has always been part of the appeal of open source, but until very recently open source home automation platforms have been fragmented and far beyond the reach of an average user.

    The growth of web-based GUI platforms like Node-RED and RESTful API services like http://www.temboo.com finally offer a chance to provide the kind of user-friendly customizations that will make home automation an appealing market. With the UDOO, we might have the perfect combination of cost, processing power and I/O interactivity to serve as a bridge between physical device networks and the cloud.
    I would like to use this thread to collect and compare user-experiences deploying various home automation platforms such as Freedomotic, openHAB and homA in the hopes of providing better documentation for smoother integrations.
    After attempting installations of homA and Freedomotic (which apparently requires Debian at present and I'm running Ubuntu) I've settled on openHAB for my first experiment. Both Freedomotic and openHAB are Java-based and i"m sure I'm not the only Linux-user who would rather avoid the wonders of navigating OpenJDK vs Oracle support on embedded systems. The web/mobile-based homA seems more appealing in this regard, but unfortunately it lags far behind in terms of consistent support and add-on features.

    So after about a full day installing the Oracle JDK and requisite openHAB runtime/Add-on packages, it looks like this will be my system for the time being.

    I'm looking forward to hearing about others' experiences!
     
  2. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    I installed node.js / johnny-five / node.red last night , and they look like a interesting way to control the udoo arduino side via firmata.
    I`m looking how to make a web page which controls the udoo and looking for the best way to get feedback from the web page
    But normally I would say that home automation is controlling and sensing things by remote at long distances using protocols like zwave , X10 , lightwave etc , not using gpio`s on the controller it`s self.
     
  3. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Been playing with node-red the last couple of days , which is a bit of a resource hog to me.
    Using nearly a full core and 51 % memory to cycle a RBG led through it`s colours changing once every 60 millisecond and controlling the led via firmata.

    I`ve never used JavaScript before so I may not doing things the most efficient way , but that a lot of resources compared to python which would only use a few percent of cpu and memory to do that job.

    But that said node-red would be very interesting if you could interface with the multi-core hardware directly like you can with the raspberry pi.
    It`s a easy way to fast prototype a program where you can debug the output , which is useful for someone like me who is only starting out with JavaScript.

    I`ve found that node-red as a big memory leak with my flow or any repeating code.
    My led program memory use just expands until it uses all the available memory and kills it`s self.
     
  4. humblehacker

    humblehacker New Member

    Joined:
    Apr 7, 2014
    Messages:
    16
    Likes Received:
    0
    Thats Great! Might I ask which version of Node.js you installed and/or if you had to compile it from source?

    I must admit that N-Rs dependence on Firmata for the Arduino module is one of the biggest turn-offs for me. Especially since the overall simplicity of the Arduino programming environment was what attracted me to it in the first place, so it doesn't make much sense to have to go learning a web-based language like .js to do the same thing I already do on Arduino. Johnny-Five seemed appealing as a more efficient means of remotely driving an Arduino via a Raspberry Pi, considering the limited capabilities of the Pi GPIO, but that was before the UDOO...

    I would tend to agree with this statement.
    Node-RED was originally created as a dashboard for managing messaging via the MQTT protocol and has been extended to apply to many others (including some like ZWave you mentioned earlier). My initial thought is that its best application would be to serve as a front-end dashboard allowing for the easier management of multiple physical interfaces hosted elsewhere, rather than a component of a master gateway device. A great example of how NR can fit into a larger HA framework can be found in this discussion on using NR with the homA platform- https://plus.google.com/107186102357963 ... HHPQg9TPp4
    ON THE OTHER HAND... The UDOO has considerably more potential for combining web-based processing and physical interactions than most people are yet accustomed to. So instead of having to translate the thousands or Arduino sketches out there into Javascript events (as JohnnyFive would require), one could simply program via a cloud based Arduino IDE and export into prepackaged modules for any number of protocols. Be they Node-RED (.js), OpenHAB (Java), Python. or Android. Processing (on which the Arduino IDE is based) already offers this capability but its Java-based and way too heavy. Online web services like Temboo also offer something along these lines, but not exactly in the same manner as i"m thinking.
    I know that Arduino itself has been preparing for something along these lines since they announced the "Arduino TRE" last october (http://arduino.cc/en/Main/ArduinoBoardTre). As far as I can tell the "TRE" is meant to be like a Beaglebone Black, only it would actually be usable... Such a development would still bode well for UDOO, as it still has 4x the processing and I/O power and would hopefully result in more users contributing more compatible programs.
     
  5. humblehacker

    humblehacker New Member

    Joined:
    Apr 7, 2014
    Messages:
    16
    Likes Received:
    0
    I'm not much of a Javascripter either so I don't know how much help I can offer except to say that something does indeed seem unusual in the amount of memory your installation uses. I've been running both Node-RED and JOhnny Five on the Raspberry Pi for almsot a year and I've yet to encounter issues like you're dealing with. I did find an interesting discussion on Stack Exchange comparing the relative virtues of Python vs Node.js for the Raspberry Pi- http://raspberrypi.stackexchange.com/qu ... h-internet
     
  6. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    I really don`t understand node.js / node-red right now or it could just be me not upstanding how it should be used.
    From my first attempt at constructing a simple node-red flow it appears to be the most inefficient way I`ve ever seen to program.
    It`s not a sledge hammer to crack a nut programming language , but more like a elephant to crush a baked bean type of language.
    I did find I way around my memory problem in the end by reading how to run node-red on the Pi , eg using the option --max-stack-size=val , but still find it to be super slow.

    Before node.js / node-red Johnny5 becomes really useful on the udoo it need to be able to use the hardware directly without firmata , which would help if we had a linux distro like Raspbian , where the spi and i2c could be made to work with a simple add this to the modules list.

    I`m not totally sure about the big advances of Javascript events driven programming as over linear programming , but do know from past experience with VB.net it is more difficult to debug.

    what !!!!!!I I would like to differ on that , no interpreted language can ever be as fast as a compiled language.
     
  7. bhakta

    bhakta New Member

    Joined:
    Nov 22, 2013
    Messages:
    16
    Likes Received:
    0
    There is also The Thing System http://thethingsystem.com/index.html has support for some popular things has anyone gotten temboo to work? I tried openhab and freedomatic on udoo, just didn't enjoy it cause it didn't support voice control. Right now I prefer the Android build paired with tasker & event ghost, but need help on the arduino/android connection which seems to be nonexistent.
     
  8. humblehacker

    humblehacker New Member

    Joined:
    Apr 7, 2014
    Messages:
    16
    Likes Received:
    0
    I've used Temboo with the Arduino Yun and its almost too easy since support is built in. For anything else its just a case of setting the desired language (i.e Python,Node.js, Processing etc...) in the output settings. I might try using it as a kind of code translator to convert my Arduino Sketches to Node.js for use in JohnnyFive or Node-RED.

    I just discovered TTS last night and was about to post about it. It certainly seems to have a more up-to-date interface and the precompiled images for i86/RPi/BBB are nice. It brings up an interesting issue for us UDOO users should the model of hosting hardware-specific precompiled binaries become more widely adopted. As far as embedded Linux projects are concerned, about 98% of them at present seem to be written for the Raspberry Pi. I know one of the issues I always had with the Beaglebone Black was that the difference between programming for it and the Pi was like the difference between Spanish and Italian... Its Similar enough to fool you into thinking the similarities make translation easy, when nothing could be further from the truth.... Things might be somewhat different now that they have an official Debian port for the BBB, but I havent tried it yet and documentation is scarce.
    As its unlikely that any ARM Linux board will ever surpass the RPIs library of user documentation, I wonder if it would be good practice for other boards like UDOO, BBB and even the Arduino TRE to adopt Debian as a default option for users who require cross platform compatibility. This doesn't bode well for Yocto or Linaro I suppose but the alternative is starting to seem much more complicated...

    Its enough to make me wonder if I should drop Ubuntu for Debian before I get too deep and have to start all over again...
     
  9. andrewhennessy

    andrewhennessy New Member

    Joined:
    Aug 18, 2013
    Messages:
    9
    Likes Received:
    0
    I Have been trying to use Node.js, Socket.io, Express, serialport. Every time I try to use it and follow through the suggested troubleshooting steps another problem props up. I'm not looking for assistance on what I already have but a bottom up solution. Thanks.
     
  10. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Are you on Ubuntu or Debian ?
     
  11. dantavious

    dantavious New Member

    Joined:
    Nov 29, 2013
    Messages:
    32
    Likes Received:
    0
    b


    What are the specific problems, I have used all of those on the udoo and they work.
     
  12. andrewhennessy

    andrewhennessy New Member

    Joined:
    Aug 18, 2013
    Messages:
    9
    Likes Received:
    0
    Ubuntu However I just used AJAX and PHP serial however PHP serial will say stty not available when I use it? Here is My Code.
    Code:
    stty -F /dev/ttymxc3 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
    
    Code:
    <?php
    
    // get the q parameter from URL
    $q=$_REQUEST["q"]; $status="";
    
    
    // Output "no suggestion" if no hint were found
    // or output the correct values 
    error_log($q);
    
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    include "php_serial.class.php";
    
    $serial = new phpSerial();
    $serial->deviceSet("/dev/ttymx3");
    $serial->confBaudRate(115200);
    $serial->confParity("none");
    $serial->confCharacterLength(8);
    $serial->confStopBits(1);
    $serial->deviceOpen();
    $serial->sendMessage($q);
    $serial->deviceClose();
    
    
    ?>
     
  13. humblehacker

    humblehacker New Member

    Joined:
    Apr 7, 2014
    Messages:
    16
    Likes Received:
    0
    Add two more platforms to the Node.js/Home Automation bandwagon-
    http://skynet.im/

    Code:
    SkyNet allows you to query devices such as drones, Hue light bulbs, Belkin wemos, arduinos, and server nodes that meet your criteria and send IM messages to one or all devices.
    
    You can subscribe to messages being sent to/from devices and their sensor activities.
    
    We now support cloud-to-cloud message routing allowing your private SkyNet cloud to interact with SkyNet.im connected devices (and visa versa) creating a "hybrid" cloud network!
    Skynet is also related to Cylon.js and even a fork of Node-RED called NodeBLU. It seems to be part of a growing trend based around low level http "message-subscribe" type communications like MQTT.

    and then there's http://ninjablocks.com/ which has been around for awhile. This latter of the two might make the most sense for the UDOO considering it requires Node.js and a connected Arduino with an RF module.

    As much as I hesitate to jump on board the Node.js bandwagon it seems like its becoming more and more like the default language of all things IOT... So with all that said, it would certainly be helpful if we could nail down a stable configuration for running Node.js on UDOO. Granted, I haven't tried it on the new UDOObuntu OS, but I can't even find a definitive answer on which node version to use!
     
  14. dantavious

    dantavious New Member

    Joined:
    Nov 29, 2013
    Messages:
    32
    Likes Received:
    0
    I having been using Node.js on the UDOO for months now. I downloaded the source and compiled as the default package was to very old. I am currently using version 11.10. I created a web page that displays temperature and humidity real time from information from the DHT22 Temp/Humidity Sensor, as well as the ability to turn on and off a lamp connected via a relay. All, I used was Nodejs and the Express, SerialPort and Socket.io modules. My whole reason for investing in the UDOO is for home automation and I currently believe the best way for me is use primarily the UDOO side for all sensor related activity and use the Linux side for front end stuff.
     
  15. humblehacker

    humblehacker New Member

    Joined:
    Apr 7, 2014
    Messages:
    16
    Likes Received:
    0
    Well Said!

    This is what I was worried about... There are so many different versions out there packaged with Ubuntu, Debian etc... Especially finding one compatible with ARM is going to be tricky. The problem is that different Home Automation platforms sometimes require different versions of Node. A lot of them get around this by offering precompiled OS Images for the RPi and occasionally the BBB. Thus far the only app with something similar available for Udoo that I've seen is Freedomotic. and thats Java-based anyway.
    There was a thread on the Udoo forums about installing the latest node.js version but its been unresolved since May- post8667.html?hilit=node.js#p8667
     
  16. dantavious

    dantavious New Member

    Joined:
    Nov 29, 2013
    Messages:
    32
    Likes Received:
    0
    Initially, those instructions did work however, subsequent attempts to get that version did not work. I had to go to each version looking for a version that not
    only compiled but executed correctly; currently 11.10 works.

    I am now attempting to learn HTML5, CSS, and Javascript because in the long run, I think it provides the best flexibility in design and upkeep choices. Just have to bite the bullet and do it. I am sure it will pay off though.
     

Share This Page