loading
Gather Your (Internet Of) Things
with bekathwia
Internet of Things Class
Enroll
Lesson 1: Gather Your (Internet Of) Things
Ask a QuestionOffice Hours

Welcome to class! Let's get your electronics projects talking online. This class will help you dip a toe in the IoT ocean by building and programming your own simple wireless device, even if you have no prior experience connecting your projects to the cloud. The class is built around free software tools and beginner-friendly hardware.

We'll be programming an ESP8266 wifi board using the Arduino software and programming language. If you're new to programming or microcontrollers, I highly recommend first completing my introductory Arduino Class— it will get you up to speed on the coding and wiring basics before adding the complexity of getting your circuit online. You may also be interested in these other related classes written by my smart and talented colleagues: Electronics, Raspberry Pi, Wearable Electronics, Robots, and LEDs & Lighting.


What You'll Learn

The topic of connected devices is huge. There are undeniably huge sociological implications of the proliferation of ever-present, ever-chatting circuits into the crevices of our existence. This class, however, tries to reign in any budding existential crises by focusing on the fun and easy process of creating your own wifi circuit that does your bidding (for now, anyway). We'll walk through a few "recipes" that can serve as the foundation for many common types of projects you may have in mind.

Software and Hardware Setup — There are a few things to download and configure to get your computer talking with the ESP8266 board, and a few tests to perform to be sure you've got a clear connection to the web. These necessary housekeeping lessons set you up for success and provide valuable reference/troubleshooting information.

Circuit Triggers Internet Action — Want to be notified when a door is opened, your water heater leaks, or there's movement at the bird feeder? This lesson shows you how to use a switch or sensor to trigger an online notification of your choice. Get acquainted with tools for building online projects like cloud data service Adafruit IO and the API gateway site If This Then That (IFTTT).

Circuit Displays Internet Data — Do you want to build a realtime weather monitor, YouTube subscriber counter, or other data-driven project? In this lesson, you'll build a circuit and program that listens to an online feed of data and then gives you some real world feedback by lighting up some LEDs accordingly.

Combining Inputs and Outputs — Your final challenge will be to combine the coding skills you picked up from the previous two! By building an interactive device that both listens and speaks to the internet, you'll establish the foundation needed for more complex projects like telepresence valentines, automatic gardening systems, and much more.

Follow along to pick up the skills needed to create basic IoT devices on your home wireless network. At the bottom of each lesson there is a Q&A section; I'll be checking in frequently to answer any questions you may have as you go. After you've built the basic examples in this class, you'll understand the terminology and design approach needed to research and incorporate new components into your projects. This class gives you the keys to unlock the web's vast resources for building internet-connected DIY electronics projects. The only limits to what you can create are your imagination and follow-through. Including Skynet.


Class Tools and Materials List

In this class, we'll be using an Arduino-compatible wifi board called the Feather Huzzah ESP8266, made by Adafruit. It's easy to program over USB without any additional hardware, you can get it pre-assembled so no soldering is required (at least not right away), and its compact size and onboard battery charger make it perfect for building the brains of any smart object. It also works with a wide variety of plug-and-play accessories, called Feather Wings, that make it easy to add on features with minimal circuit troubleshooting.

The lessons here will build on the programming and electronics prototyping skills first introduced in our beginner Arduino Class, so please review the lessons there and pick up any skills that are unfamiliar, even if you've used Arduino before. Most of the supplies for this class overlap, so if you've already completed the Arduino Class, you only need to pick up the following additional parts:


from L to R: NodeMCU ESP8266-12E devkit board, Adafruit Feather Huzzah, generic ESP8266 module only, Adafruit Huzzah Breakout

Alternatively, you can substitute the ESP8266 module of your choice to follow along with this class. As my second choice, I recommend the NodeMCU devkit ESP8266-12E (files on github), which is also programmable over USB.

