# RGB Matrix Automatic YouTube ON AIR Sign

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/094/037/medium800/led_matrices_onairbuild-3375.jpg?1597094243)

https://youtu.be/mg4D-ZQPVnY

When your favorite YouTube channel is streaming this sign will let you know, in gorgeous Art Deco inspired style!

You'll code it with CircuitPython, and the board's built-in WiFi will allow it to check the YouTube Data API to find out when a channel is livestreaming! Then, it'll light up the RGB LED matrix display with "OFF AIR" or "ON AIR" depending on the current status.

You'll use a beautiful bitmap font and custom line drawing graphics routines to make if fancy.

## Parts
### 64x32 RGB LED Matrix - 4mm pitch

[64x32 RGB LED Matrix - 4mm pitch](https://www.adafruit.com/product/2278)
Bring a little bit of Times Square into your home with this sweet 64 x 32 square RGB LED matrix panel. These panels are normally used to make video walls, here in New York we see them on the sides of busses and bus stops, to display animations or short video clips. We thought they looked...

In Stock
[Buy Now](https://www.adafruit.com/product/2278)
[Related Guides to the Product](https://learn.adafruit.com/products/2278/guides)
![Two white hands hold out an assembled and powered on 64x32 RGB LED Matrix Panel - 4mm pitch. The matrix displays "Adafruit Industries LED MATRIX! 32x64 *RGB*"](https://cdn-shop.adafruit.com/640x480/2278-00.jpg)

### Adafruit Metro M4 Express AirLift (WiFi) - Lite

[Adafruit Metro M4 Express AirLift (WiFi) - Lite](https://www.adafruit.com/product/4000)
Give your next project a lift with _AirLift_ - our witty name for the ESP32 co-processor that graces this Metro M4. You already know about the&nbsp; **Adafruit Metro M4** &nbsp;featuring the&nbsp; **Microchip ATSAMD51** , with it's 120MHz Cortex M4 with...

In Stock
[Buy Now](https://www.adafruit.com/product/4000)
[Related Guides to the Product](https://learn.adafruit.com/products/4000/guides)
![Adafruit Metro M4 Airlift Lite dev board with SAMD51 an ESP32 Wifi Co-processor.](https://cdn-shop.adafruit.com/640x480/4000-08.jpg)

### Adafruit RGB Matrix Shield for Arduino

[Adafruit RGB Matrix Shield for Arduino](https://www.adafruit.com/product/2601)
Our RGB matrices are dazzling, with their hundreds or even _thousands_ of individual RGB LEDs. Compared to NeoPixels, they've got great density, power usage and the price-per-LED can't be beat. But...(isn't there always a _but_?) You need to use our special library to...

In Stock
[Buy Now](https://www.adafruit.com/product/2601)
[Related Guides to the Product](https://learn.adafruit.com/products/2601/guides)
![Adafruit RGB Matrix Shield for Arduino connected to a LED Matrix that reads "Adafruit Industries LED MATIX! 32x64 *RGB*"](https://cdn-shop.adafruit.com/640x480/2601-02.jpg)

### Black LED Diffusion Acrylic Panel 12" x 12" - 0.1" / 2.6mm thick

[Black LED Diffusion Acrylic Panel 12" x 12" - 0.1" / 2.6mm thick](https://www.adafruit.com/product/4594)
A nice whoppin' slab of some lovely black acrylic to add some extra diffusion to your LED Matrix project. This material is 2.6mm (0.1") thick and is made of special cast acrylic that makes it perfect for glowy projects, especially matricies or NeoPixels.

Unlike smoke or...

In Stock
[Buy Now](https://www.adafruit.com/product/4594)
[Related Guides to the Product](https://learn.adafruit.com/products/4594/guides)
![LED RGB matrix 12" x 12" with "Adafruit Industries LED Matrix" text showing, and LED acrylic slowly covering to make it nicely diffused](https://cdn-shop.adafruit.com/product-videos/640x480/4594-04.jpg)

### 5V 4A (4000mA) switching power supply - UL Listed

[5V 4A (4000mA) switching power supply - UL Listed](https://www.adafruit.com/product/1466)
Need a lot of 5V power? This switching supply gives a clean regulated 5V output at up to **4 Amps** (4000mA). 110 or 240 input, so it works in any country. The plugs are "US 2-prong" style so you may need a plug adapter, but you can pick one up at any hardware store for $1 or so,...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1466)
[Related Guides to the Product](https://learn.adafruit.com/products/1466/guides)
![Angled shot of 5V 4A switching power supply brick with power cable.](https://cdn-shop.adafruit.com/640x480/1466-10.jpg)

### Adjustable Bent-Wire Stand - up to 7" Tablets and Small Screens

[Adjustable Bent-Wire Stand - up to 7" Tablets and Small Screens](https://www.adafruit.com/product/1679)
This handy bent-wire display stand was originally designed to hold up 7" tablets but the rubberized design is great for general purpose electronics & TFT holding. We use it to hold up our HDMI displays while connected to a Pi - even though it is meant for 7" we found that its...

In Stock
[Buy Now](https://www.adafruit.com/product/1679)
[Related Guides to the Product](https://learn.adafruit.com/products/1679/guides)
![Adjustable Bent-Wire Stand for up to 7 Tablets and Small Screens](https://cdn-shop.adafruit.com/640x480/1679-00.jpg)

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

# RGB Matrix Automatic YouTube ON AIR Sign

## Using M4 Airlift

If you have a Metro M4 AirLift, you can build this project easily - you just need an RGB Matrix shield to help connect!

You will need a Metro M4 Airlift, matrix shield and matrix

### Adafruit Metro M4 Express AirLift (WiFi) - Lite

[Adafruit Metro M4 Express AirLift (WiFi) - Lite](https://www.adafruit.com/product/4000)
Give your next project a lift with _AirLift_ - our witty name for the ESP32 co-processor that graces this Metro M4. You already know about the&nbsp; **Adafruit Metro M4** &nbsp;featuring the&nbsp; **Microchip ATSAMD51** , with it's 120MHz Cortex M4 with...

In Stock
[Buy Now](https://www.adafruit.com/product/4000)
[Related Guides to the Product](https://learn.adafruit.com/products/4000/guides)
![Adafruit Metro M4 Airlift Lite dev board with SAMD51 an ESP32 Wifi Co-processor.](https://cdn-shop.adafruit.com/640x480/4000-08.jpg)

### Adafruit RGB Matrix Shield for Arduino

[Adafruit RGB Matrix Shield for Arduino](https://www.adafruit.com/product/2601)
Our RGB matrices are dazzling, with their hundreds or even _thousands_ of individual RGB LEDs. Compared to NeoPixels, they've got great density, power usage and the price-per-LED can't be beat. But...(isn't there always a _but_?) You need to use our special library to...

In Stock
[Buy Now](https://www.adafruit.com/product/2601)
[Related Guides to the Product](https://learn.adafruit.com/products/2601/guides)
![Adafruit RGB Matrix Shield for Arduino connected to a LED Matrix that reads "Adafruit Industries LED MATIX! 32x64 *RGB*"](https://cdn-shop.adafruit.com/640x480/2601-02.jpg)

### 64x32 RGB LED Matrix - 4mm pitch

[64x32 RGB LED Matrix - 4mm pitch](https://www.adafruit.com/product/2278)
Bring a little bit of Times Square into your home with this sweet 64 x 32 square RGB LED matrix panel. These panels are normally used to make video walls, here in New York we see them on the sides of busses and bus stops, to display animations or short video clips. We thought they looked...

In Stock
[Buy Now](https://www.adafruit.com/product/2278)
[Related Guides to the Product](https://learn.adafruit.com/products/2278/guides)
![Two white hands hold out an assembled and powered on 64x32 RGB LED Matrix Panel - 4mm pitch. The matrix displays "Adafruit Industries LED MATRIX! 32x64 *RGB*"](https://cdn-shop.adafruit.com/640x480/2278-00.jpg)

# RGB Matrix Automatic YouTube ON AIR Sign

## Install CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## Set up CircuitPython Quick Start!

Follow this quick step-by-step for super-fast Python power :)

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/metro_m4_airlift_lite/)
## Further Information

For more detailed info on installing CircuitPython, check out [Installing CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython).

 **Click the link above and download the latest UF2 file.**

Download and save it to your desktop (or wherever is handy).

![adafruit_products_MetroAirLiftCPDownload.png](https://cdn-learn.adafruit.com/assets/assets/000/074/832/medium640/adafruit_products_MetroAirLiftCPDownload.png?1556052786)

Plug your Metro M4 into your computer using a known-good USB cable.

**A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync.**

Double-click the **Reset** button next to the USB connector on your board (blue arrow), and you will see the NeoPixel RGB (LED circled in red) turn green. If it turns red, check the USB cable, try another USB port, etc.

If double-clicking the Reset button doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

![adafruit_products_one_one_one.png](https://cdn-learn.adafruit.com/assets/assets/000/125/965/medium640/adafruit_products_one_one_one.png?1699472441)

You will see a new disk drive appear called **METROM4BOOT**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **METROM4BOOT.**

![adafruit_products_AirLift_METROM4BOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/074/949/medium640/adafruit_products_AirLift_METROM4BOOT.png?1556211532)

![adafruit_products_AirLift_Drag_UF2.png](https://cdn-learn.adafruit.com/assets/assets/000/074/950/medium640/adafruit_products_AirLift_Drag_UF2.png?1556211541)

The LED will flash. Then, the **METROM4BOOT** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![adafruit_products_AirLift_CIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/074/951/medium640/adafruit_products_AirLift_CIRCUITPY.png?1556211595)

# RGB Matrix Automatic YouTube ON AIR Sign

## Build the On Air Sign

## Assembly

Talking to an LED matrix display can be tricky! The 64 x 32 LED used here has a whopping 2,048 pixels, and each can display RGB colors, which makes for a whole lot of data to sling around. Thankfully, our RGB Matrix shield paired with the Metro M4 Airlift does most of the heavy lifting.

Let's assemble the boards and the display so we can get things running!

![](https://cdn-learn.adafruit.com/assets/assets/000/094/022/medium800/led_matrices_onairbuild-3406.jpg?1597091957)

## Shields Up

First, add the male headers, screw terminal block, and the 8x2-pin socket to the Matrix shield, by [following this guide](https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/connecting-using-rgb-matrix-shield). Be careful to match the socket polarity to the silkscreen image on the board.

Be sure to also perform the clock pin mod [as shown here](https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/connecting-using-rgb-matrix-shield#metro-m4-usage-2991520-5).

Then plug the shield into the Metro M4 Airlift.

![led_matrices_onairbuild-3407.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/014/medium640/led_matrices_onairbuild-3407.jpg?1597091821)

## Power Connections

To provide power we'll screw the wiring harness connectors to the screw terminal blocks of the shield. Be sure to match the **black** wire to **GND** and the **red** wire to + **5Vout.**

Now, simply plug the other end into the panel's power header. It can only go in one way.

![led_matrices_onairbuild-3408.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/023/medium640/led_matrices_onairbuild-3408.jpg?1597092003)

![led_matrices_onairbuild-3410.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/024/medium640/led_matrices_onairbuild-3410.jpg?1597092013)

## Data Cable

Plug in the two ends of the ribbon cable, note that the connectors are keyed to only fit in the correct orientation.

![led_matrices_onairbuild-3411.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/025/medium640/led_matrices_onairbuild-3411.jpg?1597092443)

![led_matrices_onairbuild-3412.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/026/medium640/led_matrices_onairbuild-3412.jpg?1597092451)

![](https://cdn-learn.adafruit.com/assets/assets/000/094/027/medium800/led_matrices_onairbuild-3413.jpg?1597092963)

## Wall Adapter

We'll power the Metro M4 from the 5V 4A DC wall adapter plugged into the barrel jack. Even though USB can provide power to the board, the current isn't adequate for lighting up hundreds and thousands of LEDs!

![led_matrices_IMG_3414.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/028/medium640/led_matrices_IMG_3414.jpg?1597093064)

![led_matrices_IMG_3415.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/029/medium640/led_matrices_IMG_3415.jpg?1597093070)

# RGB Matrix Automatic YouTube ON AIR Sign

## Using MatrixPortal

You can build this project with an all-in-one Matrix Portal board, its definitely the easiest and least-expensive way to go about it.

You will need a matrix portal, matrix, and USB C power/data cable

### Adafruit Matrix Portal - CircuitPython Powered Internet Display

[Adafruit Matrix Portal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4745)
Folks love our [wide selection of RGB matrices](https://www.adafruit.com/category/327) and accessories, for making custom colorful LED displays... and our RGB Matrix Shields and FeatherWings can be quickly soldered together to make the wiring much easier. But what if we made it...

In Stock
[Buy Now](https://www.adafruit.com/product/4745)
[Related Guides to the Product](https://learn.adafruit.com/products/4745/guides)
![Video of a person rotating an LED matrix panel with animation resembling falling colored sand.](https://cdn-shop.adafruit.com/product-videos/640x480/4745-05.jpg)

### 64x32 RGB LED Matrix - 4mm pitch

[64x32 RGB LED Matrix - 4mm pitch](https://www.adafruit.com/product/2278)
Bring a little bit of Times Square into your home with this sweet 64 x 32 square RGB LED matrix panel. These panels are normally used to make video walls, here in New York we see them on the sides of busses and bus stops, to display animations or short video clips. We thought they looked...

In Stock
[Buy Now](https://www.adafruit.com/product/2278)
[Related Guides to the Product](https://learn.adafruit.com/products/2278/guides)
![Two white hands hold out an assembled and powered on 64x32 RGB LED Matrix Panel - 4mm pitch. The matrix displays "Adafruit Industries LED MATRIX! 32x64 *RGB*"](https://cdn-shop.adafruit.com/640x480/2278-00.jpg)

### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
![Angled shot of a coiled black, USB-C to USB-A cable.](https://cdn-shop.adafruit.com/640x480/4474-02.jpg)

# RGB Matrix Automatic YouTube ON AIR Sign

## Prep the MatrixPortal

## Power Prep

The MatrixPortal supplies power to the matrix display panel via two standoffs. These come with protective tape applied (part of our manufacturing process) which MUST BE REMOVED!

Use some tweezers or a fingernail to remove the two amber circles.

![adafruit_io_mxprtl-3866.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/902/medium640/adafruit_io_mxprtl-3866.jpg?1600706317)

![adafruit_io_mxprtl-3867.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/903/medium640/adafruit_io_mxprtl-3867.jpg?1600706324)

## Power Terminals

Next, screw in the spade connectors to the corresponding standoff.

- **red** wire goes to **+5V** &nbsp;
- **black** wire goes to **GND**

![adafruit_io_mxprtl-3869.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/907/medium640/adafruit_io_mxprtl-3869.jpg?1600706432)

![adafruit_io_mxprtl-3871.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/908/medium640/adafruit_io_mxprtl-3871.jpg?1600706551)

## Panel Power

Plug either one of the four-conductor power plugs into the power connector pins on the panel. The plug can only go in one way, and that way is marked on the board's silkscreen.

![adafruit_io_mxprtl-3872.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/910/medium640/adafruit_io_mxprtl-3872.jpg?1600706597)

![adafruit_io_mxprtl-3873.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/911/medium640/adafruit_io_mxprtl-3873.jpg?1600706672)

## Dual Matrix Setup

If you're planning to use a 64x64 matrix, [follow these instructions on soldering the Address E Line jumper](https://learn.adafruit.com/adafruit-matrixportal-m4/pinouts#address-e-line-jumper-3072815).

## Board Connection

Now, plug the board into the left side shrouded 8x2 connector as shown. The orientation matters, so take a moment to confirm that the **white indicator arrow on the matrix panel is oriented pointing up and right** as seen here and the MatrixPortal overhangs the edge of the panel when connected. This allows you to use the edge buttons from the front side.

&nbsp;

Check nothing is impeding the board from plugging in firmly. If there's a plastic nub on the matrix that's keeping the Portal from sitting flat, cut it off with diagonal cutters

![adafruit_io_mxprtl-3874.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/912/medium640/adafruit_io_mxprtl-3874.jpg?1600706721)

![adafruit_io_mxprtl-3875.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/913/medium640/adafruit_io_mxprtl-3875.jpg?1600706732)

![](https://cdn-learn.adafruit.com/assets/assets/000/094/914/medium800/adafruit_io_mxprtl-3876.jpg?1600706891)

![](https://cdn-learn.adafruit.com/assets/assets/000/094/915/medium800/adafruit_io_mxprtl-3877.jpg?1600706894)

Info: 

# RGB Matrix Automatic YouTube ON AIR Sign

## Install CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## Set up CircuitPython Quick Start!

Follow this quick step-by-step for super-fast Python power :)

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/matrixportal_m4/)
## Further Information

For more detailed info on installing CircuitPython, check out [Installing CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython).

 **Click the link above and download the latest UF2 file.**

Download and save it to your desktop (or wherever is handy).

![led_matrices_Save_to_Desktop.png](https://cdn-learn.adafruit.com/assets/assets/000/095/075/medium640/led_matrices_Save_to_Desktop.png?1601050695)

Plug your MatrixPortal M4 into your computer using a known-good USB cable.

**A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync.**

Double-click the **Reset** button (indicated by the green arrow) on your board, and you will see the NeoPixel RGB LED (indicated by the magenta arrow) turn green. If it turns red, check the USB cable, try another USB port, etc.

If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

![led_matrices_matrixportal_install_cp.jpg](https://cdn-learn.adafruit.com/assets/assets/000/125/447/medium640/led_matrices_matrixportal_install_cp.jpg?1697644568)

You will see a new disk drive appear called **MATRIXBOOT**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **MATRIXBOOT****.**

![led_matrices_MATRIXBOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/125/448/medium640/led_matrices_MATRIXBOOT.png?1697644692)

![led_matrices_Drag_to_Drive.png](https://cdn-learn.adafruit.com/assets/assets/000/125/449/medium640/led_matrices_Drag_to_Drive.png?1697644703)

The LED will flash. Then, the **MATRIXBOOT** &nbsp;drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![led_matrices_circuitpy.png](https://cdn-learn.adafruit.com/assets/assets/000/125/450/medium640/led_matrices_circuitpy.png?1697645066)

# RGB Matrix Automatic YouTube ON AIR Sign

## Prepare YouTube API Token

Warning: Token creation is subject to change as Google sees fit, so some of these steps may change. This page can help you determine YouTube username string/response: https://developers.google.com/youtube/v3/docs/channels/list

These are the broad steps to using the On Air sign:

- Create a Google API project to get a YouTube Data API token to enter into your **secrets.py** file
- Get the Channel ID of the YouTube channel you want to monitor, this will go into the **code.py**
- Set the operating hours you want to check for livestreams. The YouTube Data API allows about 100 queries per day of the streaming status, so we need to limit the hours checked to concentrate that query power. This way, we can still check every few minutes.

## YouTube Token

To prevent unwanted bot traffic, Google requires each query of the YouTube stats to be accompanied by a YouTube token.

First, you'll need to get set up with your YouTube Data API key. [Follow these instructions to get this set up](https://developers.google.com/youtube/v3/getting-started).

Click the dropdown menu for **Select a project.**

![internet_of_things___iot_api01.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/238/medium640/internet_of_things___iot_api01.jpg?1552683552)

Then, click the **New Project** link at the upper right corner.

![internet_of_things___iot_api02.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/239/medium640/internet_of_things___iot_api02.jpg?1552683579)

On the next page, give your project a name, such as `Matrix-YouTube-Streaming` and then click **CREATE.** (Ignore the project name in the graphic)

![internet_of_things___iot_api03.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/240/medium640/internet_of_things___iot_api03.jpg?1552683610)

Next, click the **+ ENABLE APIS AND SERVICES** link at the top of the page.

Now, you'll be able to click the **Library** link on the left hand side so you can select the **YouTube Data API v3** from the available libraries.

![internet_of_things___iot_api05.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/242/medium640/internet_of_things___iot_api05.jpg?1552683679)

Click on the **YouTube Data API v3** graphic button.

![internet_of_things___iot_api06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/247/medium640/internet_of_things___iot_api06.jpg?1552683754)

On the next page, click **ENABLE**.

![internet_of_things___iot_api07.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/248/medium640/internet_of_things___iot_api07.jpg?1552683786)

Now we'll click on the **CREATE CREDENTIALS** button.

![internet_of_things___iot_api08.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/251/medium640/internet_of_things___iot_api08.jpg?1552683897)

Choose the **YouTube Data API v3** item from the first dropdown menu.

&nbsp;

In the second menu, choose **Other non-UI (e.g. cron job, daemon)**

![internet_of_things___iot_api09.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/253/medium640/internet_of_things___iot_api09.jpg?1552684011)

Then, click the **Public data** radio button.

&nbsp;

Finally, click the **What credentials do I need?** button to get your API key.

![internet_of_things___iot_api10.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/254/medium640/internet_of_things___iot_api10.jpg?1552684059)

One last setting to enable - click on the **API restrictions tab** for your API key and set the dropdown to **YouTube Data API v3**. Then click **Save**.

Your credentials will be generated and you should now copy the **Key** value and paste it into your **secrets.py** file.

![internet_of_things___iot_api11.jpg](https://cdn-learn.adafruit.com/assets/assets/000/073/255/medium640/internet_of_things___iot_api11.jpg?1552684084)

Here's how to enter the token into your **secrets.py** file.

```python
secrets = {
      'ssid' : '_your_wifi_ssid_',
      'password' : '_your_wifi_password_',
      'aio_username' : 'your_adafruitIO_username',
      'aio_key' : 'your_ginormous_AIO_key',
      'youtube_token' : 'HUGE_LONG_YOUTUBE_API_TOKEN'
}
```

### JSON

To keep things current, the stats are grabbed from the Google APIs website itself.

Google automatically generates a JSON file for each YouTube channel, in this case at the address: **https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCpOlOeQjj7EsVnDh3zuCgsA&type=video&eventType=live&key=YOUR\_HUGE\_LONG\_YOUTUBE\_API\_TOKEN** (Be sure to replace that last part with your actual token!)

This file contains all sorts of information, delivered in an easy-to-parse format. If you visit that URL in Firefox, you'll see the JSON data it returns. You can look at the "beautified" version and the raw data to compare by clicking the buttons at top.

![](https://cdn-learn.adafruit.com/assets/assets/000/093/981/medium800/led_matrices_api.png?1597081432)

Here it is in a raw-er form, but still using indentation and carriage returns to make it readable:

```python
{
  "kind": "youtube#searchListResponse",
  "etag": "-4wUWjFHBk38Khg9K18Hz94OcyU",
  "regionCode": "US",
  "pageInfo": {
    "totalResults": 0,
    "resultsPerPage": 5
  },
  "items": []
}
```

When the channel is not broadcasting a livestream, the `items` **key** will contain no data. Here's what this page will look like when there is a livestream happening:

![](https://cdn-learn.adafruit.com/assets/assets/000/093/982/medium800/led_matrices_onairyt.png?1597082075)

```python
{
  "kind": "youtube#searchListResponse",
  "etag": "gLr84DV9iftEnLHwS-d7TBzFqhA",
  "regionCode": "US",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#searchResult",
      "etag": "VKDTVQVYQDRDxvl-7WObsEXSCbc",
      "id": {
        "kind": "youtube#video",
        "videoId": "20XZOCmf4ts"
      },
      "snippet": {
        "publishedAt": "2020-08-05T02:19:17Z",
        "channelId": "UC6p-tjZN8s9GBSbiN4K-bwg",
        "title": "testing stream",
        "description": "",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/20XZOCmf4ts/default_live.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/20XZOCmf4ts/mqdefault_live.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/20XZOCmf4ts/hqdefault_live.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "John Park",
        "liveBroadcastContent": "live",
        "publishTime": "2020-08-05T02:19:17Z"
      }
    }
  ]
}
```

## Keys

If we look through the JSON file, we'll see a **key** called `items` with a sub-tree below it. When the broadcast is off air, this key will be empty, but when it is on air, there is a lot of data there. In our code we can therefore tell when the broadcast is live based on the contents of the `items` **key**.

Our CircuitPython code is able to check for data using this variable:

```python
DATA_LOCATION1 = ["items"]
```

You can get your own Channel ID by logging in to YouTube and then going to your [advanced account settings page](https://www.youtube.com/account_advanced).

There, you'll see your YouTube Channel ID, which you can copy and paste into the **code.py** file's `CHANNEL_ID` variable to track that channel's stats.

# RGB Matrix Automatic YouTube ON AIR Sign

## Font and Graphics

Instead of the default Terminal typeface, we'll use a lovely typeface converted to a bitmap font for use on the matrix display.

In case you want to make your own font, [this excellent guide](https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display/overview) shows how to use FontForge to do just that!

I selected the [Belotta Text typeface](https://fonts.google.com/specimen/Bellota+Text?preview.text=ON+AIR+%2F+OFF+AIR&preview.text_type=custom&sidebar.open=true&selection.family=Bellota+Text:wght@700#standard-styles)found with the [Google Fonts](https://fonts.google.com) search page. I then converted it to a single bitmap font in a size that works for the 64x32 pixel matrix display. Here is the .bdf font:

[BellotaText-Bold-21.bdf.zip](https://cdn-learn.adafruit.com/assets/assets/000/093/801/original/BellotaText-Bold-21.bdf.zip?1596554155)
To use it, download and uncompress the zip file and then drag it onto the board's **CIRCUITPY** drive. In CircuitPython we'll load the font so it can be used for text display.

## Glyph Bitmap Distribution Format

Side note about **Glyph Bitmap Distribution Format** (BDF) fonts -- they are stored as text files that are human and computer readable, and you can even edit them by hand if you feel like getting super particular!

Here's what the letter 'A' glyph looks like in our converted font:

```python
STARTCHAR A
ENCODING 65
SWIDTH 681 0
DWIDTH 14 0
BBX 13 15 1 0
BITMAP
0200
0600
0700
0F00
0F00
0980
1980
18C0
30C0
3FC0
7FE0
6060
6030
C030
C018
ENDCHAR
```

Each of those lines after the word `BITMAP` is a hexidecimal pixel mapping of a row of the glyph. Here's what that looks like converted to binary, with each row padded to 16-bits:

```none
0000001000000000
0000011000000000
0000011100000000
0000111100000000
0000111100000000
0000100110000000
0001100110000000
0001100011000000
0011000011000000
0011111111000000
0111111111100000
0110000001100000
0110000000110000
1100000000110000
1100000000011000
```

Here's what that 'A' looks like rendered on the 64x32 3mm pitch matrix display.

![led_matrices_A.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/802/medium640/led_matrices_A.jpg?1596557075)

## Glyph Tweaks

In case you wanted to add a stylish hat on top of your 'A', you could change the first row to: `1fc0` which is `0001111111000000` in binary.

This would result it the image to the left.

![led_matrices_Ahat.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/803/medium640/led_matrices_Ahat.jpg?1596557800)

Now, that's a bit of a silly example, but the great thing about this is that you can fine-tune your glyphs beyond what may be easily accomplished during the conversion process.

## Shape Graphics

In order to draw some stylish graphic elements (a frame and some wings) we'll use the display\_shapes library's Rectangle and Polygon code.

With the Rectangle code, we'll draw six shapes to create the border frame (it has cutouts, otherwise we could make a single rectangle with a black fill and a white outline).

`rect1 = Rect(0, 0, 2, 32, fill=0x444444)rect2 = Rect(62, 0, 2, 32, fill=0x444444)rect3 = Rect(2, 0, 9, 2, fill=0x444444)rect4 = Rect(53, 0, 9, 2, fill=0x444444)rect5 = Rect(2, 30, 12, 2, fill=0x444444)rect6 = Rect(50, 30, 12, 2, fill=0x444444)`

These each set a starting coordinate point pair on x- and y-axes, and an ending point pair, as well as specify the color.

![](https://cdn-learn.adafruit.com/assets/assets/000/093/828/medium800/led_matrices_onair_frame.gif?1596651472)

# RGB Matrix Automatic YouTube ON AIR Sign

## Code the On Air Sign

## Libraries
We'll need to make sure we have these libraries installed. (Check out this [link](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries) on installing libraries if needed.)

- **adafruit\_bitmap\_font**
- **adafruit\_bus\_device**
- **adafruit\_display\_shapes**
- **adafruit\_display\_text**
- **adafruit\_matrixportal**
- **adafruit\_esp32spi**
- **adafruit\_io**
- **adafruit\_minimqtt**
- **adafruit\_connection\_manager.mpy**
- **adafruit\_miniqr.mpy**
- **adafruit\_pixelbuf.mpy**
- **adafruit\_ticks.mpy**
- **simpleio.mpy**
- **adafruit\_requests.mpy**
- **neopixel.mpy**

![CIRCUITPY](https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/folder-images/Matrix_On_Air.png?raw=true )

## Connect to the Internet

Once you have CircuitPython setup and libraries installed we can get your board connected to the Internet. The process for connecting can be found [here](https://learn.adafruit.com/adafruit-matrixportal-m4/internet-connect).

## Text Editor

Adafruit recommends using the Mu editor for editing your CircuitPython code. You can get more info in [this guide](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

Alternatively, you can use any text editor that saves simple text files.

## Code

Copy the code from the code-block below and paste it into the Mu editor and save it to your Metro M4 Airlift as **code.py** (or copy **code.py** from the zip file and place on the **CIRCUITPY** drive).

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Matrix_On_Air/code.py

![](https://cdn-learn.adafruit.com/assets/assets/000/094/031/medium800/led_matrices_onairbuild-3370.jpg?1597093178)

Now, your sign will connect to your WiFi, connect to Adafruit IO to get the time, and query YouTube for the on air status. If the status is "false" the words "OFF AIR" are displayed. When the stream goes live, the sign will read "ON AIR"!

![](https://cdn-learn.adafruit.com/assets/assets/000/094/030/medium800/led_matrices_onairbuild-3381.jpg?1597093164)

# RGB Matrix Automatic YouTube ON AIR Sign

## LED Matrix Diffuser

## LED Diffusion Acrylic

You can add an [LED diffusion acrylic faceplate](https://www.adafruit.com/product/4594) to the your LED matrix display. (Pictured here with the [ON AIR project](https://learn.adafruit.com/rgb-matrix-automatic-youtube-on-air-sign))

This can help protect the LEDs as well as enhance the look of the sign both indoors and out by reducing glare and specular highlights of the plastic matrix grid.

![led_matrices_onairbuild-3367.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/987/medium640/led_matrices_onairbuild-3367.jpg?1597088161)

## Measure and Cut the Plastic

You can use the sign to measure and mark cut lines on the paper backing of the acrylic sheet.

Then, use a tablesaw or bandsaw with a fine toothed blade and a guide or sled to make the cuts.

Note: it is possible to score and snap acrylic, but it can be very tricky to get an even snap without proper clamping.

![led_matrices_onairbuild-3343.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/988/medium640/led_matrices_onairbuild-3343.jpg?1597088278)

![led_matrices_onairbuild-3346.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/989/medium640/led_matrices_onairbuild-3346.jpg?1597088290)

![led_matrices_onairbuild-3347.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/991/medium640/led_matrices_onairbuild-3347.jpg?1597089259)

![led_matrices_onairbuild-3349.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/992/medium640/led_matrices_onairbuild-3349.jpg?1597089270)

![](https://cdn-learn.adafruit.com/assets/assets/000/093/998/medium800/led_matrices_onairbuild-3352.jpg?1597089308)

Peel away the paper backing from both sides and set the acrylic onto your matrix display with the matte finished side facing out.

![led_matrices_onairbuild-3355.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/999/medium640/led_matrices_onairbuild-3355.jpg?1597089331)

## Uglu Dashes

The best method we've found for adhering acrylic to the matrix display is to use [Uglu Dashes clear adhesive rectangles from Pro Tapes](https://www.protapes.com/products/uglu-600-dashes-sheets). They are incredibly strong (although can be removed if necessary), easy to apply, and are invisible once attached.

Use one at each corner and one each at the halfway point of the long edges, then press the acrylic and matrix panel together for about 20 seconds.

![adafruit_io_weathermx-2-3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/842/medium640/adafruit_io_weathermx-2-3.jpg?1600463849)

![adafruit_io_weathermx-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/843/medium640/adafruit_io_weathermx-2.jpg?1600463856)

![adafruit_io_weathermx-2-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/844/medium640/adafruit_io_weathermx-2-2.jpg?1600463866)

Here you can see the impact of using the diffusion acrylic. (Pictured here with the ON AIR sign project)

![](https://cdn-learn.adafruit.com/assets/assets/000/094/006/medium800thumb/led_matrices_diffusionOnAir.jpg?1597089757)

## Stand

A very simple and attractive way to display your matrix is with the adjustable [bent-wire stand](https://www.adafruit.com/product/1679).

![led_matrices_onairbuild-3418.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/032/medium640/led_matrices_onairbuild-3418.jpg?1597094067)

![led_matrices_onairbuild-3419.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/033/medium640/led_matrices_onairbuild-3419.jpg?1597094085)

![led_matrices_onairbuild-3421.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/034/medium640/led_matrices_onairbuild-3421.jpg?1597094097)

![led_matrices_onairbuild-3422.jpg](https://cdn-learn.adafruit.com/assets/assets/000/094/035/medium640/led_matrices_onairbuild-3422.jpg?1597094107)

![](https://cdn-learn.adafruit.com/assets/assets/000/095/378/medium800/adafruit_io_led_matrices_onairbuild-3383.jpg?1602006263)

Alternately, you can use a frame, [3D printed brackets](https://learn.adafruit.com/led-protest-sign/build-the-sign#step-3065326), tape, glue, or even large binder clips to secure the acrylic to the sign and then mount it on on a wall, shelf, or display cabinet.

[These mini-magnet feet](https://www.adafruit.com/product/4631) can be used to stick the sign to a ferrous surface.


## Featured Products

### 64x32 RGB LED Matrix - 4mm pitch

[64x32 RGB LED Matrix - 4mm pitch](https://www.adafruit.com/product/2278)
Bring a little bit of Times Square into your home with this sweet 64 x 32 square RGB LED matrix panel. These panels are normally used to make video walls, here in New York we see them on the sides of busses and bus stops, to display animations or short video clips. We thought they looked...

In Stock
[Buy Now](https://www.adafruit.com/product/2278)
[Related Guides to the Product](https://learn.adafruit.com/products/2278/guides)
### Adafruit Matrix Portal - CircuitPython Powered Internet Display

[Adafruit Matrix Portal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4745)
Folks love our [wide selection of RGB matrices](https://www.adafruit.com/category/327) and accessories, for making custom colorful LED displays... and our RGB Matrix Shields and FeatherWings can be quickly soldered together to make the wiring much easier. But what if we made it...

In Stock
[Buy Now](https://www.adafruit.com/product/4745)
[Related Guides to the Product](https://learn.adafruit.com/products/4745/guides)
### Adafruit Metro M4 Express AirLift (WiFi) - Lite

[Adafruit Metro M4 Express AirLift (WiFi) - Lite](https://www.adafruit.com/product/4000)
Give your next project a lift with _AirLift_ - our witty name for the ESP32 co-processor that graces this Metro M4. You already know about the&nbsp; **Adafruit Metro M4** &nbsp;featuring the&nbsp; **Microchip ATSAMD51** , with it's 120MHz Cortex M4 with...

In Stock
[Buy Now](https://www.adafruit.com/product/4000)
[Related Guides to the Product](https://learn.adafruit.com/products/4000/guides)
### Adafruit RGB Matrix Shield for Arduino

[Adafruit RGB Matrix Shield for Arduino](https://www.adafruit.com/product/2601)
Our RGB matrices are dazzling, with their hundreds or even _thousands_ of individual RGB LEDs. Compared to NeoPixels, they've got great density, power usage and the price-per-LED can't be beat. But...(isn't there always a _but_?) You need to use our special library to...

In Stock
[Buy Now](https://www.adafruit.com/product/2601)
[Related Guides to the Product](https://learn.adafruit.com/products/2601/guides)
### Black LED Diffusion Acrylic Panel 12" x 12" - 0.1" / 2.6mm thick

[Black LED Diffusion Acrylic Panel 12" x 12" - 0.1" / 2.6mm thick](https://www.adafruit.com/product/4594)
A nice whoppin' slab of some lovely black acrylic to add some extra diffusion to your LED Matrix project. This material is 2.6mm (0.1") thick and is made of special cast acrylic that makes it perfect for glowy projects, especially matricies or NeoPixels.

Unlike smoke or...

In Stock
[Buy Now](https://www.adafruit.com/product/4594)
[Related Guides to the Product](https://learn.adafruit.com/products/4594/guides)
### 5V 4A (4000mA) switching power supply - UL Listed

[5V 4A (4000mA) switching power supply - UL Listed](https://www.adafruit.com/product/1466)
Need a lot of 5V power? This switching supply gives a clean regulated 5V output at up to **4 Amps** (4000mA). 110 or 240 input, so it works in any country. The plugs are "US 2-prong" style so you may need a plug adapter, but you can pick one up at any hardware store for $1 or so,...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1466)
[Related Guides to the Product](https://learn.adafruit.com/products/1466/guides)
### Adjustable Bent-Wire Stand - up to 7" Tablets and Small Screens

[Adjustable Bent-Wire Stand - up to 7" Tablets and Small Screens](https://www.adafruit.com/product/1679)
This handy bent-wire display stand was originally designed to hold up 7" tablets but the rubberized design is great for general purpose electronics & TFT holding. We use it to hold up our HDMI displays while connected to a Pi - even though it is meant for 7" we found that its...

In Stock
[Buy Now](https://www.adafruit.com/product/1679)
[Related Guides to the Product](https://learn.adafruit.com/products/1679/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)

## Related Guides

- [Adafruit Metro M4 Express AirLift (WiFi)](https://learn.adafruit.com/adafruit-metro-m4-express-airlift-wifi.md)
- [Adafruit MatrixPortal M4](https://learn.adafruit.com/adafruit-matrixportal-m4.md)
- [Halloween Countdown Display Matrix](https://learn.adafruit.com/halloween-countdown-display-matrix.md)
- [Bluetooth-Controlled Matrix LED Sign using Bluefruit Connect](https://learn.adafruit.com/bluetooth-controlled-matrix-led-sign-using-bluefruit-connect.md)
- [Matrix Portal Creature Eyes](https://learn.adafruit.com/matrix-portal-creature-eyes.md)
- [Moon Phase Clock for Adafruit Matrix Portal](https://learn.adafruit.com/moon-phase-clock-for-adafruit-matrixportal.md)
- [Adafruit RGB Matrix FeatherWings](https://learn.adafruit.com/rgb-matrix-featherwing.md)
- [ePaper Maze Maker](https://learn.adafruit.com/epaper-maze-maker.md)
- [Purple Air AQI Display](https://learn.adafruit.com/purple-air-aqi-display.md)
- [Stream Deck controlled RGB Message Panel using Adafruit IO](https://learn.adafruit.com/stream-deck-controlled-rgb-message-panel-using-adafruit-io.md)
- [Adafruit IO Basics: AirLift](https://learn.adafruit.com/adafruit-io-basics-airlift.md)
- [Tombstone Matrix Portal](https://learn.adafruit.com/tombstone-matrix-portal.md)
- [RGB LED Matrices with CircuitPython](https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython.md)
- [RGB Matrix Portal Room CO2 Monitor](https://learn.adafruit.com/matrix-portal-room-co2-monitor.md)
- [Adafruit Protomatter RGB Matrix Library](https://learn.adafruit.com/adafruit-protomatter-rgb-matrix-library.md)
- [ePaper Calendar Featuring Metro M4 Express Airlift and Tri-Color ePaper Shield](https://learn.adafruit.com/epaper-calendar-featuring-metro-m4-express-airlift-and-epaper-shield.md)
