learn.illuminations
Accessibility

The MIT Illuminations App & Arduino

Goals of This Chapter

  • Wire up your Arduino LEDs to the MIT Illuminations App

Connecting an app to your LEDs

Earlier in this guide, we used some code to blink an LED and control the WS2812b LED strip. Now, we're going to use the same Arduino Uno + WS2812b setup to display what we program within the MIT Illuminations app.

The instructions here mirror the Getting Started Guide on the MIT Illumination GitHub README file, with a couple of minor exceptions. This guide is specific to the components that we've been using throughout this project!

Hardware Setup

If you've been following along with the whole learn.illuminations guide, you should have the hardware setup ready to go from Chapter 5.

If you're starting here, welcome! The setup of the Arduino Uno and the WS2812b LED strip is fairly simple. You need to connect 3 wires from the copper pads on the light strip into the Arduino pins. Double check to make sure you have these connections:

  • LED Strip Power 5V - Arduino 5V (best practice: red wire)
  • LED Strip Data Din - Arduino PIN 4
  • LED Strip Ground GND - Arduino GND (best practice: black wire)

Arduino Configuration

To control the lights using the MIT Illuminations app, we need to add a bit of code to make sure the Arduino can communicate with the app smoothly.

Open the Arduino IDE and copy the code from this link into a brand new blank sketch.

In the sketch, you'll want to check on 3 variables:

  • Set LED_COUNT to the number of LEDs in your WS2812b LED strip (you may want to limit it to something like 24 if you have a long strand).
  • N_COLORS should be 3 for 3 RGB units.
  • Make sure DATA_PIN is set to 4 (since you're connecting the LED strip Din to PIN 4 on the Arduino).

Make sure you have your Arduino Uno selected within the IDE and click "Upload" to publish the code to your Arduino. After that, you can close the IDE, and your Arduino will remember and run this code every time it powers on. As long as your Arduino Uno is plugged into your computer via USB, it will always be ready to accept data from the MIT Illuminations app.

Setup on the MIT Illuminations App

  1. Open the MIT Illuminations app.
  2. Click on "Settings", on the "General" tab.
  3. Set the number of lights and RGB value to match your LED strip (in our case, 24 lights in RGB).
  4. Click on the "Arduino/Serial" tab, and turn on "Enable Serial Port Output". Select your Arduino port from the list below.
    • On Windows, it'll start with something like: COM...
    • On Mac, it'll start with something like: /dev/tty...
  5. You'll know if your Arduino is receiving data correctly if you see a data light flickering constantly on the board while the MIT Illuminations app is running.

Run Some Shows!

If everything is working, your WS2812b LED strip should be lighting up and matching the preview shown in the MIT Illuminations app. You can start by editing some of the templates, or go wild and create your own. Have fun programming!