The Sparkfun Thing and Adafruit Huzzah (non-Feather variety) are also nice alternatives, though they both require an additional programming cable. I do not recommend any of the tiny module-only boards for beginners, as they are more difficult to set up and use than the others (not breadboard friendly, require exactly 3.3v which makes programming tricky, even with a special cable, and many features are not easily accessible to the user). Pin configurations vary between boards, so if you're making a substitution, double check your product documentation when building your circuits with the diagrams in this class.

In addition to an ESP8266 board, here are all the components you'll need (so pick them up if you haven't already completed the Arduino class):

I've put together an Adafruit wishlist of all the components needed for this class— just remove anything you already have, then customize your header configuration and pixel type!

To solder your pixels, headers, and build more permanent circuits, review this intro lesson and gather up the following tools:

To follow along with the lessons, you will need (free) accounts on the following sites:

  • Adafruit IO - cloud data service for storing important info
  • IFTTT (If This Then That) - API gateway for linking in a multitude of online services

You'll also need a computer to run the Arduino software (Mac/Windows/Linux, unfortunately the web editor does not support the ESP8266 at this time), and access to an unrestricted wifi network, such as your own home network (with or without a password). School/work networks with web logins (captive portals) and/or firewalls can be problematic for getting your projects online. If this describes your situation, you may consider putting your phone into wifi tethering mode, effectively sharing the 4G data connection to devices connected to it as a wifi hotspot (students of mine have had success with this workaround in the past).

Keep your data safe! Always use strong, unique passwords. Enable two-factor authentication where offered and perform regular security checkups to update passwords and revoke app access to anything you don't use anymore.


About Other Platforms

There are many options available to you, the intrepid IoT DIYer. Let's round out a few of the other common tools and platforms you're likely to see around Ye Olde Internets. (Clockwise around the Feather Huzzah starting at bottom left: Puck.js, Feather M0 Bluefruit, nRF8001, Particle Photon, Adafruit Fona, Huzzah ESP8266 basic breakout)

Lua — Most ESP8266 boards you'll find, including the ones recommended in this class, come preprogrammed with NodeMCU's Lua interpreter. Lua is a scripting language that is quite popular with web developers entering the the IoT community because of its simple (and perhaps already-familiar) procedural syntax. While this class takes a different approach that builds on your prior Arduino experience, you may be interested to try Lua before beginning the lessons here. The Feather Huzzah product guide has a succinct tutorial about connecting to the Lua interpreter. I do not use Lua frequently, but you deserve to know about all the options available to you! It's never been a better time to learn DIY electronics, no matter what path your learning takes.

MicroPython Similar to Lua, MicroPython is another way to write for and upload code to your ESP8266 board (and many other boards, too). Adafruit has some introductory tutorials and example projects using MicroPython and their own derivative, CircuitPython.

Other popular Wifi platforms Check out the Particle Photon, Arduino 101, and SparkFun ESP32 Thing

Arduino-compatible Bluetooth boards —This class will not cover bluetooth applications, but much of what you learn in this class will directly apply to working with Arduino-compatible bluetooth boards like the NRF8001 (great for adding onto the Arduino Uno you already have) or one of the bluetooth flavors of Adafruit Feather boards (all-in-one boards). I recommend checking out the Adafruit Bluefruit LE Connect app (iOS and Android) and associated tutorials if you're looking for an Arduino-based bluetooth solution to control a robot or LED wearable project with a phone or tablet. You can also use a mobile device as a bridge between an Arduino-compatible bluetooth device and the outside internet through your device's data connection, whether cellular or wifi.

Raspberry Pi — Why doesn't this class use Raspberry Pi? I knew you were going to ask that! It's mostly because we have a dedicated class about Raspberry Pi already, and it teaches you to create a Tumblr-posting photo booth, which seems pretty IoT to me. Go check it out and let me know how it goes.

