Want to add unique lighting to your room? 

A simple solution would be adding a couple of WiFi-enabled LED smart-bulbs. These bulbs are energy efficient and come in a variety of shapes, sizes, and colors to fit your space. Smaller bulbs can be used for accent-lighting or lamps, while larger bulbs are more powerful and can light up an entire room!

These types of bulbs are incredibly popular - and are sold in most major electronics brick-and-mortar retailers. 

In this guide, you'll be turning your PyPortal into a smart lighting controller capable of selecting and setting multiple light sources.

internet_of_things___iot_ProductLineUpAbout.jpg
The LIFX family of smart-bulbs (src: https://www.lifx.com/pages/about)

Unlike a more complicated smart-lighting system like the popular Phillips Hue, LIFX lights are incredibly simple to setup. each light has its own wifi radio (possibly something ESP32 or ESP8266-based? We can't tell from the teardown photo) and connects to your WiFi network.

Most notable about the LIFX lights is they provide a well-documented HTTP API, similar to the Adafruit IO HTTP API. This means you can easily interface with it using your PyPortal.

If you're looking for a way to interactively control a room's lighting using your PyPortal, follow along!

CircuitPython Code

CircuitPython is perfect for building Internet-of-Things projects. This project uses the ESP32SPI CircuitPython library, which can use the ESP32 as a WiFi-coprocessor to send web requests to the LIFX HTTP Remote Control API.

We've also built a LIFX helper module for CircuitPython to make interfacing with these lights incredibly easy. 

You can rapidly update your code without having to compile and store WiFi and API secret keys on the device. This means that there's no editing code and re-uploading whenever you move the PyPortal to another network - just update a file and you're set. 

Prerequisite Guides

If you're new to CircuitPython, take a moment to walk through the following guides to get you started and up-to-speed:

Parts

You only need a PyPortal for this guide - no other sensors or external circuitry required!

Front view of a Adafruit PyPortal - CircuitPython Powered Internet Display with a pyportal logo image on the display.
PyPortal, our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface...
$54.95
In Stock
1 x USB Cable
USB cable - USB A to Micro-B - 3 foot long

You can get both of these and a PyPortal stand in AdaBox 011:

This guide was first published on Apr 11, 2019. It was last updated on Nov 28, 2023.

This page (Overview) was last updated on Mar 22, 2019.

Text editor powered by tinymce.