Making Magic Across All Layers of the IoT Stack

5/6/24 Pratt School of Engineering

ECE 655: Full-Stack IoT Systems challenges students to build smart devices from the ground up

light up display in a window
Making Magic Across All Layers of the IoT Stack

Many of the functionalities found in a wide array of today’s products would seem magical just a couple of decades ago. Back when texting could only contain text and cost up to twenty cents to send or receive, connecting your phone to your home security system, lamps, electrical outlets, thermostats and even refrigerator seemed impossible. The budget needed to run all those small data streams alone would be enough to have kept even Blackberry in business.

Yet here we are, not only with phones more powerful than desktops of the pay-per-text era, but with voice-activated home networks that connect to and automatically control dozens of devices within each of our own personal Internet-of-Things (IoT).

The magic that makes this possible is, of course, not magic. From end to end, it’s known in business-speak as a “full-stack” system. Off-the-shelf sensors and actuators connect to off-the-shelf microcontrollers programmed using a coding language predating even primitive cell phones. Those microcontrollers send and receive data through now-ubiquitous Wi-Fi or Bluetooth signals, connecting them to powerful data management and storage solutions in the cloud. And user-friendly design software makes it possible for just about anybody who knows the basics of these systems to create a mobile app to interact with and control it all.

Students work to connect more than 500 LED lights to create a smart, cloud-connected display for their dorm room window

Proof of this can be found in ECE 655: Full-Stack IoT Systems. Cross-listed in computer science and taught by Tingjun Chen, assistant professor of electrical and computer engineering, the relatively new offering gives students the opportunity to make the magic happen with their own hands.

“Many classes teach about critical components at different networking layers of a full-stack IoT application, such as embedded systems, wearable devices, computer networks and databases,” Chen said. “I wanted to create a class that ensembled techniques and topics from each of these layers and give students hands-on experiences on how they’re all connected and the opportunity to build and deploy a real IoT system.”

I wanted to create a class that ensembled techniques and topics from each of these layers and give students hands-on experiences on how they’re all connected and the opportunity to build and deploy a real IoT system.

Tingjun Chen Assistant Professor of Electrical and Computer Engineering, Duke University

Throughout the semester, students are taught about and given hands-on lab projects to complete in each layer of a full-stack system. One lab kit might have students connect temperature and humidity sensors to a microcontroller and send their data to the cloud (e.g. the Amazon Web Service) using Wi-Fi. Another could have them use data from sensors to toggle an LED light or ring a buzzer based on their readings. Others might have them build databases and cloud servers or mobile apps for their smartphones. The lab kit has also been used in a series of outreach events to the Durham public schools within the NSF Athena AI Institute.

It’s not as overwhelming as it might sound. According to Chen, most of the students come into the class with at least some knowledge of many of these topics. And even if they don’t, they should be able to get by with at least the basic mechanical experience provided by Duke Engineering’s First-Year Design course, electrical knowledge provided ECE 101 and some basic programming skills.

To this point, not all of the students come from Duke’s electrical and computer engineering or computer science programs. There are some from biomedical engineering and civil and environmental engineering, as well as graduate students from a variety of departments.

Once constructed and connected, three panels filled with 540 LED lights are covered with a translucent material to create a screen.

“Students come in with different backgrounds, both in their technical abilities and their interests,” said Chen. “You can really get a sense of that diversity from the wide range of final projects that they pursue.”

The final six weeks of the course are dedicated to challenging students to put together everything they have learned into a full-stack IoT device built from scratch. While they’re welcome to team up and use some of the components or systems they have already built through the class’s labs, they’re also allowed to pursue just about anything they can imagine, thanks to the support of a Thomas Lord Educational Innovation Grant secured by Chen and Kip Coonley, a scientific/research lab manager at Duke Engineering.

It’s one thing to say you’ve learned about something and another to have actually used it before, and that makes a difference to potential employers.

Michael Bryant Rising Senior in Duke ECE and CS

One group built an herbarium that monitors temperature, humidity and pH level, sending alerts to a user’s phone when any factor goes out of the ideal range for growing lettuce while also controlling growth lights. Another built a smart pillbox for managing medications that can confirm pills were taken, control temperature and humidity conditions to help pills last longer, and sound buzzers and LEDs when reminders are needed. A third group built an autonomous Nerf gun turret that uses heat sensors and a central motor to track and shoot potential invaders of a pillow fort.

One of the more ambitious final projects taken on by a group was creating an LED display for their dorm room window. Their goal was to build something that could be seen—and controlled—from the ground outside, informing passersby of scores from recent Duke sporting events, displaying fun videos, or even letting users play simple games like Simon, snake or maze.

“We’ve been joking about making something like this since our sophomore year,” said Ethan Horowitz, a rising senior double majoring in electrical and computer engineering and computer science. “This class gave us the opportunity not just to learn how to do it, but to actually make it.”

light up display in a window
The final dorm room display projects a short sequence from the iconic video game/music video “Bad Apple,” which is often used as a graphical and audio test

“It was also nice to have an actual budget to follow through on the project and see it come to life,” echoed Michael Bryant, also a rising senior double majoring in electrical and computer engineering and computer science. “And the experience of getting to put it all together, it’s one thing to say you’ve learned about something and another to have actually used it before, and that makes a difference to potential employers.”

The window display the team constructed is a conglomeration of three panels of LED lights, each panel consisting of a supporting lattice-like structure to protect and house 180 lights. Placed side-by-side, they create a window display of 540 lights that can each independently change colors or brightness levels.

The final project really challenges you to not just work with hardware or software or mechanical design, but all three aspects of a full-stack IoT system and application.

Lilly Chiavetta Rising Senior in Duke ECE and BME

The lights are controlled by a type of microcontroller called a Raspberry Pi, a small single-board computer often used in educational settings, which in turn is connected to a server hosted on in the cloud through a service similar to Amazon Web Services called fly.io. The students built a control system to take data scraped from the internet—in this case scores from GoDuke.com—or data provided through games hosted in a homemade web app and accurately display it on their screens.

While all of that coding and server-hosting wizardry might sound difficult, perhaps the most arduous part of the whole project was soldering each of the 540 connections required for the LEDs while running through more than a dozen sticks of hot glue to keep it all together.

“The final project really challenges you to not just work with hardware or software or mechanical design, but all three aspects of a full-stack IoT system and application,” said Lilly Chiavetta, a rising senior double majoring in electrical and computer engineering and biomedical engineering. “Plus, it was just really great to get to work with friends and make something really fun and interesting.”

Lilly Chiavetta, Michael Bryant and Ethan Horowitz (left to right) pose with their full-stack IoT window display showing a recent Duke football score against Northwestern

During the final presentation of their project, the team’s trio of students showed off its capabilities. Running through a screenshare of their app, they called up Simon on the live display and tried to remember an increasingly long sequence of four colors. They tried to solve mazes through a game they created by tapping into the powers of ChatGPT. They chased down food pellets as an increasingly long snake.

And then someone in the class asked what the “Surprise Me” button in the app did. When chosen, the screen brought up a video clip with surprisingly good resolution given the relatively low number of lights in the display. Despite no audio and the screen’s MacGyver-esque construction, the video was immediately recognized by the audience and met with a chorus of groans and laughs.

They had just been Rickrolled.

More Duke ECE News

Kishor Trivedi
4/18 Duke Today

Trivedi Elected a Fellow of AAAS

Kishor Trivedi was recognized for his fundamental contributions to software and systems reliability engineering research, practice and education