HackerBox 0097: Ringer

by HackerBoxes in Circuits > LEDs

3434 Views, 12 Favorites, 0 Comments

HackerBox 0097: Ringer

HB0097 Whole Box.png

Welcome to HackerBox 0097. Explore the world of addressable RGB LEDs including a fascinating semiconductor factory tour. Wire chains of RGB LEDs into segments and wire multiple LED segments into super-segments. Leverage a highly integrated LED controller based on a dedicated ARM processor Bluetooth chip. Operate the LED controller using tactile buttons, an included radio frequency remote control, and a Bluetooth mobile app. Configure a dual-core ESP32 Development Board to be programmed in the Arduino IDE. Use the FastLED library to control RGB LEDs from ESP32 Arduino code. Add an amplified microphone module to turn the LED and ESP32 setup into a sound-responsive VU meter. Configure the ESP32 as a powerful WLED Project webserver to control LEDs through any web browser interface over Wi-Fi.

HackerBox is the original monthly subscription box for electronics, computer technology, and hacker culture. Each HackerBox is a discovery box, which means all members await and enjoy a new surprise each month. Tech, toys, knowledge, and fun. It's like having a hacker convention, your birthday, and the first day of school - every month - right in your mailbox.

There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we'd really appreciate it if you can take a few minutes to read the FAQ.

Supplies

This Instructable contains information for getting started with HackerBox 0097. The full box contents are listed on the product page for HackerBox 0097 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month, you can subscribe at HackerBoxes.com and join the party. Subscription members save at least $15 every month and automatically receive each new HackerBox shipped immediately off the production line.

A soldering iron, solder, and basic assembly tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Workshops for tools and supplies along with a wide array of introductory activities and experiments.

The most import thing you will need is a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.

WEAR SAFETY GLASSES WHEN SOLDERING, WHEN TRIMMING WIRE LEADS, OR WHEN CUTTING, DRILLING, ETC.

Addressable RGB LED Rings

RGB LED Rings

We use various types of these addressable RGB LEDs so often now that we almost take them for granted. They are a lot more than LEDs. In fact, each one includes three LEDs (red, green, and blue), a control circuit, shift registers, data latches, and, and, and... just watch this video from DigiKey.

What can you construct with 256 addressable RGB LED pixels in the form of ten ring-shaped circuit boards?

For maximum design flexibility, there are two large rings with 45 pixels each, two rings with 35 pixels, two rings with 24 pixels, two rings with 16 pixels, and two rings with 8 pixels each.

We can think of at least three categories of structures that can be assembled alone, or in various combinations:

  1. retain the concentric rings in their panels
  2. form a planar 2D configuration for wall mounting
  3. arrange the rings as a freeform 3D light sculpture

Wiring Addressable LEDs

Wired Rings.png

Hobbyist use of serial addressable RGB LEDs was first popularized by Adafruit and their NeoPixel branded LEDs. We suggest reviewing the Adafruit NeoPixel Uberguide for a lot of useful information on these colorful wonders. Also, take note of the variety of NeoPixel products available from Adafruit. That is the first place to go whenever you find yourself wanting more RGB LEDs, which you probably will!

GENERAL CONCEPTS

Each pixel has four pins: PWR, GND, Data_In, and Data_Out.

All of the PWR (5V) and GND signals are the same, so they can be fed anywhere, at multiple points, or chained.

To chain pixels together, each Data_Out simply goes to the next Data_In.

A small chain (like one of the rings) has a Data_In at the first LED and a Data_Out at the last LED. The links between the LEDs inside the chain are abstracted away.

Multiple small chains can be chained by linking Data_Outs to Data_Ins exactly as with individual pixels.

Any group of pixels in the entire chain can be called a segment. A segment can have one pixel, it can be a ring, half of a ring, seven rings, or whatever is useful for the structure being configured.

IMPORTANT NOTE

The JST SM pigtails come with wires that have all different colors and in conflicting orders. You must ignore the colors of the wires. Of course there are sometimes "patterns" to the wires (there are only so many ways to assign three colors), but don't rest on one pattern and then get bitten by another. Just ignore the wire colors. Instead, pay attention to the relative positioning of the three signals within the connectors as shown in the diagram.

