More details about this project can be found at http://www.protosystem.net/post/2011/07/02/Lawn-Sprinkler-the-Introduction-Part-1.aspx
This is a Lawn Sprinkler that is built using a Netduino Plus, Azure Service Bus and a Windows Phone 7. Since this application
uses the Windows Azure AppFabric Service Bus you will need to sign up for an Azure account. You will also need to install
the Azure tools and SDK so head on over to http://www.microsoft.com/windowsazure/ if you don't have the Sept 2011 SDK before
you try and compile and use this application.
1) You already installed the Azure Sep 2011 SDK
2) You signed up for an Azure Account
3) Log into the Azure Portal
4) Go to the Service Bus area of the portal and create a New Service Namespace
At this point you have the service bus ready for messages but you will need to configure a few things in order to connect to
the service bus.
5) In Visual Studio right click on the HomeAutomation.HomeConnector.Host project and select Debug -> Start new instance
6) When the console application runs it should tell you that you need to edit the info.config
6.1) The Home Connector console app created a file called info.config for you in the Output\HomeConnector directory
7) You need to edit the info.config file and change the ServiceBusNamespace and ServiceBusIssuerSecret
7.1) The namespace is the same one you created in step 4 above
7.2) The Service Bus Issuer Secret can be found in the service bus portal properties under "Default Key"
8) Run the HomeAutomation.HomeConnector.Host project again and the host should start without any errors. If that's the case
then you are connected to the service bus.
9) Copy the info.config from the Output\HomeConnector folder to the following destinations:
10) The IP address of the sprinkler needs to be set in the HomeAutomation.Sprinkler.MessageProcessor.SprinklerMessageProcessor.cs file
10.1) i.e. private string _ip = "192.168.1.5"; // Change this for your Netduino Plus IP Address
11) Deploy the Netduino.Sprinkler application to the Netduino Plus
At this point you should be able to run the Output\HomeConnector\hc.exe application and run the Output\SprinklerClient\sc.exe
application and the Sprinkler Client should be able to interact with the sprinkler. This sprinkler client strictly uses the
AppFabric service bus to communicate with the Netduino.
To get the Windows Phone to communicate with the sprinkler you need to deploy the HomeAutomation.RemoteConnector.Web application
to a public facing asp.net web host provider. Or you can deploy the web site to an Azure WebRole. In either case you will need
to make sure the web.config is changed to allow for service model binding extensions that are required for the service bus
12) Uncomment the binding extensions in the web.config (if it is commented out)
13) Deploy the HomeAutomation.RemoteConnector.Web project to the Azure WebRole or your hosting provider.
14) To test that the web application can connect to the service bus and talk to the sprinkler do the following:
14.1) Make sure the netduino is running the sprinkler code
14.2) Make sure the Output\HomeConnector\hc.exe console application is running
14.3) Open up a browser and navigate to the URL http://YourWebsiteRootUrl/sprinkler/status
14.4) You should be prompted to save the results of the request to a file, so do that.
14.5) Open up the file and you should see the JSON that makes up the status of the sprinkler
15) Change the base url in the HomeAutomation.Sprinkler.Phone.Models.SprinklerModel.cs file
15.1) private string _baseUrl = "http://YourWebsiteRootUrl/"; // Change this to match your web site
16) Compile the HomeAutomation.Sprinkler.Phone project and deploy it to the phone.
You should be able to use your phone to control the lawn sprinkler now