Author Topic: Home automation with Moteino & MQTT  (Read 28056 times)

Fwessels

  • NewMember
  • *
  • Posts: 9
Home automation with Moteino & MQTT
« on: June 29, 2014, 01:59:08 AM »
Hi  I would like to use the Moteino in my home automation project and I want to use MQTT as the communication protocol. The great thing about MQTT you can then integrated the  Moteino into any open source home automation platform like Openhab, Openremote, PiDome any system that use MQTT.  My question is how do I get the Moteino to communicate to MQTT? Please note I am still very new to arduino and programing.


Thanks

Francois




« Last Edit: June 30, 2014, 10:58:13 AM by Felix »

bobleponge

  • NewMember
  • *
  • Posts: 8
Re: Home automation with Moteino
« Reply #1 on: June 30, 2014, 10:47:29 AM »
I was not aware of MQTT before your post. I've downloaded their specification (MQTT-SN), and it seems the protocol is very clunky. They waste space in every byte they send, requires the gateway to store an unlimited amount of data for the nodes -- forget using a moteino for the GW, and they expect very precise timing between nodes.
 
Typically, instead of storing a message for a sleeping node, and react when it wakes up, it's up to the node to tell how long it's going to sleep, and the expectation is that both the GW and node have the same clock, so the GW consider the node lost if it can't send the pending msg to the node after the sleeping time. If the node wake up early (interruption, shorter clock, brown out/watchdog), then it has to first ping the GW, pop all the pending messages, and then send the interruption message.

I think you can probably find a library that could compile on Arduino, but it means that the entry point on your wireless network will have to be large.
Depending on the complexity of your intend, you better learn from scratch, and make you simple installation simple, you'll probably get more internal reward from this.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Home automation with Moteino
« Reply #2 on: June 30, 2014, 10:58:00 AM »
I will back bobleponge.
Sounds terribly complicated. Home automation can't be that complicated, in fact i will say it's forbidden to be that complicated.
I want nodes to be as autonomous and flexible as possible.

Fwessels

  • NewMember
  • *
  • Posts: 9
Re: Home automation with Moteino & MQTT
« Reply #3 on: June 30, 2014, 12:24:19 PM »
There is a MQTT library for  arduino done by Nick Of leary  http://knolleary.net/arduino-client-for-mqtt.

I agree it should be easy and simple to integrate devices into  home automation system. I just battle see what is the easy way off doing this.  There is a lot of talk about the Internet of things and I  would like to use the Moteino as my base for this. What I read on your Web site the Moteino is low power and  by using  the rfm69  I don't have to run any wires to communicate to any of the sensor. Your Moteino must cheaper than the Zwave or Xbee. I like what you have done with the Switchmote.  So the question is how do we put this all together in home automation systems from monitoring water usage, power usage  trigger events etc.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Home automation with Moteino & MQTT
« Reply #4 on: June 30, 2014, 12:46:55 PM »
There is a MQTT library for  arduino done by Nick Of leary  http://knolleary.net/arduino-client-for-mqtt.

I agree it should be easy and simple to integrate devices into  home automation system. I just battle see what is the easy way off doing this.  There is a lot of talk about the Internet of things and I  would like to use the Moteino as my base for this. What I read on your Web site the Moteino is low power and  by using  the rfm69  I don't have to run any wires to communicate to any of the sensor. Your Moteino must cheaper than the Zwave or Xbee. I like what you have done with the Switchmote.  So the question is how do we put this all together in home automation systems from monitoring water usage, power usage  trigger events etc.
I am racing towards the same goal. I have a version of this working, but it's not ready for release. It needs to be prettied up, refactored and more functionality added.

KanyonKris

  • Full Member
  • ***
  • Posts: 113
Re: Home automation with Moteino & MQTT
« Reply #5 on: June 30, 2014, 03:14:40 PM »
If you have a fairly powerful gateway (ie Raspberry Pi), perhaps it could run a MQTT front end program that exposes the remote nodes as MQTT devices but actually uses a lighter weight protocol to do the actual wireless communication with the nodes. I agree that MQTT to the remote nodes doesn't make sense when low power is a priority.

Fwessels

  • NewMember
  • *
  • Posts: 9
Re: Home automation with Moteino & MQTT
« Reply #6 on: July 01, 2014, 10:32:04 AM »
I came across this web site where he is using MQTT and the RFM69 to communicate to Openhab.

http://electronichamsters.wordpress.com/2014/06/09/home-automation-with-arduino-and-openhab/


Yes you cannot put MQTT on any of the sensors you will have to put it on a gateway of some sort.



Jasonhector

  • NewMember
  • *
  • Posts: 12
