Download presentation
Presentation is loading. Please wait.
1
with Netduino, Windows Azure Service Bus, and Windows Phone 7 By Mike Linnen
2
Blog: http://www.protosystem.nethttp://www.protosystem.net Twitter: @mlinnen Email: mlinnen@protosystem.net
3
Home Automation Vision Netduino Azure AppFabric Service Bus Windows Phone 7 What’s Next
5
Replace legacy sprinkler Current system is overly complicated Conserve on Water Never have to worry about setting the clock Remotely control the sprinkler
7
Manual operation of Sprinkler Windows Phone 7 operation of Sprinkler Weather Service Sprinkler Scheduled to go on but rain is in the forecast Sprinkler Scheduled to go on but rain is not in the forecast Time Service Powershell
10
Alarm Clock
12
http://www.netduino.com/ Open-source Hardware Open-source.Net Micro Framework 4.1 Released 4.2 Beta Atmel based processor 3 Products Netduino – Pin compatible with Arduino Netduino Plus – Pin compatible with Arduino Netduino Mini – Pin compatible with BS2
13
Use Arduino Shields to bolt on hardware solutions Stackable Shields Prototype/Breadboard Shield Data logging Shield Ethernet Shield Motor Shield Relay Shield Build your own Shield Joystick Shield
14
Speed48 mhz Flash Memory128 kb Ram60 kb Digital I/O20 Interrupts20 Analog6 x 10 bit PWM4 x 16 bit I2C1 SPI1 EthernetNo SD CardNo USB1 Serial2 x TTL User LED1 User Switch1
15
Speed48 mhz Flash Memory 64 kb Ram28 kb Digital I/O20 Interrupts20 Analog6 x 10 bit PWM4 x 16 bit I2C1 SPI1 Ethernet1 10/100 SD Card1 Micro SD USB1 Serial2 x TTL User LED1 User Switch1
16
Speed48 mhz Flash Memory 152 kb Ram64 kb Digital I/O16 Interrupts16 Analog4 x 10 bit PWM4 x 16 bit I2C1 SPI1 EthernetNo SD CardNo USBNo Serial1 x TTL 1 x RS232 User LEDNo User SwitchNo
17
One language (C# or VB.Net) across all devices Visual Studio IDE Unit Testing or SpecFlow Debug code that is running on the device Mostly compatible with Arduino Shields
21
Pull Down Resistor Added
22
3.3 Volts 5 Volts 1.2 Volts 5 – 3.3 = 1.7
24
Arduino focused resources Ladyada http://bit.ly/4JuEvRhttp://bit.ly/4JuEvR Tronixstuff http://bit.ly/donqS6http://bit.ly/donqS6
25
Getting Started with the Internet of Things http://oreilly.com/catalog/0636920013037 http://oreilly.com/catalog/0636920013037 Netduino Forums http://netduinohelpers.codeplex.com/ http://netduinohelpers.codeplex.com/ Expert.Net Micro Framework Apres
26
Local parts Radio shack Frys Electronics (off of 85 on the way to Atlanta) Jameco http://www.jameco.comhttp://www.jameco.com Digikey http://www.digikey.com/http://www.digikey.com/ Adafruit http://www.adafruit.com/http://www.adafruit.com/ Sparkfun http://www.sparkfun.com/http://www.sparkfun.com/ Servo City http://www.servocity.com/http://www.servocity.com/ MakerShed http://www.makershed.com/http://www.makershed.com/
27
Opensource Breadboard wiring Schematic Drawing Printed Circuit Board Design
28
Create a breadboard design Review the schematic Review the Printed Circuit Board design
29
http://netmf.com/gadgeteer/
31
Launch the Sprinkler Set breakpoints Walk through code
32
Unit Testing Mocking SpecFlow Integration Testing (Skip)
33
Limited options for.Net MF Nunitlite http://nunitlite.com/http://nunitlite.com/ Current Release 0.5 .Net MF Support coming in 0.9 Nunit (or any other testing framework) Using Linked files My Blog Post http://bit.ly/dM9nlfhttp://bit.ly/dM9nlf Moq (or any mocking framework) SpecFlow (or any BDD framework)
34
Unit Tests SpecFlow Mocks Integration Tests
35
Project structure for Netduino code Unit Testing Harness Link files SpecFlow execution Code Coverage Execution
36
Web Server Sprinkler Scheduler
38
Service Bus Host Message Processors
39
Service Registry (naming and discovery) Message Buffer (no reliability guarantees) Remoting HTTP REST Capable Traverses Firewall Expose on Premise Web Services or Data
40
Reliable Message Delivery Load Balancing/Partitioning Queues (deprecating Message Buffers) REST interface Groups, Sessions, Dead-lettering, No TTL 1 GB Queue and 256 k Message Size Topics Publish/Subscribe Subscriptions can have Filters and Actions Multiple Subscribers Relies on AppFabric Access Control for securing endpoints Claims based security
41
PTOPIC S S S C C C C C
42
Azure Cost Calculator http://bit.ly/m9xGfzhttp://bit.ly/m9xGfz NOTE: This info might not be up to date $3.99 per connection on a “pay-as-you-go” basis (max # connections in a day) Pack of 5 connections $9.95 Pack of 25 connections $49.75 Pack of 100 connections $199.00 Pack of 500 connections $995.00
44
http://www.microsoft.com/windowsazure/sdk / Access Control Service Bus Caching
46
Sign up (use your MSDN) Access the Azure Management Portal Create a Service Namespace Get your Default Key
47
3 Simple Steps 1. Define the Service Contract What do you want to expose over the SB? 2. Implement the SC 3. Host the Service Done!!! Note: app.config
48
Forwards messages to specific devices 1 or more devices might receive the same message Example: Set Clock goes to sprinkler and alarm clock Service Bus ConfigurationRepository places sensitive connection info in a runtime file to keep it out of source control Needs more work to be a Pub/Sub model
49
HTTP/JSON Service Bus Client
50
Why? Service Bus cannot be used directly on WP 7 Maybe Message Buffer REST API? More Clients (like iPhone or Android) Expose Service Bus using HTTP REST Intro to RemoteConnector.Web Simple JSON msg processor that calls the Service Bus Can be hosted multiple ways Azure Self Host Shared Hosting Provider
51
https://github.com/NancyFx/Nancy https://github.com/NancyFx/Nancy Alternative Light weight Web Framework Can be used in place of ASP.NET MVC Is not dependent on ASP.NET Easy to get up and running fast Easy to configure routes
52
Sprinkler Status via Browser Review the SprinklerModule and NancyFX Review how the Service Bus is called Show Web.Config bindingExtensions are required when AppFabric SDK is not installed
53
Sends HTTP Requests to the RemoteConnector Web Site HttpWebRequest Uses Caliburn Micro as the MVVM Framework Watch out for web request/response caching Your request to the RemoteConnector will be cached on the phone if you don’t change query string parms for every request. Keep the messages small
54
Cloud Services Date Time Weather
55
Get’s the current time Sends the time via Service Bus
56
Gets the current weather forecast Sends the forecast via Service Bus
57
Show MessageBusClient Show Sprinkler.ConsoleClient Show App.Config bindingExtensions are required when AppFabric SDK is not installed
58
JSON Parsing between.Net Frameworks DateTime in particular Instead of using native DateTime I used a string with a special format MF JSON parsing is painful Look at http://netduinohelpers.codeplex.com/ for a better solutionhttp://netduinohelpers.codeplex.com/ Figuring out WP 7 UI Design Getting the Service Bus working on a Non Development machine. Config settings Building a stand alone sprinkler complete with an LCD and Keyboard and all the menus associated with it for setting up the schedule
59
Getting the Service bus going in Development Nancy as a Web Framework Debugging Sprinkler Code on Netduino as opposed to other embedded alternatives Having Unit Tests and SpecFlow Tests for the Sprinkler
60
Simplify Embedded Logic Scheduling
61
Changing software on the embedded device is time consuming This is especially true after the device is deployed Complex business logic is easier to do in the Full.Net Framework The scheduling logic could be enhanced to support a lot more options The scheduling service could be used by other Home Automation Enthusiasts
62
Secure the communications Install the sprinkler and let it run Remove the continuous DateTime updates The sprinkler should be able to request DateTime update on power up The service sends the update less frequently and only when daylight savings changes Remove the continuous Weather updates The sprinkler should be able to request the forecast update on power up The weather service should send new forecast when it changes
63
YOU CAN DO IT! https://bitbucket.org/mlinnen/lawnsprinkler http://www.protosystem.net/
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.