This is a very nice project and so easy to build. All we need is a WiFi module and a screen to print the values. Using the ESP8266 WiFi module we connect to the internet. Once connected, using the YouTube channel ID and the API key we obtain the YouTube subscribers count and then we print that value to a 7 segments screen module. The code refresh itself and it will beep each time the value changes. To make it look nice, I've 3D printed the case,
by: ELECTRONOOBS on 2026-05-30
This project is simple. The total price is under 10 dollars. If you don't have a 3D printer you should create any kind of small case and fit everything in place. So lets see what we need.
7 segment module: LINK eBay
Wemos D1 R2 mini: LINK eBay
Buzzer: LINK eBay
3D printed case
The schematic is very simple. Just connect the data, load and clock pins from the 7 segment module to pins D4, D3 and D2 of the WeMos D1 R2 mini board. Also connect the buzzer to the board. To supply the circuit we will use directly the USB connector with a voltage of 5 volts.

The case is 3D printed. You could find the STL files in a link below. Print the file using 2 perimeters, 20% infill. I've used a 0.4mm nozzle and the Creality Ender 3 Printer. Fit everything iside the case and pass the USB cable through the hole. Close the case and that's it. You could add some nice front labels to make it look cooler.
Before we look at the code we have to prepare the Arduino IDE with the libraries and also the core for the WeMos development board. To install the WeMos with the ESP8266 module core you have to:
-Add the next line in to the Additional Boards Manager URLs in order to find the desired download URL.
Copy and paste this line in the Additional Boards Manager URLs:
http://arduino.esp8266.com/stable/package_esp8266com_index.json

Open Arduino IDE, go to preferences and add the line there. If you already have URL added just type a comma (,) and add the new URL. Ok, now that we've done that we can go in to boards manager and search for the needed board. For that go to tools, board, boards manager. Now that we have the URL added into the Arduino preferences the ESP8266 installing file will also appear here. Select it and press install. Once installed you should probably restart Arduino IDE.

Now if we go to boards you can see that I have a lot of extra boards added. We will use the WeMos D1 R2 board. If this doesn’t work then you should use the downloaded ZIP below. Extract the zip and copy the content into the Arduino directory, into hardware, ESP8266COM and a new folder called ESP8266. Now you should restart the IDE and try if it works.

The thing is that we could send serial data to this module using just 3 pins. Those pins are clock, chip select and data. I’ll show you an example of that right now. I’ll connect the module to the Arduino UNO for the test. Data is pin 2, chip select is 3 and clock will be 4. All we need now to do is to shift some registers containing our data. Open the code above in the Arduino IDE and upload it to the Arduino uno and mount the next schematic.
The shift function will first activate the chip select pin which is activated by a low value. Next it will create the data on the data input pin by shifting the value that we want. In this case it will first be the address of the corresponding register on the 7 segments module. This action is followed by the same thing but with the sent data. Finally set the chip select to high and the transmission is done. Ok, so in the setup void, we define those pins as output and send the configuration data. As you can see in the code I send the address of the register and the value using the shift function. If we check the datasheet of this chip on page 7 we can see the address for the intensity, mode and shutdown. We send the corresponding value to make the display show the numbers from right to left. Next, in the infinite loop, we just send the data for each 7 segment display. Easy right.

Ok, so now we know how to print numbers on this module. Let’s see how to obtain the YouTube subscribers value.
Ok, now let’s see how to get our YouTube data. We have to go to GitHub once again or use the download link below. We should thank witness me now for this code. Just download the zip file as before. Now open the Arduino IDE, and go to sketch, include library, add zip library and select the downloaded zip file. And we are done. Now we should have the examples for the YouTube subscriber count. This example is compatible with the ESP8266, it will connect to WIFI and get the subscriber count.
Now open the Arduino IDE, and go to sketch, include library, add zip library and select the downloaded zip file. And we are done. Now we should have the examples for the YouTube subscriber count. This example is compatible with the ESP8266, it will connect to WIFI and get the subscriber count.

Now go to examples, YouTube APi, ESP8266 and select channel statistics. You should add your exact and full WIFI name as below. Then the exact password. Then here you should add you YouTube channel ID. For that go to YouTube. Select creator editor and select the channel icon in the corner and go to YouTube settings. There click advance and now you should copy just copy the channel ID and paste it here in the code. Now for the API key, if you don’t have one you should create it now.

Go to google and type Get Youtube API key or use this link for that. There you select the API console and sing in with your Youtube account data. There on the library select all of the Youtube API and enable them. Accept the terms. Now go to credentials and create new credential. Once created copy the API key and paste it in the code.
Now compile and upload the code. Open the serial monitor. Ok, first we connect to the WIFI. Now you will probably wait a few minutes till the first Youtube subscriber data will show. There you go, this is my subscriber value below. The code works.