Re: Home automation with Moteino & MQTT
« Reply #7 on: August 28, 2014, 03:59:31 PM »
I am running modified jeenodes (emontx units from openenergymonitor) with mqttsn over rfm12b radios back to openhab. I use the RSMB MQTT broker on a rpi with Rfm12pi module on the gpio. I had to modify a mqtt-sn library for arduino and developed a mote lib as we'll for managing io changes. The mqttsn lib uses the jeenode lib.
I still need to. Upload the code but the wiki is populated: https://github.com/jasonhector/Mqttsn-Mote-Library
I'm buying some moteinos and porting to this hardware platform, but still plan to use mqtt and openhab.
I also am monitoring my energy usage with ct's and using mega2560 and enj Ethernet to publish mqtt messages on my wired Ethernet network. I hacked emoncms from openenergymonitor to receive mqtt messages. Also reading my paradox alarm for events and publishing those via mqtt as well. Openhab is the ultimate receiver of all mqtt messages from the wired, wifi or rfm radio network.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Home automation with Moteino & MQTT
« Reply #8 on: August 30, 2014, 09:31:48 PM »
Jason, that's pretty cool, thanks. Will be great to follow your progress if you want to share any of that in this forum.

Jasonhector

  • NewMember
  • *
  • Posts: 12
Re: Home automation with Moteino & MQTT
« Reply #9 on: August 31, 2014, 04:30:05 PM »
Sure, No Problem sharing. Not sure which parts are worth sharing, but Im happy to contribute where possible.

sumnerboy

  • NewMember
  • *
  • Posts: 6
Re: Home automation with Moteino & MQTT
« Reply #10 on: September 07, 2014, 11:59:58 PM »
Hey Jason - you sound like you have a very similar setup to me. I am running openHAB and EmonCMS. I am just starting with Moteinos to build a cheap/wireless sensor network. I have an Arduino ethernet clone connected to one Moteino (via I2C) which acts as the gateway from the Moteino RF network to my MQTT broker.

I also have an EmonTX shield sitting on another Arduino ethernet clone, which posts MQTT messages for energy readings. I haven't been able to hack EmonCMS however to accept MQTT directly. I have had to use mqttwarn (https://github.com/jpmens/mqttwarn) to transform the MQTT payloads to HTTP GETs for EmonCMS. Would you care to share how you configured EmonCMS?

I am using the PubSubClient (http://knolleary.net/arduino-client-for-mqtt/) for all my Arduino based MQTT publishing.

dom67911

  • NewMember
  • *
  • Posts: 26
Re: Home automation with Moteino & MQTT
« Reply #11 on: September 10, 2014, 01:54:22 PM »
How are you guys reading the energy consumption? As far as I know there are only two ways.

1. Place a sensor over an analog electricity meter's dial and count the turns of that black line
2. Place a magnetic coil (I forgot the name) over the main electricity wires coming from the street.

For 1, I'm struggling to find a sensor that works. Yet to try the ones used by line following robots.
For 2, I'm struggling to risk electrocution by opening the main 200W panel and placing those coils around them.

How are you guys doing it?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Home automation with Moteino & MQTT
« Reply #12 on: September 10, 2014, 02:27:51 PM »
The guys at OpenEnergyMonitor simply use split core current transducers they place around the mains wires to get current, and they measure the voltage from a 9V transformer. Not very ideal and there are many assumptions, but it gives you a ballpark of what's going on in your house.
To get a REAL reading you need an integrator chip that is dedicated for energy measurement. Such as the analog devices ADE series of chips. I used ADE7758 for 3 phase, ADE7753 and ADE 7763. They work well but are tricky to setup. Also they still use split coils but also work with rogowsky coils. To get accurate readings you have to get more expensive commercial grade split coils. The non-spit coils will always be more accurate, but they are more difficult to install since you have to disconnect the mains cables coming in, insert the coils, then reconnect. Doable, but if you're not mastering mains you should not do it, you can die :)

ColinR

  • Full Member
  • ***
  • Posts: 176
Re: Home automation with Moteino & MQTT
« Reply #13 on: September 10, 2014, 03:10:52 PM »
This is the reason that people transduce the dial movement - you need to clamp either line OR neutral to get a reading from your CT, which means modifying your device or digging in your panel (or otherwise getting creative).

C
CuPID Controls :: Open Source browser-based sensor and device control
Interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

kiwisincebirth

  • Jr. Member
  • **
  • Posts: 69
Re: Home automation with Moteino & MQTT
« Reply #14 on: September 11, 2014, 01:47:15 AM »
Hi There, I though I would share my "early days" home automation setup:

1. Moteino Sensors (Battery Powered), broadcasting periodic sensor readings
2. Raspberry PI running standard Raspbian OS containing the following:
    2a. USB (Serially Connected) Moteino, that relay messages from RFM69 to Serial Port
    2b. Node-RED, Just acts as a gateway receiving messages (Serial) from the Moteino sending to MQTT Queue
3. Small Debian “Virtual” Server  containing the following:
    3a. MQTT (Mosquitto) installed to act as message Broker
    3b. Node-RED, receives messages from MQTT, and broadcasts to Emon CMS, although this functionality can be extended to provide any number of functions. This is the main controller.
    3c. Emon CMS for displaying data

In my setup, I am using a small Debian “Virtual” Server. The reason is it provides a level of quality of service (backups etc), but everything on here could be run just as easily on the PI