FEEDER CONNECTION

Start with the JST SM pigtail that has the connector with holes (not pins) inside. Solder the three lines (GND, DATA_IN, and 5V) as shown. Remember to ignore the wire colors. The position/order of the signals matter, not the colors. The order of the pins must match the order of the pins in the two controllers we'll be using, so that is what is shown in the diagram.

CHAIN CONNECTIONS

You can start with just one ring connected to the pigtail. In fact that might be wise. Once you are ready to chain rings together, just connect from Data_Out on the first ring to Data_In on the next ring, and so on. The power and ground pins can be similarly chained, but they do not need to be chained since they can connect however makes wiring easy and gets the power everywhere. There is no "flow through" of the 5V like there is with the data bits. The 5V is ideally just the same 5V everywhere.

WIRE GAUGE

For relatively small/short structures of LEDs, typical hookup wire should be fine, but when the structures get longer (more current being drawn from the 5V lines) using some heavier gauge wire would be a good idea. Some thicker black or white wire can allow the current flow freely while also helping to camouflage the linkages between the backs of the rings.

Bluetooth RGB LED Controller

Controller.png

This controller is based on the mighty little YC1166 Bluetooth chip (datasheet attached). The YC1166 may be tiny, but it features an ARM Cortex-M0 processor, a second RISC processor core, two Bluetooth cores, an RF frontend, multiple memories, and an audio CODEC.

The USB-powered controller can be operated using its two tactile buttons, the included RF remote, or the Bluetooth mobile app.

The QR code printed on the device leads through a link to the app store, but it's easier (and probably safer) to just go directly to the app store and search for the ZENGGE Bluetooth Light App.

Downloads

ESP-WROOM-32 Development Board

ESP32.png

The ESP32 is a dual-core single-chip computer. It is highly integrated featuring 2.4 GHz Wi-Fi and Bluetooth. The ESP32 integrates the antenna switch, RF balun, power amplifier, low noise receive amplifier, filters, and power management modules. As such, the entire solution occupies minimal Printed Circuit Board (PCB) area.

HELLO WORLD

Using a micro USB cable, connect the ESP32 Development Board to your PC. The red power LED on the board will illuminate. OK, that wasn't very exciting, but at least we know we're getting power to the target board.

Complete the following setup and test procedure prior to connecting anything else to the board...

USB DRIVER

The Silicon Labs CP210x USB to UART Bridge supports virtual COM port functionality.

You may need to install the CP210x driver

CONFIGURING THE ARDUINO IDE

Follow this Random Nerd Tutorial to install the Arduino IDE software and set up the ESP32 board support package in the Arduino IDE.

In the Arduino IDE, navigate to:

Tools > Board > ESP32 

scroll down (and down and down) to select the "DOIT ESP32 DEVKIT V1"

HELLO WORLD, TAKE 2

Open the example sketch:

File > Examples > Basics > Blink

Compile and download the sketch to the ESP32.

This sketch will blink a blue LED on the dev board.

Now, that is a real embedded processor "Hello World"

ANOTHER INITIAL TEST, THIS TIME WITH Wi-Fi

As discussed in the Random Nerd Tutorial, this demo is worth a quick spin.

Open the sketch:

File > Examples > WiFi > WiFiScan

Compile and download the sketch to the ESP32.

Open Tools > Serial Monitor

Set the baud rate to 115200

TIMEOUT TROUBLESHOOTING

You may get a timeout error while attempting to program the ESP32 as if it just never makes a connection with your computer. This timeout problem can be mitigated as explained in the Random Nerd Tutorial. On that page, scroll down to the "Troubleshooting" heading and read about how to use the BOOT and ENABLE buttons during the flashing process.

RGB LEDs Controlled by ESP32

ESP32 with LEDs.png

HARDWARE

Connect the three pins driving the LED chain to the ESP32 at these three points:

  • VIN (USB 5V Line)
  • GND
  • D5 (Data from I/O pin 5)

A wiring harness, as show in the image, can be made by splicing Dupont connectors onto the JST SM pigtail that has the connector with pins inside. Again, ignore the colors of the wires, but be very careful to maintain the position and order of the three signals. After splicing one the Dupont connections, place shrink tubing or electrical tape over the individual splices to keep them from shorting.

