YouTube Subscriber Counter (Under 10K)
Intro: YouTube Subscriber Counter (Under 10K)
I was inspired by the Play Button awards YouTube sends out for subscriber milestones and whipped up a simple circuit using an ESP8266 wifi board and seven segment display to show off my realtime subscriber count. This is a great IoT beginner project, with just a little soldering and a code personalization required to make it work for your own account. I made a version 2 that supports more than 10K subscribers, too. Unfortunately, since the API update, this counter will only display the rounded subscriber count.
Before attempting this project, you should be generally familiar with uploading new programs to your Arduino board and installing code libraries, both of which you can learn for free in my Arduino Class, though you really don't have to understand any of the actual Arduino code to get this project running.
For this project, you will need the following materials:
- Small shadow box
- Printer and paper
- Scissors
- Cutting mat or scrap cardboard
- Illustration board or more scrap cardboard
- Utility/craft knife
- Metal ruler (optional)
- Tape
- Glue stick
- Feather Huzzah ESP8266 with female headers
- 4-digit 7-segment FeatherWing display
- Micro USB cable (charge + sync, not charge-only)
- USB power adapter (optional)
and the following tools:
- Soldering iron and solder
- Flush diagonal cutters
- Desoldering braid or solder sucker (for mistakes)
As an Amazon Associate I earn from qualifying purchases you make using my affiliate links.
Required software libraries:
Unique data required:
- Google API key
- YouTube channel ID
- Wifi network name/password
As an alternative to the Feather Huzzah, you can also use your favorite ESP8266 microcontroller board, some of which require an FTDI cable to upload new programs. Use the standard 7-segment backpack rather than the FeatherWing version.
To keep up with what I'm working on, follow me on YouTube, Instagram, Twitter, Pinterest, and subscribe to my newsletter.
STEP 1: Assemble Circuit
Follow the official assembly instructions for the Feather Huzzah using female headers (or stacking headers, though you'd have to cut the long legs off) Likewise follow the assembly instructions for your seven-segment FeatherWing display.
Before you dive into the code for this project, you should first make sure you've got your Arduino software set up properly to program the board you are using, which in my case involves installing the SiLabs USB driver and installing ESP8266 board support (explained in more detail in the Feather Huzzah tutorial):
- Go to Arduino-> Preferences...
- Look for a text field labeled "Additional Boards Manager URLs:" and paste the following URL into the field (separate multiple URLs with commas if applicable):
<a href="http://arduino.esp8266.com/stable/package_esp8266com_index.json">http://arduino.esp8266.com/stable/package_esp8266c...</a>
- Click OK
- Go to Tools->Board-> Boards Manager...
- Search for ESP8266 and click the Install button in the box "esp8266 by ESP8266 Community" when it shows up
Huzzah ESP8266 boards have an LED connected to pin 0, and you can find a sample blink sketch by navigating to File->Examples->ESP8266->Blink, or copy it from here:
void setup() { pinMode(0, OUTPUT); } void loop() { digitalWrite(0, HIGH); delay(500); digitalWrite(0, LOW); delay(500); }
Plug in your USB cable to the board and configure your settings under the Tools menu as follows:
- Board: Adafruit Huzzah ESP8266
- CPU Frequency: 80MHz
- Flash Size: 4M (3M SPIFFS)
- Upload Speed: 115200
- Port: whichever one ends in SLAB_USBtoUART (Mac) or COMx (Windows)
Click the Upload button to send the program to your board. This will take several seconds (longer than you are used to with Arduino Uno). After complete, the onboard LED should start blinking.
While the Feather Huzzah auto-detects when it's being sent a new program, other ESP8266 boards may require a sequence of button presses to get into bootloader mode.
Do not proceed until you've successfully uploaded a blink test program to your board.
STEP 2: Customize Code & Program Board
For this project, you will need the following Arduino Libraries. Easily search and install each one using the Library Manager by navigating to Sketch->Include Library->Manage Libraries... or download from Github and install the old fashioned way:
Download the code attached to this step and open the file "YouTubeSubscriberCounter.ino" in the Arduino IDE. Customize the variables (shown highlighted in teal in the Arduino screenshot above):
- SSID (Network name)
- Wifi password
- Google API key
- YouTube channel ID
Upload the customized code to your board.
STEP 3: Print Paper Template
Download the paper template attached to this step and print it out (designed for 8.5x11" paper, and my shadow box capacity is 4x6"). Cut along the lines to separate the two pieces. The graphic goes right behind the glass, and the other part is for easy placement of the circuit.
STEP 4: Put It All Together
Clean the inside of your glass to be sure its free of dust, cat hair, and other contaminates. Glass is sharp, so be careful handling it.
Place the graphic template face down against the glass, then stack the shadow box separator inside. Glue the other template piece to a 4x6 piece of illustration board or scrap cardboard using a glue stick, then tape the circuit sandwich in place over the template rectangle. You could avoid the glue-up step by printing the template on stiff paper.
Cut away a notch in both backing boards to accommodate for the USB cable, and slot the back in place. Plug in and enjoy! Of if you're like me, disassemble several more times to get the notch just right, the dust out of the glass (again), and install a small shim under the USB plug to help the seven-segment display press flush against the paper/glass (otherwise the numbers are blurry).
STEP 5: Enjoy!
Display your custom Play Button with pride!
You may have noticed the display only supports subscriber counts up to 10,000. If you're popular enough to have that problem, add another four-digit display to yours, soldering a jumper to change the I2C address of the second one.
I'd be delighted to see your version of this project in the comments. Let me know if you have any questions as well. Thanks for reading!
If you like this project, you may be interested in the other IoT projects in the series:
48 Comments
Bob654312 3 years ago
I'm trying to run the code, but am getting an "Unexpected HTTP Status Code: 400" in the serial monitor, right after connection to WIFI is established.
I heard a while back that YouTube subscriber counting websites like SocialBlade no longer work, due to some new restriction that YouTube implemented. Is that the culprit?
If not, any ideas as to what might be going wrong?
Thanks! :)
Bob654312 3 years ago
Wasn't using the right YouTube analytics API. There's a newer version out now
Johnice 4 years ago
iap128 5 years ago
bekathwia 5 years ago
ricky.fourlight 5 years ago
iap128 5 years ago
ricky.fourlight 5 years ago
DaK8 5 years ago
Thanks a lot! :D
DaK8 5 years ago
Consider downloading the older version
EricW263 5 years ago
EricW263 5 years ago
osdoyi 6 years ago
osdoyi 6 years ago
excited 6 years ago
Really inspiring, Thank You! Will start to make one for Instagram follower count for our cafe. Probably need some help with coding :D
Bob654312 6 years ago
Hello again!
for some reason, I am not getting any ports called ....SLAB_USBtoUART.
all I have is a bluetooth one, and /dev/cu.MALS or /dev/cu.SOC
what should I do? I can't upload anything to the board :(
It is giving me the following error message:
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
Thanks for the help!!!
:)
RANDOM KNOWLEDGE 6 years ago
are you Dutch Bob?
want dan kan ik je op weg helpen, in hoe Arduino en librairies enz te gebruiken..
en hoe je het moet instellen,
WannaDuino
bekathwia 6 years ago
Could it be that you are missing the SiLabs driver and/or ESP8266 boards package? For info on setting up your Arduino software to work with the Feather Huzzah, check out my free Internet of Things Class or the Adafruit product guide:
https://www.instructables.com/class/Internet-of-Th...
https://learn.adafruit.com/adafruit-feather-huzzah...
Bob654312 6 years ago
Hi!
I am having the same problem as Wannaduino. Unfortunately, I just decided to try to build this project out of curiosity. I have absolutely zero coding experience, and this is my first Arduino ever! If anyone figured out how to get this project working on a 7-segment LED matrix backpack with only 4 pins (besides the pins to connect the actual LED display), I would really really really appreciate any help I can get. I have not started doing anything to my Arduino yet, as I don't want to mess anything up before even getting started.
Also, how can I connect the LED display to the Adafruit feather HUZZAH with ESP8266? The pins don't match up, since the LED backpack does not have the pins in the same place anymore....
I don't have a lot of money, since I am just a student, and so I really do not want to have spent 25 dollars for nothing. If anyone could help me out, you would really make my day :).
Thank you so much!
bekathwia 6 years ago