Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Server to Client Communication

Server to Client home automation WAN Netduino Plus 2

  • Please log in to reply
3 replies to this topic

#1 Afshin

Afshin

    Member

  • Members
  • PipPip
  • 18 posts
  • LocationCanada

Posted 14 July 2014 - 06:44 PM

Hi,

 

I have just started to develop a simple home-automation application using Netduino plus 2 boards. 

 

I have no problem developing a client to server application, in the case of a periodic data capturing scenario, in which the board proactively sends the captured data to a server (implemented on PC), and server replies back with some instructions according to the received data.

 

However, I wonder how it is possible to write the code for server sending instruction to clients, without clients requesting a service first and initiating the connection. This is useful for example in controlling lights. Specifically, I would like to have the control from an outside network (WAN), and not only within a LAN.

 

I have found few libraries and protocols for this purpose, like:

- SignalR which I am not sure can be supported by NetDunino board, and

- MQTT 

 

But before digging into any of them, I would like to know, if these are the best suited protocols for this purpose or if there is any other library or protocol that I need to know about. 

 

To be more specific, I am looking for a protocol/library that: 

- can be implemented on and supported by Netduino boards.

- can establish a server to client connection with no initiation of the connection by the client.

- can be implemented on a WAN.

 

Thanks  :)

 



#2 Spiked

Spiked

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

Posted 14 July 2014 - 08:18 PM

You will not, by definition, be able to achieve a server to client communication without action by the client. So I will assume you meant something slightly different.

 

MQTT is a subscribe / publish protocol.  A client subscribes to messages via a broker.  A server publishes messages via the same broker. In my case, the broker runs on the PC, but both the PC and Netduino act as clients AND servers. The PC publishes a request to do something, the Netduino listens for that and acts accordingly. And the Netduino publishes sensor telemetry, and the PC listens for that. 

 

Since MQTT is ethernet based, your broker would need to be internet facing in order to send messages from WAN (assuming that means internet). The broker to Netduino connection would not need to be internet facing.

 

I have used 

http://code.msdn.mic...ibrary-ac6d3858

https://m2mqtt.codeplex.com/

http://knolleary.net...lient-for-mqtt/  (arduino)

 

and for a broker 

http://mosquitto.org/

 

All have been very easy to use.



#3 jrlyman3

jrlyman3

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts
  • LocationNorth St Paul. MN

Posted 16 July 2014 - 02:39 AM

I guess that depends on how you define client and server :).

 

In my home automation system (just monitoring so far), the server is written in Java and runs on a Windows PC.  It monitors a collection of 1-wire sensors directly and it talks to a Netduino Plus (NP1) over ethernet that monitors my boiler, water header, and garage door (more to come).  The server configuration includes the IP address of the sensor client.  The server connects to the sensor client and asks for sensor data once per minute.  I plan to implement a locator protocol but haven't had time yet.  I have to admit that in this configuration the sensor client is really acting as a server ... but it all depends on how you look at it.

 

There are also user interface (UI) clients that connect to the server and subscribe to a data feed, which results in the client getting sensor data once per minute which it displays for the user (me).  I use some old laptops (one upstairs and one downstairs) as the UI clients, they make a great graphic display, and they were basically free.

 

I like to implement my own networking code, I've been thinking that I should try to come up with a simple system that could be easily extended for typical network sensors.  Maybe this fall I'll have time to do that.

 

Good luck, with your home automation.

 

John



#4 KiwiDev

KiwiDev

    Advanced Member

  • Members
  • PipPipPip
  • 100 posts
  • LocationNew Zealand

Posted 16 July 2014 - 11:10 AM

Hi,

 

I have built a home automation concept for a presentation using Xively, and KittyHawkMQ NetMF. The Netduino based system collected temperature, and power consumption data and uploaded it to Xively for display and storage.

 

For some other projects I have devices which upload data using the Xively REST API or Xively MQTT.

 

The MQTT connected devices publish data and some subscribe to publications for local control.

 

I used an Energy Monitor Shield purchased from Elecrow for measuring power consumption. The shield needs some simple mods detailed here for it to work on a 3v3 Netduino device. This shield has 2 buttons and a Nokia 5110 display for a UI and a nRF24L01 wireless module for connectivity.

 

The temperature monitoring node uses DSC18B20 One wire temperature sensors and nRF2L401 shield from Embedded Coolness to transmit data to the base station.

 

The base station uses another embedded coolness shield and a Netduino Plus 2 as a gateway to Xively.

 

Hope this helps

 

Bryn







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.