# PyPortal LIFX Lighting Controller 

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/074/041/medium800thumb/internet_of_things___iot_ezgif.com-video-to-gif_%287%29.jpg?1554410524)

 **_Want to add unique lighting to your room?_&nbsp;**

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.&nbsp;

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

![](https://cdn-learn.adafruit.com/assets/assets/000/073/550/medium800/internet_of_things___iot_ProductLineUpAbout.jpg?1553265653 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](https://www2.meethue.com/en-us), LIFX lights are incredibly simple to setup. each light has its own wifi radio (_possibly something [ESP32](https://www.adafruit.com/product/3979) or [ESP8266](https://www.adafruit.com/product/2491)-based?_ We can't tell from [the teardown photo](https://www.ifixit.com/Teardown/LIFX+Color+1000+Teardown/64739)) and connects to your WiFi network.

Most notable about the LIFX lights is they provide [a well-documented HTTP API](https://api.developer.lifx.com/docs/introduction), similar to the [Adafruit IO HTTP API](https://io.adafruit.com/api/docs/). 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](https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI)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&nbsp;[LIFX helper module for CircuitPython](https://github.com/adafruit/Adafruit_CircuitPython_LIFX)&nbsp;to make interfacing with these lights incredibly easy.&nbsp;

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.&nbsp;

![internet_of_things___iot_updated_code.png](https://cdn-learn.adafruit.com/assets/assets/000/074/096/medium640/internet_of_things___iot_updated_code.png?1554495184)

## 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!](https://learn.adafruit.com/adafruit-pyportal)

![internet_of_things___iot_3d_printing_hero_(1).jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/554/medium640/internet_of_things___iot_3d_printing_hero_%281%29.jpg?1553269080)

## 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:

- [Welcome to CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython)

## Parts

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

Featured
### Adafruit PyPortal - CircuitPython Powered Internet Display

[Adafruit PyPortal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4116)
 **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 GUIs, all open-source, and Python-powered using&nbsp;tinyJSON / APIs to get news, stock, weather, cat photos,...

In Stock
[Buy Now](https://www.adafruit.com/product/4116)
[Related Guides to the Product](https://learn.adafruit.com/products/4116/guides)
![Front view of a Adafruit PyPortal - CircuitPython Powered Internet Display with a pyportal logo image on the display. ](https://cdn-shop.adafruit.com/640x480/4116-00.jpeg)

### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
![USB cable - USB A to Micro-B - 3 foot long](https://cdn-shop.adafruit.com/640x480/592-01.jpg)

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

- [Next Page](https://learn.adafruit.com/pyportal-lifx-lighting-controller/pyportal-circuitpython-setup.md)

## Guide Products

### Adafruit PyPortal - CircuitPython Powered Internet Display

[Adafruit PyPortal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4116)
 **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 GUIs, all open-source, and Python-powered using&nbsp;tinyJSON / APIs to get news, stock, weather, cat photos,...

In Stock
[Buy Now](https://www.adafruit.com/product/4116)
[Related Guides to the Product](https://learn.adafruit.com/products/4116/guides)
### USB cable - USB A to Micro-B

[USB cable - USB A to Micro-B](https://www.adafruit.com/product/592)
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or microcontroller

Approximately 3 feet / 1 meter long

In Stock
[Buy Now](https://www.adafruit.com/product/592)
[Related Guides to the Product](https://learn.adafruit.com/products/592/guides)
### AdaBox011 - PyPortal

[AdaBox011 - PyPortal](https://www.adafruit.com/product/4061)
Reach out beyond your desk - to the stars and beyond - with **PyPortal**! This ADABOX features a new, easy-to-use IoT device that allows you to customize and create your very own "Internet of Things" portal. We take CircuitPython to the max, pairing a SAMD51 chip with a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4061)
[Related Guides to the Product](https://learn.adafruit.com/products/4061/guides)

## Related Guides

- [Adafruit PyPortal - IoT for CircuitPython](https://learn.adafruit.com/adafruit-pyportal.md)
- [NYE Circuit Playground Drop](https://learn.adafruit.com/nye-circuit-playground-drop.md)
- [PyPortal IoT Data Logger with Analog Devices ADT7410, Adafruit IO and CircuitPython](https://learn.adafruit.com/iot-pyportal-data-logger-adafruitio-circuitpython.md)
- [Electronic History of the Day with PyPortal](https://learn.adafruit.com/electronic-history-of-the-day-with-pyportal.md)
- [No-Solder LED Disco Tie with Bluetooth](https://learn.adafruit.com/no-solder-circuit-playground-bluetooth-disco-tie.md)
- [Making oscilloscope images with DACs](https://learn.adafruit.com/dac-oscilloscope-images.md)
- [LED Matrix Hourglass](https://learn.adafruit.com/led-matrix-hourglass.md)
- [Bluetooth Cycling Speed & Cadence Sensor Display with Clue](https://learn.adafruit.com/bluetooth-bicycle-speed-cadence-sensor-display-with-clue.md)
- [Lego Neon NeoPixel Sign with CircuitPython](https://learn.adafruit.com/lego-neon-sign.md)
- [MicroBlocks Circuit Playground Express Ornament](https://learn.adafruit.com/microblocks-circuitplayground-express-ornament.md)
- [Trellis M4 Beat Sequencers](https://learn.adafruit.com/trellis-m4-beat-sequencer.md)
- [Using the Android CircuitPython Editor](https://learn.adafruit.com/using-the-android-circuitpython-editor.md)
- [Mini Golf Course with Circuit Playground and Crickit](https://learn.adafruit.com/mini-golf-course-with-makecode-circuit-playground-crickit.md)
- [Adafruit IO Basics: Schedule Actions](https://learn.adafruit.com/adafruit-io-basics-scheduled-triggers.md)
- [Use circup to easily keep your CircuitPython libraries up to date](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup.md)
- [PyPortal Reddit Stats Trophy](https://learn.adafruit.com/pyportal-reddit-stats-trophy.md)
