the joy of wires: an introduction to netduino , .net micro framework and the internet of things
DESCRIPTION
The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things. Iain Angus. agenda. 4. Building Blocks Digital Input / Output Analog Input / Analog Output (Pulse Width Modulation) 5. Communicating with Digital Sensors I2C / SPI - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/1.jpg)
THE JOY OF WIRES: AN INTRODUCTION TO NETDUINO, .NET
MICRO FRAMEWORK AND THE INTERNET OF THINGS
Iain Angus
![Page 2: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/2.jpg)
AGENDA 1. Introduction• .NET MicroFramework• Internet of Things•Netduino
2. Getting started Setup Fritzing Breadboards
3. Building Blocks Digital Input / Output Analog Input / Analog Output(Pulse Width Modulation)
4. Building Blocks• Digital Input / Output• Analog Input / Analog Output (Pulse
Width Modulation)
5. Communicating with Digital Sensors• I2C / SPI
6. Internet Enabled Applications• ThingSpeak
![Page 3: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/3.jpg)
EVERYTHING STARTS SOMEWHERE…
Why Netduino…
• Visual Studio IDE• Step by step
debugging• Reuse existing
skills• Low cost
electronics• Fast prototyping
![Page 4: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/4.jpg)
THE DEVICES CONTINUUMDe
vice
Cap
abili
ties
Full
Limited
LargeSmall Device Category
Windows Embedded Compact
Windows Embedded
.NET MicroFramework
.NET Framework
MCU Example: ARM7 / Cortex-M3 / SH2 ARM9 / Cortex-A8 \ARM11 / Cortex-A9 / Atom Centrino
![Page 5: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/5.jpg)
THE NETMF OPEN SOURCE PROJECT
Smallest .NET implementation Targets small 32 bit processors (ARM 7-9, Cortex M(x), Analog Devices Blackfin, Renesas SH2)
Currently used in consumer products, industrial automation, energy management, health/eldercare, and lots of new categories.
First Open Source release – Nov 2009 Apache 2.0
Community based model Motivation
Avoid fragmentation Develop a clear collaborative direction
Core Tech Team Microsoft Development Team netmf.codeplex.com netmf.com
![Page 6: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/6.jpg)
Feature Required C# Compiler
.NET Micro Framework
Required Framework Features
Generics 2.0 no Generics
Nullables 2.0 no Generics, Nullable<>
Expression trees 3.0 no Generics, Expression<>
Anonymous types 3.0 no Generics, StringBuilder
Dynamic lookup 4.0 no Generics, CallSite, Binder
Variance in generic types 4.0 no Generics
FEATURES NOT AVAILABLE IN .NET MICROFRAMEWORK
![Page 7: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/7.jpg)
THE NETMF VERSION 4.2From Microsoft Resources:
VB.NET (a collaboration) Cryptographic Primitives and Object Model Remote firmware update IL Optimizations Bug fixes SNTP
From the community: VB.NET (a collaboration) New Platform builder FTP – client (desktop compatible) and server (NETMF only)
Regular Expressions StringBuilder Type PWM and Analog/Digital Conversion Bug fixes Secure Hardware (SIM Card) drivers
![Page 8: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/8.jpg)
Physical Object+
Controller, Sensor, Actuator+
Internet=
Internet of Things
WHAT IS THE INTERNET OF THINGS?
Oxford Dictionary (noun): “A proposed development of the Internet in which everyday objects have network connectivity, allowing them to send and receive data”
![Page 9: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/9.jpg)
INTERNET OF THINGS Current Key Applications: Smart grid and energy management: utility companies can optimize delivery of energy to homes and businesses while customers can better manage energy usage.
Home and building automation: Smart homes and buildings have centralized control over virtually any device or system in a home or office, from appliances to PEV’s security systems.
Asset tracking: Enterprises, hospitals, factories and other large organizations can accurately track the locations of high-value equipment, patients, vehicles, and so on.
Health and wellness: Doctors can remotely monitor patients’ health while people can track the progress of fitness routines.
![Page 10: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/10.jpg)
WHAT IS NETDUINO? Open Source Hardware PlatformAtmel 32-bit microcontrollerSpeed: 168MHz, Cortex-M4Code Storage: 384 KBRAM: 100+ KB
Runs .NET MicroFramework Family of products:•Netduino 1, 1 plus, 2, 2 plus, mini •Netduino Go
![Page 11: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/11.jpg)
NETDUINO PROJECTS Typically consist of up to three types of components:
•Actuators – things that do stuff (act)•Sensors – things that measure (sense)•Microchips – specialised functions
Allowing you to do prototyping, robotics, automation, automotive, sequencing as well as a learning aid
![Page 12: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/12.jpg)
GETTING STARTED
![Page 13: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/13.jpg)
DEVELOPMENT ENVIRONMENT
• Netduino 2 or 2 plus• Visual Studio 2010/2012• .NET Micro Framework SDK v4.2 /
v4.3 (VS2012)• Netduino SDK v4.2.2.0 (32-bit) or Netduino SDK v4.2.2.0 (64-bit) or Netduino SDK v4.3 (VS2012)
![Page 14: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/14.jpg)
NETDUINO PLUS 2 - ON THE BOARD•LED•Button•SD card•Ethernet•Analog Pins•Digital Pins
![Page 15: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/15.jpg)
THE BREADBOARDA breadboard lets you wire electronic components without any soldering
Its holes are connected“under the hood” as shown here
![Page 16: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/16.jpg)
FRITZING
![Page 17: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/17.jpg)
BUILDING BLOCKS
![Page 18: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/18.jpg)
GENERAL PURPOSE INPUT OUTPUT (GPIO)•Digital input / output - logical 0 or 1•InputPort (Pin, Boolean, ResistorMode)•Read•OutputPort (Pin, Boolean, Boolean, ResistorMode)•Write•InterruptPort (Pin, Boolean, ResistorMode, InterruptMode)• OnInterrupt
![Page 19: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/19.jpg)
DEMO – PUSH THE BUTTONComponents used:
NetduinoPush Button220 ohm resistor x 2LED
![Page 20: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/20.jpg)
ANALOG INPUTPorts A0-A5 NetduinoAble to provide own reference voltage (Aref)10 bit ADC, value between 0 and 1023 if using SecretLabs implementation
12 bit ADC, value between 0 and 4095 if using Microsoft.SPOT implementation
Two implementations of AnalogInput class:
SecretLabsvar sensorPort = new AnalogInput(Pins.GPIO_PIN_A0);int rawValue = sensorPort.Read(); // returns count
Microsoft.SPOTvar sensorPort = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);float volts = sensorPort.Read(); // returns % max voltageint rawValue = sensorPort.ReadRaw() // returns count
May need to translate reading into meaningful value, requires reading device datasheet…
![Page 21: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/21.jpg)
ADXL335 ACCELEROMETER ANALOG SENSOR
• Sensor has a full sensing range of +/-3g – zero G approximately 1.65V with Aref 3.3V• No on-board regulation, provided power should be between 1.8 and 3.6VDC• 330 mV/G
SecretLabs implementation: 330 mV/G × (1023 ADC units) / 3300 mV = 102.3 (ADC units)/G Microsoft SPOT implementation: 330 mV/G × (4095 ADC units) / 3300 mV = 409.5 (ADC units)/G
![Page 22: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/22.jpg)
ANALOG OUTPUT (PULSE WIDTH MODULATION (PWM))
• Digital I/O Ports 5&6, 9&10• Computers can’t output analog
voltages• Only digital voltages (0 volts or
3.3V)• But you can fake it if you
average a digital signal flipping between two voltages.
• Used everywhere• Lamp dimmers, motor speed
control, power supplies, noise making
• Three characteristics of PWM signals• Pulse width range (min/max)• Pulse period
(= 1/pulses per second)• Voltage levels
(0-3.3V, for instance)
![Page 23: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/23.jpg)
DEMO – WORKING WITH ANALOG SIGNALS
Components used:
NetduinoHS-422 Servo
![Page 24: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/24.jpg)
ARE ALL PINS EQUAL?power and i/o• input: 7.5 - 12.0 VDC or
USB powered• output: 5 VDC and 3.3
VDC regulated• digital i/o are 3.3 V--but
5 V tolerant
![Page 25: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/25.jpg)
DIGITAL SENSOR
![Page 26: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/26.jpg)
DIGITAL SENSORS Inter-Integrated Circuit (I2C)• 2 wire bus (SDA/SCL)• Devices are uniquely addressable• Relatively slow
Serial Peripheral Interface Bus (SPI)• 4 wire bus (SCLK/MOSI/MISO/CS)• Fast
touch sensor
compass
fm transmitter
temperature & humidity sensor
And many others..
![Page 27: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/27.jpg)
HMC6352 DATASHEET (I2C COMPASS)
Command Byte ASCII (hex)
Response 1 Byte (binary)
Response 2 Byte (binary)
Description
S (53) SleepW (57) WakeupO (4F) S/R NowC (43) Enter user
calibration modeE (45) Exit user
calibration modeL (4C) Save Op Mode to
EEPROMA (41) MSB Data LSB Data Get data,
compensate, calculate new heading
I2C slave address :0x42(7 MSB with LSB 0 filled)
Heading mode:0 – 3599 binary format over two bytes (Tenths of a degree)
e.g. MSB: 0x0B LSB: 0x7F 0x0B7F = 2943 decimalDegrees: 294.3
Interface Commands / Responses
![Page 28: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/28.jpg)
DEMO – I2C / SPIComponents used:
NetduinoNokia 5110 LCDDS1037 Breakout BoardHMC6352
![Page 29: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/29.jpg)
CONNECTING TO THE INTERNET
![Page 30: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/30.jpg)
CONNECTING TO THE INTERNETEthernet (built-in or shield), plug it in anywhereWifi (module), configured once per locationGSM/GPRS (module), configured once, easy to use
Bluetooth (module), via GSM/GPRS/Wifi of phoneZigBee (module), via ZigBee gatewayUSB (built-in), via desktop computer
![Page 31: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/31.jpg)
IOT INFRASTRUCTURE SERVICES
Thingspeak, an open source "Xively", Twitter for devicese.g. https://thingspeak.com/channels/9
Xively (was Cosm, was Pachube), to store and reuse sensor measurementse.g. https://xively.com/feeds/116340
Twitter, allows objects to talk to humans or receive commandse.g. @twrbrdg_itself (f.k.a. @towerbridge)
Yaler, enables remote access to Internet-connected devicese.g. http://try.yaler.net/~arduino/led
ioBridgehttp://www.iobridge.com (https://realtime.io)
![Page 32: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/32.jpg)
• Platforms• Connectivity• Open Source• Commercial
• Applications• Wearable• Lifestyle• Home
• Building Blocks• Protocols• Telecoms• Hardware
![Page 33: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/33.jpg)
THINGSPEAK•Open Source API•Real-time data collection•Data processing•Data visualizations•Location-awareness•Status context•Application infrastructure•Twitter proxy•Apps•Plugins
![Page 34: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/34.jpg)
DEMO ARCHITECTURE
Sensor Actuator
HTTP://PUT HTTP://GETapi.thingspeak.com
HTTP://POST HTTP://GET
![Page 35: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/35.jpg)
ALTERATIVE ARCHITECTURE
Sensor as Server Actuator as Server
HTTP://GET HTTP://POST
api.thingspeak.com
![Page 36: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/36.jpg)
DEMO – CONNECTING TO THE CLOUD
Components used:
NetduinoTMP36Hitec HS-422 Servo
![Page 37: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/37.jpg)
USEFUL RESOURCESSecret Labs LLC http://netduino.com Forums http://forums.netduino.com Community Development Site for the .NET Micro Framework http://www.netmf.com API Reference for .NET Micro Framework http://msdn.microsoft.com/en-us/library/bb417054.aspx Adafruit http://learn.adafruit.com Sparkfun https://www.sparkfun.com/tutorials
![Page 38: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/38.jpg)
AGENT SMARTWATCH - .NET ON YOUR WRIST
Kickstarter Funded – over $1million
• 120MHz ARM Cortex-M4 processor• with secondary AVR co-processor• 1.28" Memory Display (128 x 128)• with intelligent backlighting• Anti-glare glass lens• Bluetooth 4.0 BD/EDR + LE• 3-axis accelerometer• Ambient light sensor• Vibration motor• Qi wireless charging• Water resistant (ATMs: TBD)• AGENT OS 1.0 including .NET Micro
Framework 4.3
![Page 39: The Joy of Wires: an introduction to Netduino , .NET Micro Framework and the Internet of Things](https://reader036.vdocuments.net/reader036/viewer/2022062501/568168e6550346895ddfe571/html5/thumbnails/39.jpg)
THANKS FOR LISTENING… AND QUESTIONS?