YouTube Subscriber Counter With LEDs





Introduction: YouTube Subscriber Counter With LEDs

About: Hi! I make stuff. Sometimes I write instructions about them.

This is a YouTube Subscriber counter built with an ESP8266. It uses the YouTube apiv3 to poll for changes. It's made specifically for one of my favourite youtubers Henk Rijckaert.

It was featured in his livestream where the goal was to get to 9000 subscribers.

Step 1: Parts Needed - Electronics and Case

The project is built with the following parts:

  • Wemos D1 Mini
  • 1602 16x2 LCD
  • LCD 12864 adapter
  • power switch
  • Panel Mount Connector 5.5mm 2.1mm
  • 300 to 500 ohm resistor
  • capacitor (1000 µF, 6.3V or higher)
  • 9 WS2812B LEDs
  • Push button (not used in final product)
  • 1A power supply with 5.5mm 2.1mm connector

The Wemos D1 mini can be substituted for another ESP8266 board such as the NodeMCU. I've used the WS2812B LEDs because I've just had them lying around. You can change them to regular LEDs with a driver.

The case is made from 4mm MDF, cut at my hackerspace Area3001 on a Trotec Speedy 300, but any laser cutter capable of etching and cutting 4mm MDF will do. You can look for a FabLab in your neighborhood on this map.

For etching the logo, 4mm plexi is used. It's done with the same laser cutter.

The Trotec looks at the SVG and etches out everything that's black. You can play with half-tones by using a white-black gradient or just use gray values.

Step 2: Assembly and Wiring

Push the panel connector through the back side and solder on the capacitor. Then add the power switch and solder it too. Since I didn't have any wood glue at the moment, I soldered all the electronics as well. The LCD and the I2C adapter are attached back to back, check the pin layout to make sure!

First glue the side, bottom and middle pieces with wood glue. The middle piece has a notch for the LED wires.

The LCD is affixed with hot glue, right in the center hole. The LEDs are attached with the adhesive on the back and are placed centered in the middle piece.

Now that everything is soldered and glued, it's time to write the code!

Step 3: Source Code

Everything is written in the Arduino IDE. You can download it here. When it's all installed and started, you must also install the ESP8266 boards. Detailed instructions are found on the Sparkfun website, but here's a summary.

Go to the Preferences (File > Preferences) and copy this URL into the “Additional Board Manager URLs” text box:

<a href=""></a>

Then navigate to the Board Manager by going to Tools > Boards > Boards Manager. Click on the entry "esp8266" and select Install.

Now the Wemos D1 mini board is added to the board manager!

The source code uses a couple of libraries. Navigate to the library manager by going to Sketch > Include library > Manage libraries .. and install the following libraries:

  • YoutubeApi by Brian Lough
  • LiquidCrystal I2C by Frank de Brabander
  • FastLED by Daniel Garcia
  • ArduinoJson by Benoit Blanchon
  • WiFiManager by tzapu

With those libraries, you are set to upload the sketch, but first you need to adjust a few variables.

Open up YouTube Subscriber Counter.ino and look for the lines

#define API_KEY ""
#define CHANNEL_ID ""

In order to fill those in, you'll first need to have an API Key for YouTube. Follow the steps on Google Support to create one. If you want to check your own channel, you can check it with this Google Support article. Otherwise you can use this tool to convert a username to a channel ID.

Add your values between the quotes and attach your Wemos D1 mini.

It is very important that you DO NOT attach the power supply at the same time as the USB cable!

Press the upload button and presto, the LCD should light up!

Step 4: Wait, How Does It Work Exactly?

When the Wemos D1 mini receives power it checks its memory if it has previously connected to a Wi-Fi access point. If not, it creates an access point itself for you to connect to. The name and password are then displayed on the LCD. In this case the name is "Koterijsubs" and the password is "subscribers".

When connected to the access point, you will be prompted with a configuration panel. There you can scan for your own Wi-Fi and put in the password. When saved, the chip will reboot and connect.

Once connected, it will make a connection to the YouTube API (application programming interface) by opening this website:

The response is then a JSON object in the following form:

 "kind": "youtube#channelListResponse",
 "etag": "\"RmznBCICv9YtgWaaa_nWDIH1_GM/Jy_af3MzhenH1b0wyHrtoRbLnhw\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 1
 "items": [
   "kind": "youtube#channel",
   "etag": "\"RmznBCICv9YtgWaaa_nWDIH1_GM/2OsJYtin-x_xzIQT9RjIrF-qpkg\"",
   "id": "UCPjHlmSGP-rMg5PR-PyaJug",
   "statistics": {
    "viewCount": "628262",
    "commentCount": "3",
    "subscriberCount": "9198",
    "hiddenSubscriberCount": false,
    "videoCount": "86"

JSON stands for JavaScript Object Notation and is a way to convey information by text on the internet. Here we see the key "subscriberCount" with the value "9198", which is exactly what we want.

There is a timer function in the code that does this every 15 seconds. When the result is higher than the previous one, it lights up the LEDs for two seconds and displays the number on the LCD.

That's all!

Step 5: Closing Notes

At the moment the delay() function is used to show the LEDs for a set amount of time, ideally that should be changed to a timer function to avoid interference with the WiFi library. I've tried to also include an animation on the logo on the LCD, but that made the program crash and I haven't found the cause yet.

If you're interested, you can check out my Instagram where I post my projects that don't have instructions.

I look forward to your comments and questions!

(PS: Go and subscribe to Henk Rijckaert and make his logo glow red)

This is the episode that featured the counter:



    • Oil Contest

      Oil Contest
    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest