Maker.io main logo

IoT & DIY Electronics Projects: How to Connect Your Project

2023-07-11 | By bekathwia

Arduino ESP32 ESP8266 Raspberry Pi

Today, we're exploring some easy ways to bring your electronics project online to the Internet of Things!

IoT & DIY Electronics Projects: How to Connect Your Project

To get started with the Internet of Things (IoT), you'll need some Wi-Fi microcontrollers. Two excellent choices are ESP8266 and ESP32. These microcontrollers are fantastic for beginners because they're inexpensive and compatible with Arduino-based projects.

IoT & DIY Electronics Projects: How to Connect Your Project

Arduino also has their own line of wifi boards, and there are a few other platforms worth mentioning, like Particle and Raspberry Pi Pico W. These help you easily connect your projects to the web, and you’ll find them on a huge variety of boards.

IoT & DIY Electronics Projects: How to Connect Your Project

Let's start with something fun - controlling LEDs! One cool project you can try is connecting your LEDs to CheerLights, a global RGB LED color-sharing platform created by Hans Scharler in 2011.

IoT & DIY Electronics Projects: How to Connect Your Project

When a new color comes into the system, which happens when someone sends a new color on Discord, all the CheerLights projects in the world will update to that color. It’s a simple concept that makes for a great beginner project.

IoT & DIY Electronics Projects: How to Connect Your Project

For your LED project to join the global CheerLights network, it just needs to read from the CheerLights API, which can be achieved using an Arduino program running on your wifi microcontroller, as well as several other methods detailed on the CheerLights site.

API stands for Application Programming Interface, and it’s basically a set of rules that allow different pieces of software to interact with each other. So, when the CheerLights API updates with a new color, your circuit’s program knows how to receive it.

IoT & DIY Electronics Projects: How to Connect Your Project

WLED is another excellent platform for controlling LED animations over Wi-Fi. This open-source codebase has been around since 2016 and allows you to manage your lighting display from almost any device. It has a nice user interface on Android and iOS, for example, and several dozen sample effects are available. The project is well-maintained, with frequent updates and bug fixes.

WLED also supports integration with many home automation systems, including Alexa and Home Assistant.

Being able to control your LED project from anywhere in the world is a pretty fun experience. But if you want to go further and implement your own more complex project ideas, remember what we covered in a previous episode: it’s all about identifying your inputs and outputs. Some may be analog or digital sensor signals, like in your early Arduino projects, and some may be internet actions, like receiving a Tweet or saving data to a Google Spreadsheet.

IoT & DIY Electronics Projects: How to Connect Your Project

Next, let's talk about visualizing and logging sensor data. With cloud services like Arduino Cloud, Adafruit IO, and ThingSpeak, you can easily store, analyze, and visualize your project data for free.

For example, if you want to keep an eye on the temperature, you could set up a project to read from the temperature sensor, then send that reading to the cloud, on repeat at regular intervals.

When you check back in on the cloud service, you’ll be able to see a graph of the data over time. You can also set up alerts for different conditions, like if the temperature dips too low or rises too high.

IoT & DIY Electronics Projects: How to Connect Your Project

Each one of these services has a slightly different setup procedure, and tutorials you can follow to get started, but the basic idea is that you create a variable to hold your data, and depending on what type it is, like an integer or a string, different dashboard elements will be available to you.

IoT & DIY Electronics Projects: How to Connect Your Project

Interacting with your own sensor data is fun and setting up dashboards can be super helpful, but you can also connect your project to a huge collection of web services using the free API gateway called If This Then That, or IFTTT.

IoT & DIY Electronics Projects: How to Connect Your Project

You can visually code workflows connected to your favorite web services and your existing cloud service using their applet system, for example, “If the temperature gets too high, then send me a text message.” For some of the services to work, you have to have the IFTTT app installed on your device.

IoT & DIY Electronics Projects: How to Connect Your Project

You can also set up an applet to listen for a webhook callout from your board’s code directly, eliminating the cloud data site layer from the equation. The tradeoff is that you have to write your own trigger code.

For even fewer layers of other people’s services, you can work with APIs directly by installing an Arduino API library for your desired product, if there is one.

IoT & DIY Electronics Projects: How to Connect Your Project

For example, my Slack Status Updater project uses the Arduino Slack API to update my status according to the position of this rotary switch. The library makes it possible to get authenticated and allows the board to control an app inside Slack.

IoT & DIY Electronics Projects: How to Connect Your Project

And this YouTube subscriber counter uses the Arduino YouTube API to update the display with my latest numbers. Brian Lough wrote both of these Arduino libraries and a bunch of others you might find useful. The examples included with these libraries are great places to start the code for your project. The maker community relies on intrepid contributors like Brian for the building blocks of our projects.

It can be a bit of a pain to set up access to some of these APIs directly, and some of them aren’t free, which is one of the reasons IFTTT is so handy.

When it comes to connecting your project to the cloud, you have lots of options. Remember that with each layer of abstraction, you may be sacrificing some control over how and when your project interacts with the internet.

IoT & DIY Electronics Projects: How to Connect Your Project

No matter which method you use, it's important to make sure that all your endpoints are secure. You don’t want a stranger getting access to or controlling your work. Most cloud services provide good security measures by default but be sure to never share your login credentials or private key.

I hope you’ve discovered something new to try. Check out the rest of this series for even more information on building with Arduino!

制造商零件编号 ESP32-C3-DEVKITC-02
ESP32-C3-WROOM-02 DEV BRD
Espressif Systems
制造商零件编号 ABX00087
ARDUINO UNO R4 WIFI
Arduino
制造商零件编号 ARGNKIT
ARGON KIT
Particle Industries, Inc.
制造商零件编号 SC0918
RASPBERRY PI PICO W RP2040
Raspberry Pi
制造商零件编号 BB-32621
BREADBOARD TERM STRIP 3.20X2.08"
Bud Industries
制造商零件编号 1957
JUMPER WIRE M TO M 6" 28AWG
Adafruit Industries LLC
制造商零件编号 1311
HOOK-UP 22AWG SOLID - 6 X 25FT
Adafruit Industries LLC
制造商零件编号 5064
SHT30 TEMPERATURE AND HUMIDITY S
Adafruit Industries LLC
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum