Presentation on theme: "Enabling the Internet of Things Short Range Wireless and M2M."— Presentation transcript:
Enabling the Internet of Things Short Range Wireless and M2M
Our Expertise Intelligent Embedded Wireless Communications Bluetooth, 802.11, 802.15.4 (ZigBee), Wibree Wireless agnostic scripting language Middleware and Data Synchronisation Low Power, High Efficiency Modules
Serving an embedded market Built in internet connectivity Expertise in Automotive, Medical and Retail Integrated Protocol stacks and protocol conversion Fast time to market Enabling over 5 million credit card transactions daily
Things just want to connect… My temperature is… Your Blood Pressure is… I’ve just driven… I’ve copied… I can see… I’ve sold… Now there’s an easy, wireless way to do it.
The Internet of Things +“Thing”+ Internet = M2M Welcome to the world of Cellular-Free communications.
“Things” are “Host-free” Most machines have very limited host processing capability. Using External Processors mean more power, more cost, greater time- to-market and the need for expensive programming resource. The Internet of Things need wireless processors that do everything. EZURiO provides everything you need in one module.
What Designers Ask These are the Key Features for “Time to Market” EZURiO Does it wake up and take control? Can it find and connect to an access point? Can it tell the middleware its IP address? Can it store read and data from sensors? Can I get rid of an additional processor? Can it run a user program? Can it be programmed with simple tools?
All you need in one package EZURiO SolutionUser accessible processor Scripting Language Integrated Antenna Easy to integrate Module802.11b/g Web Server I/O and ADC GeneralPhysical Size v. Small Bluetooth Compatible Simple Software Development Tools PerformancePower Consumption Low Power Save Modes EZURiO modules are pin compatible with Siemens GPRS MC55/56
Enabling your “Thing” Serial In >>> Wireless Out No host processing requirements – just send simple commands Integrated 802.11 driver gives silicon independence Integrated Bluetooth or TCP/IP stack Access to I/O and ADC AT Interface (Bluetooth) Interpreter (802.11) to run scripts for data acquisition and wireless attachment RS-232 Data & Commands RF
What’s in an EZURiO Module? RAM ARM Processor + UW UART Power Management 802.11 b/g Flash I/O Connection Scripting Event Handling
Non-volatile Memory Our Module Architecture ADCDACGPIOHigh Speed UART I/O Controller UNIVERSAL WIRELESS Scripting Interpreter Web Server Wireless Protocol Stack (TCP/IP + Driver) Baseband Radio AES Program Memory UWScripts 128 bit Encryption WEP / WPA Compare “Standard” Wireless Module Everything you need is in one module – it really is “Serial In >>> Wireless Out” Flash Filing System
802.11b & g channels US 11 channels EU 13 channels Japan 14 channels Channel Spacing – 5MHz Cells (access points) can overlap as long as the transmitter in one does not result in overload in the adjacent cell. This means the channels selected should be 25MHz apart. 1 6 11 1 1 6 802.11 b & g operate at 2.4GHz – the same frequency band as Bluetooth and ZigBee. The spectrum is divided into multiple channels, spaced 5MHz apart. Access Points operate on a fixed, selected channel using DSSS. They do not frequency hop. There is NO channel width specified, but a spectral mask of -30dm @ + 11MHz
802.11 Architecture - Infrastructure BSSID - Unique Name – MAC Address SSID – Access Point Name BSS Type – Infrastructure Mode “Clients” ASSOCIATE with Access Points. All 802.11 devices have a unique 48 bit MAC address. If Access Points have the same SSID and are connected to a backbone, then clients can ROAM between them. Clients Access Point Infrastructure Mode
802.11 Architecture – Ad-hoc The Client starting the ad-hoc network acts as the “Access Point” to which other clients connect. Devices can either connect in Infrastructure or ad-hoc mode. They cannot do both simultaneously. Ad-hoc mode does not support Power Saving modes. Ad-hoc is also known as IBSS (Independent Basic Service Set) First ClientClients Ad-hoc Mode
Data Packets HeaderSource Address Destination Address SSID Address PayloadFrame Check Simplified 802.11 packet HeaderDestination Address Source Address DataFrame Check Symbol RateCoding 802.11g 5464QAM 4864QAM 3616QAM 2416QAM 18QPSK 12QPSK 802.11b 11CCK 802.11g 9BPSK 6 802.11b 5.5CCK 2DQPSK 1DBSPK Only a relatively small part of each transmitted packet contains data. A lot of the transmitted information is concerned with routing information, protocols and integrity checking. The data rate is shared between all connected clients. Real Data throughputs never match symbol rates.
802.11 Range and Throughput Range and throughput are closely linked – the more complex the coding scheme, the shorter the range. Range (m)Throughput (Mbps) Symbol Rate
Throughput & Latency Throughput and latency are not related. They rarely go together Decide what is important: –Latency –Reliability (QoS) –Raw Data Rate Quoted data rates rarely reflect reality –They are symbol rates –They include packet overheads –They are relevant at short range in a lab environment The wireless industry loves “go-faster stripes”. Real applications rarely need high data rates. Don’t be sucked into the hype. Most M2M applications can only handle rates of around 115kbps at their interfaces. However, the data may travel over the air at a much higher rate, reducing the power consumption.
Universal Wireless The Wireless Development Platform Tim Wheatley - VP Engineering
What is Universal Wireless? Allows HOSTLESS application development Sophisticated web server integration allows machines to have a web presence Enables rapid application prototyping and demonstration A complete wireless application development platform Compatibility across Ezurio modules Not just a wireless module!
Basic Use of the Module The WISM Development Platform The WISM file system Immediate mode commands –at i 3 –at+dir –at+del –at+run –Using the !function_name() syntax –!_flashdel() Using the UWTerminal Application –Downloading new scripts –Downloading web pages
Wireless OBD Interface Cable replacement……. Application complete! WLAN Module programmed to automatically attach to AP and PC and transfer data Uses a commercial OBD scan tool (Gendan) with unmodified Gendan EngineCheck firmware No additional microcontroller is needed to manage the application – UW does it all. Based on examples, the complete application takes only a few hours to complete!
Wireless OBD Interface Intelligent cable replacement…… Application complete! WLAN Module retrieves the data from the machine, processes it and only reports key information WISM module actively participates in the data gathering and display No additional microcontroller is needed to manage the application – UW does it all. Based on examples, the complete application takes only a few hours to complete!
SMTP Client Interface Implementation of a protocol in UWScript Also shows the use of a custom command interface WLAN module is programmed with comms related applications to remove the load from the host processor Demonstrates the ability of the module to act as a ‘communication co- processor’ Command interface is tailored to the application – high and low level functions Module could be made to emulate legacy solutions
Powersaving Powersave Mode 0 –No power saving enabled Powersave Mode 1 –IEEE powersaving enabled Powersave Mode 5 –WLAN disabled, CPU active Powersave Mode 6 –WLAN disabled, CPU sleeping
Firmware Upload Uploading firmware is managed by the UWLoad.exe executable. UWLoad.exe executable and sectormap.ini file must exist in same directory Set up correct port number for UWLoad (using command line parameter com=n) Reset the module when prompted. Select the firmware file to load. Firmware update will happen automatically.
Firmware Upload Tutorial Unzip the firmware and UWLoad tool from the UW_rash_2 0 1 1_Full_Delivery.zip and UWLoad.zip file respectively. Setup a shortcut to the UWLoad.exe file. Right click on the shortcut and set the command line parameter com=n from the ‘properties’. Run UWLoad.exe Select ‘Load’ Reset the module Select the UW_rash_184.108.40.206.s file Firmware upgrade should complete automatically.
Internet Addressing Each node on the network has an IP address –E.g 192.168.1.1, 220.127.116.11 Statically or dynamically allocated (DHCP) IP packets contain source address and destination address. –Destination addresses ensure that packets reach the final destination –Source address ensure that responses reach the originator IP addresses can change many times as a packet passes across the network –This is transparent to the user!
Physical Addressing Each physical device on the network has a hardware address (MAC address) The MAC address is used either by the hardware interface or by the driver to identify ‘interesting’ packets Interesting packets are passed up the stack for further processing. Packets are addressed by both physical and IP addresses. Mapping between physical / IP addresses is handled by ARP protocol.
Ports Many applications can be implemented that use the underlying TCP/IP stack structure. Applications are identified by port numbers There are many pre-allocated port numbers for well known applications –80 – HTTP –21 – FTP –25 – SMTP ‘User’ port numbers can lie in the range 1024 – 65535
Internet Protocol (IP) Deals with delivery of a payload to the destination Supplies source and destination addresses Specifies type of service – which defines how the packet is routed Packet delivery is not guaranteed Works packet by packet – no concept of a connection Packet ordering is not guaranteed Higher layer protocols must deal with this…..
Transmission Control Protocol (TCP) Provides –Reliable stream delivery of ordered data –Virtual circuit connections –Full duplex connections A connection is defined by a pair of end points –An endpoint is a (host, port) pair –eg18.104.22.168., 1876 22.214.171.124, 345 Connection establishment is by three way handshake Connection terminates by a modified three way handshake –Asymmetric release –Symmetric release
Address Resolution Protocol IP address must map onto physical address Host must somehow discover the physical address of a target host on the same network given the target’s IP address ARP –Host broadcast ARP request containing target IP address –Target responds with ARP reply containing physical address Machines cache IP to physical address bindings –Broadcast is expensive –A cache prevents frequent broadcast –Entries must be removed after a fixed time to enable replacement of hardware
Dynamic Host Configuration Protocol (DHCP) Main application of DHCP is distribution of IP addresses Used by the module to request and obtain a dynamic IP address from the router (access point). Also used to provide gateway mask, gateway IP address and primary and secondary DNS IP addresses. Typically runs immediately after physical connection is established with the router (i.e after attaching to the AP).
Client Server Model TCP/IP networking operates on a client server model. One end operates as a server –Offers a service to clients –Example is a web server One or more clients makes contact with the server and uses the service.
Sockets (1) A socket is used to establish a data connection between two devices. Uses the client / server model Analagous to making a telephone call to a business –Client calls the switchboard number for the business –Switchboard operator answers the call –Call is put through to an extension for the call to be handled –Switchboard returns to listening out for more clients to call in. The ‘telephone number’ of the server is the IP address and the port number –192.168.1.1:1056 Typically the server will hand the connection to another port for the remainder of the call
Sockets (4) Stages in creating socket: –Server: Create socket Bind socket to the listening port number Listen on the socket Accept incoming connections from clients –Client: Create socket Connect socket to server
Interactive Mode When the module is not running a script Simple AT commands allow file manipulation UW commands can be run in interactive mode at+dir: display files at+run: run named script at i n: display version information at+cmp: Start / end script compilation at+del: delete named script
UW Language Basics UW is a basic-like programming language Scripts are simple text files UwTerminal application is provided to Simplify the development process autorun script – if present is run automatically on power on Factory default script – installed at the factory, runs on power on – cannot be changed.
Universal Wireless Language Overview Tim Wheatley - VP Engineering
UW Concepts - Streams Manage the flow of data around the module Data devices act as data source / sinks –E.g UART, UW script, TCP socket Bridge connects data source with a data sink and vice- versa Currently bridges are always 2-way i.e both data source and data sink are connected Provides flexibility for future expansion –Other data devices could be created – CAN bus, files, ADC for example
By default a UW script creates one data device –stdout: All output created by print is sent to stdout –stdin: Input to the script is read from stdin After reset, stdin and stdout are bridged to the UART data device.
UW Concepts – Events (1) Events are asynchronous inputs to a UWScript Avoid the need for polling in scripts –Waitevent – tests in an ‘infinite loop’ or until an event handler returns 0 –pollevent When an event occurs a pre-installed handler is called –onevent evstdin call stdin_handler
UW Concepts – Events (2) Supported events are: –EVSTDIN: Data has arrived on stdin –EVRXBRKON: Break condition on UART detected –EVRXBRKOFF: Break condition on UART released –EVWEB: Web server has generated event –EVSEARCH: Access point search is complete –EVSOCKETCLOSE: Socket has been closed –EVLINK: Change in WLAN link status
UW Concepts – Events (3) Examples of event use: –Detecting a break condition on the UART to interrupt a data connection. –Detecting a change in the WLAN link status (loss of connection for example) and taking appropriate remedial action. –Detecting a socket being closed by the remote end allowing a clean socket close at the module.
UW Concepts – Web Server (1) WISM web server is fully integrated with UW scripts Allows a UW script to generate dynamic web content – –Anything in quotes is passed to the script as part of a EVWEB event –Script writes HTML strings that are dynamically inserted into the web page using webecho command
UW Concepts – Web Server (2) Forms posted from the web browser are passed to the script for processing –Allows the user to interact with the script –Forms are passed as a list of parameter / values –Script interprets parameter and acts on the basis of value
Tutorial 2 – Cable Replacement Navigate to Tutorials directory Download script file ‘tutorial_2.uws’ This script establishes a TCP server on port number 1000 Run the script Wait until the IP address for the module is reported Open another UWTerminal session Select the TCP Socket option Enter the IP address of the module and the port number Verify that the connection is made and that characters can be transferred.
Variable Declaration Types are: uword, sword ulong, slong string Declaration syntax: uword uwValue1 slong slReturn string stIpString Variable declarations can be anywhere in a script – but variables must be declared before use
Variable Scope Global: variables are declared in the main body of the script Local: Variables are declared in a subroutine or function Super Global Variables: Declared outside the script and last all the time the module is on.
Variable Casting Sometimes a variable of one type needs to be made into another type e.g. if a routine returns a variable of one type which is then used as a parameter for another. xxCASTyy() – converts a variable of type yy to type xx e.g uwVar = uwCASTsl(slVar) converts a signed long into a unsigned integer
Expressions * Multiply / Divide % Modulus + Addition - Subtraction > Arithmetic Shift Right Greater Than >= Greater Than Or Equal == Equal To != Not Equal To & Bitwise AND ^ Bitwise XOR (exclusive OR) | Bitwise OR && Logical AND ^^ Logical XOR || Logical OR
Looping for i = 1 TO 50 statements…. next i = 0 while (i < 50) statements….. i = i + 1 endwhile
Conditional Execution if expression then statements…… elseif expression then statements else statements endif select varname case n statements…. case m statements…. case else statements…. endselect
Output from a Script Print – outputs characters to the stdout stream Prints variables separated by ‘;’ e.g. print uwVal; slVal2; val3 print “This is a string”; uwVal; “\n” print stVariable
Subroutines subroutine name(var1, var2….varn) statements endsub Variables passed by reference or by value e.g testsub(uword byref par1) testsub(uword byval par2) Default is by value…..
Functions function retvar name (var1, var2…varn) statements endfunc var
Events onevent EVRXBRKON call brkhandle waitevent – waits for events pollevent – polls for events Event handler return code: 0 – waitevent is terminated, script moves on to next instruction non 0 – continue waiting for events
Tutorial Number 3 Open tutorial_3.uws file in notepad This simple script file prints a single line ‘Hello World” Modify the script to print Hello World 10 times – download and test Modify the script to print Hello World and the number of times it has been printed –Hello World 2 –Hello World 3 –Etc
Tutorial Number 4 Open tutorial_4.uws This script waits for an RX break event Modify the RX break event handler to print ‘RX break ON’ Modify the script to monitor the RX break OFF event and add a handler to print ‘RX break OFF’ How can the script be modified to exit when the RX break OFF condition is detected? Modify the script to count the number of RX break ON events and to exit after 10 events have been detected.
String Manipulation Functions A rich set of string manipulation functions is provided – here are some of the key ones….. left$, right$, mid$ strcmp strpos strroleft strvaldec
Handling STDIN When data arrives on STDIN an event is generated – EVSTDIN Event handler reads data from stream and typically looks for end of line EVSTDIN is generated when characters are transferred from UART to STDIN stream – may be one or more……
String Matching It is often useful to match a string against a number of alternatives e.g command look up TableInit: sets up table TableAdd: Adds entry in table TableLookup: Looks up a string in the table and returns associated value
Tutorial Number 5 Open tutorial_5.uws This script implements a simple command line interface for the module. Experiment with the commands that it provides. Add a new command ‘search’ which performs a WLAN search and prints the results –Hint: the _wlansearchdump() built in function does a search and prints the results Make this an ‘autorun’ script and verify that the command line interface works from power on
Tutorial 6 Script_Demo10 searches for all access points and then looks for a named access point in the results. If the AP is present then it connects and waits to get an IP address. Modify this script to search for and attach to the “Uplands Broadband” access point. Once this works – modify the script to search for all “Uplands Boardband” access points and then attach to the one with the largest RSSI value. –Hint – the _wlansearchquery(n, 3) returns the RSSI value for the nth AP that has been found
WLAN Ad-Hoc Networks (1) Ad-hoc WLAN networks allow modules to communicate without using an access point. First module to join an ad-hoc network will create it Subsequent modules connect as if they are joining an access point Channel must be selected – take care of the regionalisation! Power-saving does not work in an ad-hoc network
WLAN Power Management (1) IEEE Power saving – AP allows the terminal to sleep when no data Is transferred. Terminal wakes on a regular basis to check if data has arrived or to send data AP stores data to be sent to the terminal until the terminal wakes up. If there is no data to be transferred then the terminal wakes for a very short time allowing significant reduction in average power. This is an AP managed power saving mode – not available in ad-hoc
WLAN Power Management (2) _psmodeset(0) – No power saving – module is awake all the time (~210mA) _psmodeset(1) – WLAN chipset uses IEEE powersaving – must be attached (~45mA). _psmodeset(5) – WLAN chipset disabled – enables low power when module is not attached (~30mA). _psmodeset(6) – WLAN chipset disabled, MCU disabled. Module woken by user defined I/O pin(s) (~3mA).
High Level Sockets High level Interfaces: _socktcpserver() – sets up a server at the specified IP address and port _socktcpclient() – connects to a server at specified IP address and port
Bridging Functions: _netio(), stdio() and uartio() are used to get stream handles unbridge() disconnects an existing bridge bridge() bridges between two streams
Low Level Sockets A full set of socket API functions are provided. Allow finer control over sockets A more complex interface _socktcpcreate(), _sockudpcreate() _sockconnect(), _sockbind() _socklisten(), _sockaccept() _sockclose() _socksendto(), _socksendall(), _sockrecv(), _sockrecvfrom()
Dynamic Web Page Content _webevget(): Gets the cause of the web event (either dynamic web content or post) _webfname(): Returns the string from the command embedded in the web page. _webecho(): Outputs HTTP strings to the browser _webevend(): Indicates that web processing is complete.
Handling Web Posts Typically a POST from a browser is a list of parameters and values: _webgetnumpostel(): Returns the number of parameters that have been sent _webgetelement(): Gets a parameter from the list
Example Web Script '// get the cause of the web event slRes = _webEvGet(evCause) if ( evCause == 1 ) then '// get the name and argument list of the script/function for this event occuring slRes = _webFNameGet(tag) '// retrieve the name first findChar = "(" charPos = STRPOS( tag, findChar, 0 ) scriptname = LEFT$(tag, UWCASTSL(charPos)) '// then get the args - in this case there can be only one startPos = UWCASTSL(charPos) findChar = ")" charPos = STRPOS( tag, findChar, startPos ) arg1 = MID$( tag, startPos+1, (UWCASTSL(charPos) - startPos - 1) ) if mStrCompare(scriptName, "OBDGetData") == 0 then OBDGetData( UWCASTSL(STRVALDEC(arg1)) ) slRes = _WebEvEnd() exitfunc 1 elseif mStrCompare(scriptName, "ExitScript") == 0 then slRes = _WebEvEnd() exitfunc 0 endif elseif ( evCause == 2 ) then numElements = _webGetNumPostEl() result = _webGetElement(0, name, value) if mStrCompare(value, "ResetMIL") == 0 then ResetMIL() endif '// we have finished so end the web event slRes = _WebEvEnd() This section deals with dynamic content This section deals with posts From the browser