The devices we'll build in this class require far less processing power than you'll find in even the simplest Pi, and also require far fewer accessories to get up and running. I like to think of Raspberry Pi as capable of anything a cell phone can do: play video on a display, connect to the internet, etc. The ESP8266 is more like the circuit running your coffee maker than it is like a cell phone.

And many, many more — We've only just barely outlined a few corners of the vast sea of connected devices. We can learn and build with these platforms because they are open. But most of the embedded devices we encounter every day are closed, meaning you can't access the documentation about how they work. We still don't know too much about the potential flaws or backdoor access holes in many of the devices we're naively welcoming into our homes. There is a saying that goes "security through obscurity is no security at all."


The "S" in IoT Stands for Security

The news reminds us all too frequently that humans build imperfect systems which can leak user data, sometimes without anyone knowing until it's much too late. Many users use weak or default passwords and never read all the way through a EULA (YOO-lah), which stands for End User License Agreement—you know, that big block of text you have to agree you read when signing up for a new account or device— and contains information about how your data is being collected and potentially sold.

There is no sure way to keep connected devices secure (as the title of this step cheekily suggests). Companies make mistakes that leak customer data, hackers use breached server data to attack affected users' other accounts, all before you ever catch wind of the problem in the first place.

As the internet seeps into every aspect of our personal reality, the threats become very physical as well. For example, a distributed denial-of-service attack (DDoS) running on zombie IoT devices brought down half the internet on October 21 2016. Imagine what might happen to hacked self-driving cars or home lighting systems. Failure to update the firmware on your thermostat could make you partially responsible for the damage done by the next big security exploit.

I believe that learning about and building your own internet connected devices will help you understand these risks to your privacy better, in turn making you a more informed consumer of a growing category of connected devices. Here is some further reading on the topic if IoT security:

So what can you do to mitigate the ever-multiplying threats? Here are some tips:

  • Keep your devices up to date with the latest firmware/software, as many updates contain security fixes.
  • Secure your accounts and home wifi network with strong passwords. Strong passwords are unique, contain a mix of numbers, letters, and symbols, and are not based on single dictionary words. You may wish to use a password manager to keep track of your passwords, like LastPass or 1Password, which both have built-in password generators too.
  • Turn on two-factor authentication (2FA) wherever it is available to you. That way if your password does get into the wrong hands, your account isn't accessible without physical access to your mobile device.
  • Do not log into personal accounts on computers/devices you do not own, or let anyone use your devices out of your sight.
  • If you create Instructables or other project documentation (and we hope you do!), be sure to scrub out your personal network/key info before publishing.
{
    "id": "quiz-1",
    "question": "Which of these is not necessarily an IoT project?",
    "answers": [
        {
            "title": "water heater sends you an SMS when it’s leaking",
            "correct": false
        },
        {
            "title": "bird feeder tweets when it has visitors",
            "correct": false
        },
{
            "title": "automatic chicken coop door opens at the right time each day",
            "correct": true
        }
    ],
    "correctNotice": "That's correct. A simple timer from the garden department at the home improvement store could be used to trigger a device at the same time each day.",
    "incorrectNotice": "That's incorrect."
}
{
    "id": "quiz-2",
    "question": "Which of these is the strongest password?",
    "answers": [
        {
            "title": "mu44!Ns",
            "correct": true
        },
        {
            "title": "muffins,",
            "correct": false
        },
        {
            "title": "muffin$",
            "correct": false
        },
        {
            "title": "mu44yns",
            "correct": false
        }
    ],
    "correctNotice": "That's correct!",
    "incorrectNotice": "That's incorrect. Strong passwords should contain a mixture of uppercase and lowercase letters, symbols, and numbers. Please try again."
}

Now that you're slightly more informed of the potential uses and misuses of the Internet of Things, we'll make the necessary software installations and configurations to communicate with the ESP8266 hardware.

CLASS PROJECT

Share a photo of your finished project with the class!

Nice work! You've completed the class project