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.
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.
PyPortal
Say hello to PyPortal! The easiest way to build your IoT projects with a touchscreen display! Make sure to walk through the PyPortal introduction guide and walkthrough the pages. It'll get you setup with CircuitPython and a handful of demo code to play with!
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:
You can get both of these and a PyPortal stand in AdaBox 011:
Text editor powered by tinymce.