Alternatively, the pigtail can be soldered directly to the ESP32 dev board.

FIRMWARE

In the Arduino IDE, navigate to Tools > Manage Libraries

Search for and Install:

FastLED by Daniel Garcia

Open the sketch:

File > Examples > FastLED > DemoReel100.ino

Change:

#define DATA_PIN  5
#define LED_TYPE  WS2812B


The NUM_LEDS value can be left to 64 for this initial test, but obviously that will only exercise the first 64 pixels in the chain. The number can be modified to match the actual number of pixels connected.

Compile and download the sketch to the ESP32. Enjoy the lightshow!

Microphone and Volume Unit Meter

ESP32 with LEDs and Mic.png

This amplified microphone module features an electret microphone and a MAX4466 chip. The MAX4466 (datasheet) is an op amp specifically designed to serve as a microphone preamp.

Solder the headers to the module and connect the three pins to the ESP32 as shown:

  • VCC (3V3)
  • GND
  • OUT (VP pin = GPIO 36)

VOLUME METER

A volume unit (VU) meter displays a representation of the signal level in audio equipment. It is basically an indicator of some type that is responsive to the loudness of an audio signal.

Grab the nice little vu_meter sketch from this repo.

In the Arduino IDE, navigate to Tools > Manage Libraries

Search for and Install: MegunoLink

(this library is used for its Exponential Filter implementation)

Change Parameters:

#define N_PIXELS 45 // Pixels in the Large Ring
#define MIC_PIN  36 // VP
#define LED_PIN  5
#define NOISE 1000
#define TOP  (N_PIXELS+2)
#define LED_TYPE WS2812B
#define BRIGHTNESS 24
#define COLOR_ORDER GRB

The number of pixels (N_PIXELS) can be set to the actual number of LEDs connected. We used 45 pixels to demonstrate operation with one of the large LED rings, which includes 45 pixels.

Compile and download the sketch to the ESP32. To get the sound responsiveness of the LEDs to suit your exact configuration, adjust the NOISE parameter and/or the small gain potentiometer on the back of the microphone module.

WLED Project

WLED.png

The WLED Project is a fast and feature-rich implementation of an ESP8266/ESP32 webserver to control Addressable RGB LEDs. There is a lot of detailed information on that link, but you can also just go to the installer site and hit Install to configure your ESP32 entirely through a web browser interface.

Follow Instructions to Program the ESP32 with WLED and then visit your "device" using a browser.

Select Config from the browser interface and set the LED Preferences: GPIO pin (5) and Length (Number of LEDs).

Go back to main interface, select "Solid" and change colors.

Once that works, try some other patterns/colors.

You can set each ring up as a segment.

Unbox and Build Video

Hackerbox 0097 - Ringer - RGB LED Fun!

This video from Jamie's Hack Shack shows off all the functionality we're exploring with this HackerBox.

We've sort of ignored the issue of power supply thus far, even though it is quite important. Around 18 minutes into Jamie's video he dives into the issue and links to some useful information and even a power budget calculator.

In a nutshell, if you crank up a large number of LEDs to high brightness all at once, it will draw a lot of current and you'll want to connect a beefier power supply. An additional resource for learning about power supplies and power budgets is the Online Box Guide for HackerBox 0078 - Power Delivery.

How Are Addressable RGB LEDs Made?

Inside the World’s Most Famous LED Factory - in China

Let's join Scotty of Strange Parts on a tour of the World Semi factory in Dongguan, China, just outside of Shenzhen. He shows us how the famous WS2812 addressable RGB LED is made from bare silicon wafers to finished working components.

20 GOTO 10

outro rings.png

We hope you are enjoying this month's HackerBox adventure into electronics, computer technology, and hacker culture. Reach out and share your success in the comments below or on other social media. Email support@hackerboxes.com anytime with questions or whenever you need some help.

Want more? Surf over to HackerBoxes.com and join us as a monthly HackerBox subscription member. You'll get a cool box of hackable gear delivered right to your mailbox every month and you'll enjoy a generous member discount.

Please consider sharing this free Instructable with others who may be interested in learning about these subjects. We really appreciate your support and "word of mouth advertising" is the greatest compliment that we can receive.