Now all we have to do is to marge this 3 examples into just one. Use the ESP8266 chip, get subscribers value and print it on the 7 segment display. Let's see how to do that in the next part.
Now all we have to do is to marge this 3 examples into just one. Use the ESP8266 chip, get subscribers value and print it on the 7 segment display. For that I’ve created this code that you should download from a link below. As before I add my Youtube and WIFI data. Next, I define the pins for the clock, chip select and data of the 7 segment module. In this case are digital outputs of the WEMos 2, 0 and 4.
/*
* http://www.electronoobs.com
* http://www.youtube.com/c/ELECTRONOOBS
*
* Like, Share and Subscribe, Thank you!!!!
*/
//Includes
#include <YoutubeApi.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoJson.h> // This Sketch doesn't technically need this, but the library does so it must be installed.
//Outputs
#define MAX7219_Data_IN 2 //D4 of WeMos
#define MAX7219_Chip_Select 0 //D3 of WeMos
#define MAX7219_Clock 4 //D2 of WeMos
int buzzer = 15; //D8 of WeMos
//Variabels
byte adr = 0x08;
byte num = 0x00;
int i = 0;
long subs = 0;
String thisString_prev;
//////////////////////////////////////////////////////////////////////////////////
//------- Replace the following! ------
char ssid[] = "Your_WIFI_NAME_HERE"; // your network SSID (name)
char password[] = "WIFI_PASSWORD"; // your network key
#define API_KEY "YOUR_API_KEYHERE"
#define CHANNEL_ID "UCjiVhIvGmRZixSzupD0sS9Q" // makes up the url of channel
WiFiClientSecure client;
YoutubeApi api(API_KEY, client);
unsigned long api_mtbs = 60000; //mean time between api requests
unsigned long api_lasttime; //last time api request has been done
void shift(byte send_to_address, byte send_this_data)
{
digitalWrite(MAX7219_Chip_Select, LOW);
shiftOut(MAX7219_Data_IN, MAX7219_Clock, MSBFIRST, send_to_address);
shiftOut(MAX7219_Data_IN, MAX7219_Clock, MSBFIRST, send_this_data);
digitalWrite(MAX7219_Chip_Select, HIGH);
}
void setup() {
Serial.begin(115200);
delay(100);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, LOW);
delay(100);
//Define the pins as outputs and disable CS
pinMode(MAX7219_Data_IN, OUTPUT);
pinMode(MAX7219_Chip_Select, OUTPUT);
pinMode(MAX7219_Clock, OUTPUT);
digitalWrite(MAX7219_Chip_Select, HIGH);
delay(200);
//Setup of the 7seg module
shift(0x0f, 0x00); //display test register - test mode off
shift(0x0c, 0x01); //shutdown register - normal operation
shift(0x0b, 0x07); //scan limit register - display digits 0 - 7
shift(0x0a, 0x0f); //intensity register - max brightness
shift(0x09, 0xff); //decode mode register - CodeB decode all digits
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
IPAddress ip = WiFi.localIP();
Serial.println(ip);
}
void loop() {
if (millis() - api_lasttime > api_mtbs) {
if(api.getChannelStatistics(CHANNEL_ID))
{
unsigned long Count = api.channelStats.subscriberCount;
String thisString = String(Count, DEC);
if(thisString != thisString_prev)
{
digitalWrite(buzzer,200);
delay(1000);
digitalWrite(buzzer,LOW);
}
thisString_prev = thisString;
i = thisString.length();//This variable will go character by cahracter and send the value to the 7 segment display
if(i==8)
{
shift(0x0b, 0x07); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==7)
{
shift(0x0b, 0x06); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==6)
{
shift(0x0b, 0x05); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==5)
{
shift(0x0b, 0x04); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==4)
{
shift(0x0b, 0x03); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==3)
{
shift(0x0b, 0x02); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==2)
{
shift(0x0b, 0x01); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==1)
{
shift(0x0b, 0x00); //scan limit register - display digits 0 thru 7
adr=0x01;
}
i=i-1;
while (i >= 0)
{
if(thisString[i] == '0')
{
num = 0x00;
}
if(thisString[i] == '1')
{
num = 0x01;
}
if(thisString[i] == '2')
{
num = 0x02;
}
if(thisString[i] == '3')
{
num = 0x03;
}
if(thisString[i] == '4')
{
num = 0x04;
}
if(thisString[i] == '5')
{
num = 0x05;
}
if(thisString[i] == '6')
{
num = 0x06;
}
if(thisString[i] == '7')
{
num = 0x07;
}
if(thisString[i] == '8')
{
num = 0x08;
}
if(thisString[i] == '9')
{
num = 0x09;
}
shift(adr, num);
adr=adr+0x01;
i=i-1;
}
}
api_lasttime = millis();
}
}
Ok, down in the code I get the subscribers value and save it in a string format. Since the 7 segment display module has just one chip I can’t sent the entire 8 characters number by shifting data from one chip to another. I have to take each character of the string value and print it one by one. That’s exactly what I’ve done in this function. That’s it. I upload the code and test if it works. Success, this is my subscribers value. By the way, thank you all guys for subscribing and like my videos.
Ok, so I’ve printed the case with my Anet E10 printer using PLA material, 0.4 mm nozzle, 2 perimeters and 20% infill. I take the 3D printed case, solder everything following the schematic below and glue the parts inside. I first glue the 7 segment display. Then the buzzer and screw the toggle witch in place. This switch will activate or des-activate the beep for each new subscriber value. I place the WeMos board in place and glue close the case. Now I add the extra details to make this case look better. I connect the USB cable and we are done. After the initial message I get the subscriber count. This will automatically refresh for each new value.

That’s it guys. You have all the data in this tutorial. You also have the purchase link for all the parts of this project or a new 3D printer. If you consider helping my projects, check my new Peatron page and help my workshop grow and have a lot of more other cool tutorials.
Leave a comment
Please login in order to comment.