Thingsquare Technology Thingsquare connects smartphone apps with things such as thermostats, light bulbs, and street lights. The devices have a programmable wireless chip that runs the Thingsquare firmware. The wireless chip and the Thingsquare firmware securely connects the device to the Thingsquare cloud backend server. The cloud backend provides an API for smartphone apps. Thingsquare works with a range of wireless chips from several different chip manufacturers. To provide flexibility for Thingsquarebased products, Thingsquare works with many different types of wireless radios, offering both long-range and short-range alternatives. Thingsquare is fully based on open Internet standards and the Thingsquare firmware is open source. Key Facts Fully based on open Internet Protocol standards Firmware based on open source Contiki OS Full AES128 encryption Self-healing network Open source Open standards Low power duty cycling Online IDE Cloud heartbeat service 1(12)
2(12) Technology The World s Smallest IPv6 Stack Thingsquare uses IP, the Internet Protocol, for all communication. Thingsquare devices run the world's smallest fully certified Internet Protocol version 6 (IPv6) stack. The router runs both IPv6 and IPv4. The mesh runs IPv6 routing based on the IETF RPL protocol. Seamless Internet Access Thanks to the router, all devices can reach the Internet, do DNS lookups, and reach Internet hosts. The router runs NAT64 routing and DNS64 address translation combined with a firewall to translate between the internal IPv6 network and the Internet. Thingsquare devices use either regular DNS or mdns to do domain name lookups. Industry Strength Encryption Thingsquare uses the symmetric block cipher Advanced encryption Standard, AES, with 128 bits keys for encryption. AES is implemented in software but can optionally use AES acceleration hardware if available. Thingsquare uses AES CCM for all wireless communication and an AES MIC for authentication. Frequency Hopping Thingsquare networks automatically adapt to their wireless environment. To avoid interference from other systems, and to avoid interfering with others, Thingsquare devices use frequency hopping. For sub GHz radios, frequency hopping is mandated to meet ETSI and FCC regulations. Over the Air Firmware Updates Software changes, features are added, and bugs are found, even after the system has been deployed. Thingsquare devices can be securely updated with new firmware when the need arises. The new firmware is encrypted and signed to ensure the authenticity of the new code. Network Debugging Tools Wireless communication may be unpredictable and it is difficult to know what goes on inside the network. To ease network deployment and debugging, Thingsquare provides network sniffing and graphical network inspection tools.
Components Thingsquare service The mesh The router Private server The cloud The Mesh The Thingsquare devices have low-power radios and automatically form a mesh network. To increase reliability and range without sacrificing battery life, the Thingsquare sleepy mesh technology allows devices to relay messages from others while sleeping between each message to save precious battery power. Thingsquare mesh networks use the Internet Protocol version 6 (IPv6). The Router One of the mesh nodes have an Internet connection, either via Ethernet or WiFi. This node is called the router. The other nodes reach the Internet through the router. The Thingsquare router software is exceptionally lightweight: only 5 kilobytes of ROM and 1 kilobyte of RAM is needed. The router runs on tiny, low-cost microcontrollers and systems-on-a-chip: no need for a computer gateway or a bulky Linux board. The Cloud Thingsquare networks are connected to the Internet without the hassle of manual configuration. When the Thingsquare router connects to the Internet, it automatically obtains its configuration, allowing the Thingsquare devices to reach the Internet. The Thingsquare router contains a firewall with a simple policy: the Thingsquare network can reach the Internet, but the Internet cannot reach the Thingsquare network. 3(12)
4(12) Terminology IPv4 The Internet Protocol version 4 is the Internet Protocol used on the global Internet. With its seamless router, Thingsquare devices connect to IPv4 networks, such as Wifi and Ethernet networks. IPv6 The Internet Protocol version 6 is the network protocol used in Thingsquare networks. With its huge address space, IPv6 can address any Thingsquare devices it needs. RPL The Routing Protocol for Lossy networks, RPL, is the IETF standard routing protocol for low-power IPv6 networks. Thingsquare uses RPL to automatically build wireless mesh networks. 6lowpan 6lowpan is the name of a header compression and adaptation format for the transmission of IPv6 packets over IEEE 802.15.4 radios. Thingsquare uses 6lowpan compression to reduce packet header overhead. IEEE 802.15.4 2.4 GHz IEEE 802.15.4 and sub GHz 2.4 GHz radios are globally license-free but share the spectrum with many other wireless technologies. Sub GHz radios have longer range but have different frequencies in different continents. Thingsquare works with both 2.4 GHz IEEE 802.15.4 and sub GHz radios. Contiki All Thingsquare devices run the open source Contiki operating system, drawing from the expertise in the Contiki community and its growing ecosystem while contributing back to the community. Websockets Websockets provide a way to keep HTTP connections open, through firewalls and proxies, with a very low overhead. Thingsquare devices use Websockets to communicate with cloud services. AES The Advanced Encryption Standard, AES, is the industry standard encryption used for all wireless communication in Thingsquare. It provides a strong guarantee against eavesdropping while being efficient enough for the low-power microprocessors used by Thingsquare.
How Thingsquare Works Thingsquare builds a resilient wireless mesh network where one router provides seamless Internet access for all mesh nodes. All based on open Internet standards. Wireless Mesh Formation Every Thingsquare device has a low-power radio that allows them to communicate with each other and the Thingsquare router. The Thingsquare router has both a low-power radio and an Internet connection, typically Ethernet or WiFi. The Thingsquare router is responsible for the formation of the Thingsquare mesh network. Boot-up When a Thingsquare device boots up, it starts to send RPL DIS messages announcing that it would like to connect to a nearby Thingsquare network. Since the messages are encrypted, only the devices that belong together can hear the messages. The Thingsquare router is the root of the RPL network. All other devices have routes to the root device as well as routes to all its children in the routing graph. The root begins to form the RPL network by sending out RPL DIO messages to its neighbor devices. 5(12)
Route Setup Devices that hear the DIO messages from the root attach to a RPL network and begin sending their own RPL DIO messages. The DIO messages contain a routing metric that holds information about how far away from the root a device is. Devices closer to the root have lower metrics. Devices use the routing metric when determining how to send packets in the network: routes with lower routing metrics are preferred. After a few minutes, all devices have exchanged DIOs and the network has stabilized. The devices will keep sending DIO messages, but increasingly seldom. To avoid overloading the network, the devices will also refrain from sending DIOs if they have already heard DIOs from others, within their send interval. Network Routing 6(12) The Thingsquare devices have multiple ways to reach the root of the network. To choose which way to take, the devices continuously measure the quality of the paths and use the one that needs fewer transmissions to reach the root. If a path goes bad, more retransmissions are needed, and the device will switch to a better path. To setup routes in the downward direction, from the root to the devices in the network, the devices exchange RPL DAO messages. The root device knows the route to all other devices, and the other devices know the route to all devices below them in the routing graph. Packets going between devices in the network are routed through common ancestors.
Cloud Connectivity Thingsquare devices can communicate directly with Internet services, via the Thingsquare router. The router translates the low-power IPv6 mesh traffic from within the Thingsquare network to IPv4 that can be routed onto the Internet. When the mesh network is formed, the Thingsquare router distributes DNS information to the devices. When a device wants to reach an Internet server, it sends a DNS request to the DNS server provided by the router. The request is sent through the mesh network and routed onto the Internet. The DNS server responds with the IPv4 address of the server that the DNS name points to. The router intercepts the DNS response and rewrites the IPv4 address in the response to an IPv6 address with a special prefix that corresponds to the IPv4 address of the Internet server. The Thingsquare device can now communicate with the Internet server by using the IPv6 address in the DNS response. The router translates the IPv6 address to the real IPv4 address of the Internet server. Packets going back to the Thingsquare device are also translated. The Thingsquare device is now connected to the Internet server, via the Thingsquare low-power mesh network. 7(12)
Sleepy Meshing Radio communication drains batteries. Not only do radio transmissions draw battery, idle listening for transmissions from others consume much more energy. To save battery, devices must completely shut off their radios, but must have them turned on often enough to be able to receive and relay messages from others. Thingsquare devices periodically wake up, 2-16 times per second, to quickly check if there is any activity over the radio. If a signal is detected, they keep the radio on for a longer while to see if there is a message being transmitted. When the message is received, the receiver sends an acknowledgment message. To send a message, the sender repeatedly sends its message until it hears the acknowledgment. This allows devices to keep their radio off more than 99% of the time, thereby increasing lifetime from days to years. Current draw during a sleepy mesh transmission 8(12)
Technology Key Takeaways Wireless Mesh Thingsquare uses the IETF RPL IPv6 mesh routing protocol - pronounced "ripple". Devices relay messages for each other to extend range and increase reliability. RPL mesh networks are energy-efficient and adapt to changing radio conditions. The mesh network is self-forming and selfhealing. Sleepy Meshing Sleepy meshing allows all mesh devices to be battery-operated - even traffic relays. Relaying increases reliability and range. Cloud Connectivity Thingsquare mesh devices reach the Internet through the router. The router is transparent: devices do not know it is there. All they see is the Internet. The router firewall policy is simple: allow traffic out but no traffic in. 9(12)
Memory Footprint Thingsquare typically runs on hardware with 64-256 kilobytes of flash and 16-32 kilobytes of RAM. The graphs below show a breakdown for the flash and RAM footprint, measured in kilobytes, for an example device configuration and a router configuration. The device configuration runs a WebSocket client that talks to a cloud-hosted server. The router runs the seamless router software and firewall in addition to the full Thingsquare stack. The code was compiled with gcc for two popular embedded microcontrollers, one 16-bit and one 32-bit. Node configuration Router configuration 10(12)
Network Simulator Thingsquare users develop custom software for their products in the C programming language. The C code is compiled with either GCC or IAR, depending on what platform is being used. Developers may use the open source Instant Contiki development environment: a single-file download that makes compiler and tool chain installation simple. Writing software for networked devices is difficult. To make development and debugging easier, Thingsquare provides a visual simulation environment in which networks of Thingsquare devices can be simulated. The simulator emulates the hardware of each device, providing a detailed view of the behavior of the Thingsquare-based system before deploying on actual hardware. The Cooja network simulator 11(12)
Hardware Partner Network The Thingsquare hardware partner network gives Thingsquare customers access to the best hardware vendors available. Hardware Platforms Microcontroller Architecture Radio Frequency TI CC2538 ARM Cortex M3 SoC 2.4 GHz Atmel R21 ARM Cortex M0+ SoC 2.4 GHz Atmel D20 ARM Cortex M0+ RF233 2.4 GHz TI MSP430F5438 MSP430x CC1120 Sub-GHz TI MSP430F5438 MSP430x CC1101 Sub-GHz 12(12)