Movie Night!

The Palace Cinema has just opened up in IoL City! It needs spectacular lights for its grand premiere.

Goal

Use a Wio Link board to remotely control addressable LEDs for the cinema roof and marquee.

Technologies

Overview

I just got my hands on a Wio Link Starter Kit. It’s a simple to use system composing of an ESP8266 based development board, Grove modules and supporting platform for interacting with the chip and cloud hosted API. Although I’m quite familiar with programming the embedded side of IoT components, it does however take a lot of time and additional languages to get familiar with. This kit skips those steps, providing a familiar RESTful API and drag n’ drop firmware builder, via a phone app.

This project is pretty much about playing with the new gear to see how it all works and having fun along the way.

Wio Link

Wio Link

Getting Started and Resources

I followed the instructions on their getting started guide. It basically involves downloading the mobile app (Android/iOS), discovering the WiFi SSID that the dev board is broadcasting, connecting and configuring it as a WiFi client to your network.

Once configured, the device is programmed by dragging a sensor image to the GPIO Grove connection.

Update the firmware to commit the changes.

Wio Link - screen shot - 2 LED strips

The API button will now show you how to interact with the project. It even has a built-in API tester, which is super helpful.

Wio Link - screen shot - API

Addressable LEDs

The kit comes with a strip of 30 waterproof WS2812 LEDs. I initially used this as my test, but I already had a non enclosed strip with a higher density of LEDs. These will integrate into the cinema  a little better.

How do they work? By shifting the 24 bit address once each time the signal goes through an LED (from DIn to DOut), the next light will get the correct data. Make sure to connect the input signal to D1. My first attempt failed because I assumed DO was D0 (zero).

WS2812 Datasheet

LED Schematic WS2812

Construction

This slideshow requires JavaScript.

 

I first connected the LED strip to one of the Grove interfaces and a temp & humidity sensor to another. After playing around for a while to get familiar with it, I figured out the basic goals and capabilities of the project. (This project does not make use of of the temp&hum sensor)

20160530_125036

 

I had a spare addressable LED strip so I cut it down to size. There are 8 LEDs for each roof side, 7 for the marquee and 3 for the center. I also cut a strip of 3 to light of the movie screen.

20160530_174321

The roof lights were connected in parallel so that they run the same pattern. This makes the effect look symmetrical.

20160530_180901

I modified a grove cable so I could connect it to the breadboard. I just cut it in half and added header pins to it.

 

The marquee uses a long white LEGO technic beam to sit in front of the LEDs. I then added yellow LEGO semi-clear pieces as a finishing touch. This strip then connects to the second Wio Link interface. Now these lights can run independent of the roof lights. I used clear tape while prototyping. Through clever LEGO connections or hidden tacky tape, the electronics should look natural in the end.

 

The theater lighting uses the third Grove digital interface. The LEDs are attached to a 1×6 LEGO stud and the cable runs through the roof door.

Programming: API

The Wio Link will provide the API specific to that device firmware after all the modules have been added. It has a unique ID and token that will allow you to interact with it via REST.

Rainbow Lights

https://iot.seeed.cc/v1/node/GroveLedWs2812D1/start_rainbow_flow/[length]/[brightness]/[speed]?access_token=2892ab1d9504066adb8feff131f87e02

 

Request method: POST
Arguments in URL:
  • [length]: uint8_t value, the length of the flow, the flow will always begin with index 0.
  • [brightness]: uint8_t value, 0~100
  • [speed]: uint8_t value, 1~10, 10 is the fastest.
Returns:
  • HTTP 200 {“result”: “OK”}
  • HTTP 400 {“error”: “failure reason here”}

Example:

https://iot.seeed.cc/v1/node/GroveLedWs2812D1/start_rainbow_flow/7/25/9?access_token=##############

 

 

Programming: Node-RED

Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.

Node-RED Resources

Flow Source Code

Copy and import this flow into your Node-RED editor.

By creating a simple flow, I can send different commands by injecting the URL as a POST HTTP request.

Palace Cinema Node-RED flow 2

The Inject and UI buttons set the payload to the API URL.

Nod-Red Switch node roof

The function node simply copies the payload to the msg.url object which will be sent to the HTTP request node.

Node-Red set url

The UI provides an easy way to toggle the rainbow effect for both sets of lights.

Palace Cinema UI 2

 

Gallery