All The Internet of Things - Episode One: Created by Lady Ada
All The Internet of Things - Episode One: Created by Lady Ada
All The Internet of Things - Episode One: Created by Lady Ada
Guide Contents 2
Introduction 4
Hello! 4
Connecting to the IoT 4
Transports 4
Transports 5
What is a Transport? 5
Ethernet 7
Ease of Use! 7
Common Uses 8
Very High Speed 9
Adding Ethernet to your IoT project 9
Watch out for... 11
WiFi 14
Wire-less! 14
Power Management 14
Range & Speed Ratings 15
Good Things about WiFi 16
Challenges 16
Radio Emitter Certifications 16
Authentication & Security 18
Adding WiFi to your Thing 18
Bluetooth & BTLE 23
Bluetooth Classic and Bluetooth Low Energy 23
Range 23
Classic & BTLE Similarities 23
Classic Use Cases: Audio & Keyboards 23
Bluetooth LE - The New Hotness 25
Ultra low power Beacon mode 26
iOS Support 27
Server to Multi-Client Connection 27
Which to Choose? Classic or BLE? 28
Good Things about BLE 28
Challenges... 28
Gateway to the Internet 28
Multi-Platform support 28
Cellular & Satellite 32
Cellular Communications 32
Cell Generations 32
The Past - 2G / GSM 32
This is Adafruit and Digi-Key’s ALL THE INTERNET OF THINGS - a six-part series, covering everything you need to
know about the Internet of Things (which we will shorten to IoT).
For our first guide, we’ll go over the most popular transports used in the IoT industry, as well as the upsides and
downsides of each type of transport to help you decide what you’ll use to connect your devices to the internet.
As a maker, engineer, or designer there are a lot of choices to make. And those choices have a big impact on the cost,
size, runtime, and usability of your Thing. Thinking and knowing about your options early on, perhaps even before you
open up your IDE or CAD tool, will help you save money, time, and make your product the best it can be.
Transports
Whether you plan on using Ethernet, WiFi, Bluetooth, Cellular. RFID/NFC, satellites, sub-GHz, LoRa or mesh networks,
there are advantages and disadvantages to each. The choices are abundant and whichever you choose will have very
interesting features, constraints, and considerations.
It's all about trade-offs - do you need lots of power and range? Are you pushing lots of bits? Or will be it small packets,
low-power, and short-hop distances?
That’s why this guide is all about transports. Our methods of categorization will be POWER, DISTANCE, AND BITS.
Since the transport you choose has massive implications on your design, you’ll want to nail this down first. It’s also very
hard, if not impossible to change transports after you've started. Pick the right transport and the rest of your design will
fall into place.
We’ll start with the oldest/stable transports first and then branch into the more esoteric ones. This isn’t to say you have
to stick with the first one we mention - it’s just you’re most likely to be familiar with it!
What is a Transport?
What do we mean by transports?
The most common way we 'split up' a datapath is to use the 7-layer OSI model (not to be confused with the delicious 7-
layer burrito (https://adafru.it/Bss)).
Now ideally we could pick and choose each layer of our connectivity - so you can swap out any layer to get the perfect
balance of power/range/throughput.
But that's not how the real world works. Often times the Transport layer (which, above, is the 4th layer) bleeds through
both below and above. While in theory you could run Ethernet over a wireless LoRa link, it would be...strange. We're
going to assume that you're using the transport/network/data/physical set together as intended.
Sometimes, these are deeply practical considerations: if you have Ethernet, we assume you've got standard Cat-6
If you have a cellular transport, you've got GSM/GPRS/LTE and are using the world-wide cellular network. Doing
anything else would require low-level hacking and probably violate the terms of use for the cellular network.
And note that some of the transports don't guarantee end-to-end connectivity, or it may be your responsibility -
especially radio.
Good ol' Ethernet. This ‘ancient’ protocol has withstood the test of time. You almost certainly use Ethernet at home and
at work. Ethernet has a standardized connector, the venerable RJ-45. When you need something to "just work," often a
wire will do that. (Just because it's "IoT" doesn't mean it's wireless, just that many Things happen to be wireless.)
World wide universality, completely open and free standard - no patents or licensing!
Just about every hotel/home/office has an Ethernet port for connecting to the internet.
High speed, 1 GBPS Ethernet is available on many routers and on some single board computers. But even the
‘slowest’ 10 Base T has better high-speed throughput than legacy WiFi (802.11b/g)
No interference from other Wireless protocols, no drop-outs. A reasonably designed NIC won’t suffer from
flakiness
Can go up to 100 meters on a single cable
No passwords/usernames/pairing. Plug in and go!
Fairly inexpensive to implement - many chips have built in Ethernet MAC, so you only need a PHY and plug.
Can be used as a private intranet, or connect directly to the Internet
Some downsides
Ease of Use!
The biggest benefit of Ethernet is the high speed and plug-and-play. No SSID configuration or pairing.
There are some security considerations (we'll get into security later), but there are benefits of just having a wire since
someone needs physical access to tap or connect to Ethernet. If you have a wire and MAC-assigned IP addresses you
generally have more control over what and who can access something. Just don't use default passwords on your IoT
Common Uses
Ethernet is generally used when you do not need a lot of range (you're stuck with the length of the cable after all) and
you need to move around a lot of bits.
Cameras - video, especially lately, has gone up to 720p which can strain WiFi connections
Voice (VoIP)
Set-top boxes - video/audio streaming and storage
Game systems
Industrial equipment that is permanently installed
Devices that need ‘air gapped security’ and cannot use wireless connectivity
High-reliability control like industrial control, robotics or medical etc.
PoE is a network standard that puts 48V on the unused data wires (or, with Gigabit Ethernet, shared with data
wires). (https://adafru.it/Bsu) This allows the network cables to carry data and power. IP cameras, VoIP phones, lighting,
and wireless access points are where you'll see most of this action. PoE routers are becoming fairly common and
they’re very affordable.
You know WiFi - you use it all-day every-day. It’s the standard wireless protocol for connecting to the Internet. It’s
available not only at home and work but also in stores, cafes, trains, planes and in most major cities. The worldwide
universality of WiFi makes it a common first choice for IoT.
Wire-less!
WiFi has a lot of the benefits of Ethernet but it's wireless
- and you’ll often find that devices that support one
support the other. WiFi has gone through many
iterations (802.11b, g, n…) and the speed and throughput
has increased in time. Like Ethernet, it can transport lots
of data and connect to the wider Internet with ease. And
like Ethernet, WiFi can require a significant power
budget if not managed carefully.
Power Management
WiFi removes the need for wire for the bits portion, but you'll still need to power it somehow. So many IoT devices,
from sensors to cameras, use WiFi for the data but are still plugged in for power.
If you’re indoors, you may find that wall outlets are plentiful but dragging an Ethernet cable is unnecessary.
For mobile applications, WiFi can go hours and maybe even days on battery, you'll just need to make sure you're in
range of the access point and have a plan to charge or power.
Just as Ethernet comes in a few speed-ratings (10, 100 and 1Gbps), WiFi also comes in various ratings, there’s also
2.4GHz and 5.8GHz flavors: a, b, g, n, ac. (although, honestly we have never seen 5 GHz WiFi on a
microcontroller/microcomputer scale project). With each flavor, you’ll get more bits but need more power and get less
range. There are also different encryption standards. 802.11b is a little old but still available, g and n are most common,
just keep in mind this is a spectrum that anyone can use so expect some interference from other devices like wireless
Protocol Frequency Data rate (Mbit/sec) Approx Range (indoor) Approx Range (outdoor)
802.11g 2.4 GHz 6, 9, 12, 18, 24, 36, 48, 54 38 meters 140 meters
Note that just because your chipset says it can do 802.11g doesn't mean you'll get the max 54 MBit/s, just that it's the
max you can get. And of course, the range varies wildly with antennas, power, chipsets, wireless traffic, and more...
One thing that's new is that WiFi has become pretty cheap! Wifi modules are only a few $ per unit. Sometimes you can
get a microcontoller + WiFi chip all in one to save space and money.
Challenges
Requires authentication, which can be frustrating to set-up, new authentication every time
High power usage without a lot of work
Wide range of embedded-access chipsets, have to choose which to go with
Flakiness, drop-outs - challenging to debug
A really good WiFi stack sometimes requires a full RTOS or kernel to ‘kick’ the network
Watch out for default passwords on Things that plug in directly to the Internet!
Radio-emitter certifications
Especially if you have plug-in or easy recharging, WiFi is a clear winner: good range, good speeds, well understood.
You can be certain that WiFi is a protocol that is ‘here to stay’ so it's a safe bet. For portable items, it's not always the
best choice as the battery management can take up a lot of your engineering time. Check your chipset and use a
power monitor to compare current draw. Use eval boards to quickly ‘sketch out’ your bandwidth needs and figure out
what size battery you can get away with.
Also some schools/offices have ‘enterprise’ wifi where a ToS is clicked through - that may not be possible for you to
do on your small device in which case you’d need the administrator to allow the MAC address through...as you can tell,
it gets hairy fast.
Bluetooth is a newer protocol but one you’re likely familiar with because it has gained a ton of popularity with gadgets
and small devices. Like WiFi, Bluetooth is wireless, and like WiFi, it operates in the 2.4GHz band so pretty much
anyone can use it, and does. In fact, the frequency-sharing of WiFi and BT is why just about every mobile phone, tablet,
computer, and laptop that has WiFi also has Bluetooth.
Range
Range is about the same for both classic and low energy. Technically the max range is about 300 feet or 100 meters,
but that’s very generous and assumes a powerful radio. In reality, you will find over 10 or 20 meters can be
challenging.. about 2 Mbps max for Bluetooth Classic and less than a Mbps for BLE.
Compare that with WiFi’s bandwidth and range! But remember! BT classic and BTLE are completely different protocols
and are not compatible. There are some radio chips that can do both but be sure to check before quoting the parts.
Classic can also do ‘generic’ data transmission using the SPP serial port service but SPP has fallen out of favor, mostly
because it is unavailable to iOS developers without a lot of Apple-side licensing efforts. Basically, If you want to do
short-hop data transmission, go with BTLE. Classic BT’s current draw is maybe 20-30mA, and classic chips don’t sleep
well.
Lower power
Can use sleep modes for even lower power
Much faster pair/connection times (classic is 30 seconds, BTLE cane be 3 seconds)
But...
Because BLE pairs fast, you can sleep until it's time to connect and transmit data and the user often can’t even tell. For
IoT, BLE devices can easily run for weeks, months or even a year on battery. Your fitness monitor, for example, runs
iOS Support
The biggest reason BLE has taken off is that Apple allows anyone to create a BLE-capable app and pair with their
hardware. It’s pretty much the only way you can connect hardware to iOS devices without licensing, special programs
or an NDA. This has pushed vast numbers of developers over to BLE and has created a massive ecosystem of chip
manufacturers, stacks, and code examples. Again, no such thing for Bluetooth Classic other than generic BT keyboard
support
It is possible to set up some BLE chipsets to be in central and/or peripheral mode for point-to-point links. Check the
documentation for your device & ask the manufacturer - sometimes you can flip between the two, sometimes you can
do both simultaneously - but you need the software stack support.
Challenges...
You may need to add and verify your own security - unlike WiFi many BLE stacks are often unencrypted by
default!
Not connected directly to the Internet, may need a gateway
You may need to pay a BT SIG Fee per device.
Some OS support is weak, especially pre windows-10 and linux
Multi-Platform support
The biggest downside we’ve seen with BLE is that desktop OS support for everything but audio/keyboard lags
behind mobile support. Because so many BLE devices connect to mobile, the Android/iOS support may be easier to
implement and better supported than Linux/Windows/Mac. Note that this is software/OS support we're talking about.
Hardware support for BTLE is pretty much standard issue now.
Often times, developers just decide that the only way to communicate with their gadget is through a cell phone. There
is a slow-but-steady push to have WebBluetooth as a cross-platform wireless interface but it isn’t finished
yet (https://adafru.it/Bsy). This may not matter to you depending on your use case, but if you expect users to interact
using their PCs, be sure to allocate plenty of time to develop a multi-platform solution!
That said, the fact that the Pi has WiFi, BT/BTLE, and
Ethernet makes it a very good candidate for a gateway
device
Cellular Communications
As you’re well aware, cell phones can go just about anywhere - there are towers across every country, in almost any
place there are people. And cellular towers can be very powerful. When coupled with a high power transceiver on your
device, range can easily hit miles away.
But, as you probably know from your cell phone’s battery life, power management is a big concern. In order to reach
those towers, cellular radios can draw Watts of power and you can see current spikes of 2 Amps or more.
Historically, cellular was designed for audio use only, but cellular technology moves fast. Whereas a decade ago we
could only really send emails and SMS messages, it’s now commonplace to transmit full videos and large files. You
may not need that kind of bandwidth but it's good to know its there.
Cell Generations
There are a few choices for cellular.
The current generation is LTE (Long Term Evolution 4G and 5G) and is what new designs should target.
However, you’ll still see some 3G chipsets and the ancient 2G GSM standard is still kicking around.
The biggest downside to cellular apart from the high current draws is cost: Cellular modules are more expensive than
WiFi or BTLE, and you have to use a module in order to get cell network-certified. And no matter what you’ll need to
pay a provider, usually monthly for access and data usage.
In the USA, AT&T has already re-assigned their bandwidth. T-Mobile, the only other GSM provider in the US - has
indicated that we only have until 2020 guaranteed. But, there are millions of old GSM devices, so you may see that
deadline inch along for a bit more.
That said, if you have a project that operates in another country and that country is still on primarily GSM, the modules
for GSM are smaller, lower power, and the data/rates are pretty inexpensive. One nice thing about GSM chips is they
tend to be ‘quad-band’ and will work in any country so you can develop in the USA and then send it abroad, or vice
versa.
The Present - 3G
There are also many 3G cellular modules available now, these tend to be larger, higher priced and higher power, but
still very reasonably priced. 3G will get you a few Mbps datarate. Major carriers have not announced any plan to shut
down 3G services so you should be good for at least 5-10 years. One thing to watch for is most modules are based on
One nice thing about LTE is it has been thought through with respect to IoT so rather than sort of ‘grafting’ onto GPRS
or 3G data and sharing the same technology stack as cell phones, there are different ‘categories’ to LTE.
The categories basically range from 0 to 9. 0 is slowest/lowest power and 9 is highest speed. To make it a little more
What this means is that if you want to send sensor data once a week from a remote farmhouse you can go with a low
category modem (say CAT M or CAT 1) and don’t have to spend the same amount of money and power on a cellular
modem that you would for streaming high speed video (say CAT 6).
Right now Cat 2+ is deployed world-wide wherever 4G is available. Cat 1 is available in North America and is rolling out
world-wide. Cat M, which is best for low-bandwidth machine-to-machine is being rolled out right now, and has a few
different sub-categories with varying bandwidths and ranges.
Since this technology is advancing so fast, you’ll want to check with your favorite module manufacturers and carriers to
see what is available!
Cellular Pros
Around-the-world off-grid range
Direct internet connectivity
Direct SMS/Voice connectivity (unique compared to other transports)
Fairly reliable, cellular network is maintained by others
Security built in - 3G/4G cellular network well encrypted, SSL when going to Internet
Can do some rough geolocation
Power Usages
If you think WiFi is power hungry, you will be surprised at how much power draw you'll need to manage with a cellular
module.
Here's some power traces for common events with a cellular module:
Sending an SMS
send SMS: 6.5s, 150uAh, 300mW, 52mA
TCPIP connection
grab mini webpage: 4.5 sec, 203uAh, 650mW, 150mA avg
Disabling GPRS
disabling GPRS: about 4 seconds, 120uAh, 480mW, 113 mA avg
Note that the quiescent current drops from 40mA to 20mA and of that 20mA, about ~12mA is the microcontroller
Satellite
This is sorta like cellular so we will cover it briefly here. When you’re not near a cell tower, like the middle of the ocean,
in the wilderness, far from civilization, or where world-wide functionality is required, how can you get your thing
communicating? Sensors, transportation, scientific data capture, search and rescue - these situations might stick you in
the middle of nowhere. For those situations where you have very little data you have to manage and transport,
satellite link-ups may work well. Note that this is a very constrained transport. For civilian uses, you will be using the
Iridium constellation. You’ll pay a lot for the technology, it's huge, takes a lot of power, and you’ll also pay per month
and per message.
Of course, there are a lot of downsides but if you absolutely need to communicate from anywhere in the world, without
needing to set up your own bridge, relay or network - this is the only option you’ve got.
ZigBee and Z-Wave (as well as ‘similar’ low power radios such as XBees) are often used for home or office-scale
networks and automation. These are low power radios, so great for battery usage. But more importantly, they are
usable in mesh and high-density point-multipoint or multipoint-multipoint networks - something BTLE does not yet do
very well.
These two transports, despite both starting with Z and both used for home/industrial automation, have
nothing to do with each other.
ZigBee
ZigBee/802.15.4 is available in both ~900MHz and 2.4GHz. You’ll see it most often as 2.4GHz though, so it shares the
same frequencies as WiFi/BT. Zigbee and is a freely available standard with dozens of chips available and a flexible
protocols. You can use an existing ‘profile’ like the ZLL (Zigbee Light Link) or just make your own.
ZigBee is cheap, cheaper than WiFi, but to connect it to the Internet you’ll need a gateway.
The big benefit to going with Z-Wave is you’re joining 100+ other companies that provide cross-compatible support.
The big downside is you are stuck with a very proprietary protocol - even though some parts have been open sourced,
you’re still marrying a single company - compare that to the dozen suppliers of ZigBee chips and multiple ZigBee
stacks available.
Like ZigBee, you need to have a Z-Wave gateway device to get to the Internet and enable BTLE/WiFi access
Mesh Networking
ZigBee and Z-Wave do have one thing that they do well that Ethernet/WiFi/Cellular/BTLE do not - that's 'mesh'
networking. Mesh, when done right, lets you increase network range with every new device added because each
radio acts as a transceiver/router. But, that's when its done well. And it's not easy to do well. In particular, mesh doesn't
work nicely with low power networks because every device has to be ready to wake up at any moment and start to do
a bunch of packet routing.
That said, BTLE 5.0 will have mesh capabilies, so you may want to compare BTLE 5.0 and ZigBee when designing your
low power radio device. In general, BLE is still being improved and developed and is gaining more Z-Wave/ZigBee-like
capabilities than the other way around.
Adding Z-Wave
These networks can reach for many miles outdoors, even in high-density cities. They’re perfect in country-sides, rural
and semi-urban spots, especially if you have the ability to set up a directional antenna in a high spot. What’s great
about all of them is there’s no complex pairing, connection or authentication overhead (unless you want it) so you can
wake up your setup and start transmitting within milliseconds.
There are three common LPWAN solutions - two commercial and one generic.
You can have more network management control if you add LoRaWAN on top. Like ZigBee, you’re on your own to
create the network and manage routers, bridges etc. But, there are some cities that have networks set up, much like
the radio relays that Amateur HAMs use.
For example, The Things Network (https://adafru.it/BsB) is a social network for LoRaWAN gateways and communities
LoRa pros
Free to use, can set up own network
Send as many messages as you like, at good speeds up to 50 Kb/s
Very long range (a few km in cities, up to 40km in rural areas with directional antennas)
Fairly low power, depending on your radio amplification, not as low as BTLE but much better than cellular
Pick and choose any frequency you are legally permitted to use
LoRa cons
Must manage your own network/gateway
Chips only available from SemTech, and under patent
sigfox
sigfox is a similar radio protocol, but closer to the cellular network in style. Rather than set up your own LoRa network,
sigfox is an existing network set up by the self-same company. You can only use sigfox chips in a location where there
is an existing network set up, but many cities have one. After you’ve registered and paid, you can join the network,
send and receive data.
For example, as shown below, the SIGFOX Network portion is taken care of for you, you just do the Connected
Devices part and then send/receive data via the cloud interface.
The big constraint is the very tiny message bandwidth: only 140 x 12 byte message per day upload, and 4 x 8 byte per
day download. Like, really limited . But maybe for some sensor data it's enough?
sigfox pros:
Backend network taken care of
Very long range (a few km in cities, up to 40km in rural areas with directional antennas)
Very low power
sigfox cons:
Paid subscription service
Ultra slow: 100 bytes/sec
Not available everywhere - check if there’s a network provider where you are deploying
140 x 12 byte upload and 4 x 8 byte download messages a day
Fixed frequency per location
LoRa and Sigfox are fairly new but fill an important need where you need very low bandwidth and very high ranges,
even with SigFox pricing, it's cheaper than managing a SIM card for each device. And compared to cellular the power
draw is minimal. Ethernet, WiFi, Bluetooth, Cellular & Satellite were not made for millions of little low power devices
whispering around the clock - but LPWANs are.
DIY Radio!
The third option is for those who want long range and maybe don’t want or need to use LoRa or SigFox at all - just roll
your own!
E.g. GoTenna used Silicon Labs Si4460 Transceiver (https://adafru.it/BsC) to create a 100 MHz radio network. The low
frequency allowed them to get awesome range for point-to-point links. Some makers like using modules that use FSK
radios such as SX1231 (or any number of others).
Managing these is done a lot like LoRa - you set up your own network and gateway. But with generic FSK-y radios you
aren’t even required to pay out for the LoRa patent licensing, so they’re very inexpensive for the range you get.
Some radios even come with built-in encryption and link management assistance so you get stuff like CRC,
retransmission, and node addressing. The simplicity of these radios let you stay in sleep mode for a long time until you
need to wake up and transmit.