The Aurora Boxealis – A Color Sensing and Mirroring Project

Introduction

Besides looking damned good on an otherwise bland and ordinary desk, this project is about more than just being attention grabbing eye candy.  It’s about demonstrating a small portion of our single board computer capabilities by hooking up a color sensor, RGB light strip, and enclosing it in a nice looking wooden enclosure.  We’re dubbing it the “aurora boxealis”, and it’s made to stand out from the crowd at trade shows and provide a fun, interactive way to professionally demonstrate an interesting sensor, in this case a color sensor.  Grabbing a color swatch from the table and placing it on the top of the box will trigger the lights to mirror that color.
The Aurora Boxealis – A Color Sensing and Mirroring Project

Furthermore, with inspiration from the Celebrationator from “Cloudy with a Chance of Meatballs”, it has a party mode of dancing disco lights which is triggered by pressing the party button on top.
When it’s not partying or matching colors, it displays a calming, color changing effect somewhat reminiscent of the aurora borealis.  Take a gander at a full demonstration over on our YouTube channel and then come back for the following details on the build below.

Hardware

The stars of the show are the TS-7970 single board computer, TCS34725 color sensor, FadeCandy RGB LED driver, and RGB LED light strip (WS2811 based). The TS-7970 provides the I/O, power, and processing for the color sensor, FadeCandy, and light strip. The color sensor has everything built-in, including a bright white LED and IR filter. It has an interrupt pin and settings for interrupt thresholds based on the clear light value it reads. The FadeCandy driver is a clever little piece of hardware that utilizes software and firmware to maximize the performance of the RGB LEDs, like for example, color correction and dithering for fantastic color depth. Take a look at their respective product pages for more information. Finally, a button was hooked up to an interrupt pin on the TS-7970 for starting a party.
Everything has been enclosed inside a custom-made wooden enclosure with the light strip and diffuser wrapped all around. The color sensor and button are mounted on the lid for easy access. A power barrel connector is cleanly installed on the back of the unit. Here’s the wiring diagram for how it’s all hooked up.
HD1 – 24 PIN

  • Attaches to LED strip
  • Pin 3 – Ground – Black
  • Pin 15 – 5V Power – Red

HD2 – 24 PIN

  • Attaches to RGB sensor and button
  • Pin 2 – GPIO#64 (LED Enable) – Blue
  • Pin 4 – GPIO#65 (Sensor Interrupt) – White
  • Pin 6 – GPIO#66 (Button Interrupt) – Green

HD3 – 16 PIN

  • Attaches to RGB sensor and button
  • Pin 3 – 3.3V Power – Red
  • Pin 15 – SCL (I2C Clock) – Green
  • Pin 16 – SDA (I2C Data) – Yellow

The box itself is made from oak hobby board purchased at a local hardware store. The mitered corners are glued together using some high-strength wood glue. The cap was spliced together using biscuits and edged with thin pieces of oak. Holes were drilled for the button, power adapter, and color sensor. For the rectangular color sensor PCB, a chisel was used to chip out a rectangular spot for the sensor to fit in. A ¼” thick and ¼” deep gap was routed into the middle of the box for the LEDs. A ½” thick, very shallow gap was routed into the middle as well for the diffuser material to sit on. A panel board was used for the bottom and the TS-7970 was mounted to it using custom wooden standoffs. Everything was rounded off and finished up on the bench router before sanding and staining the final product. The result was a very nice, travel-ready, oak box with detachable lid.

Software

First off, let’s acknowledge how awesome the open source community is.  Most of the legwork was already completed and packaged up for use with Python, including GPIO sysfs interface with interrupt support, TCS34725 support, and plenty of FadeCandy examples which work with Open Pixel Control (OPC).  The only thing that was left to do was figure out how to use the Twisted reactor used with the GPIO sysfs interface code for handling interrupts.  Admittedly, this did add a layer of complexity to the code which took a little while to comprehend, but once the learning curve is overcome, it’s not a bad way to go.
Now, let’s talk about the source code, located at https://github.com/embeddedarm/aurora.  The main file is aurora.py, which utilizes a bunch of different libraries including:

  • Adafruit TCS34725 – Uses smbus for I2C communication and provides a bunch of handy functions for interfacing with the color sensor.
  • Python Sysfs GPIO – Provides a bunch of handy functions for interfacing with the GPIO pins that are brought out using the Linux GPIO sysfs interface.  Includes interrupt support by using Twisted.
  • Open Pixel Control (OPC) – Sends pixel values to an Open Pixel Control server, in our case FadeCandy, to be displayed.
  • FadeCandy Server – A separate process running in the background which receives instructions from OPC and lights up the RGB LED strip.
  • Pillow – Used to process images used for party (party.jpg) and chill (chill.jpg) modes.

Read more: The Aurora Boxealis – A Color Sensing and Mirroring Project


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top