I was inspired by the Play Button awards YouTube sends out for subscriber milestones, and built this circuit to display my realtime subscriber count using an ESP8266 wifi board and seven segment display. I built this one to celebrate surpassing 10k subscribers, so this is an upgrade to my previous counter, which only supports counts up to 9999. Personalize the code to work with your channel!
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 a more in-depth introduction to the ESP8266 board (and its installation and setup), check out my free Internet of Things Class.
For this project, you will need the following materials:
Medium shadow boxPrinter and paperScissorsCutting mat or scrap cardboardIllustration board or more scrap cardboardUtility/craft knifeMetal ruler (optional)TapeGlue stickNodeMCU ESP-12E board2x 4-digit 7-segment display with i2c backpackSolderless breadboard and breadboard wires (optional but recommended for prototyping)perma-proto board or other perfboardMicro USB cable (charge + sync, not charge-only)USB power adapter (optional)and the following tools:
Soldering iron and solderFlush diagonal cuttersDesoldering braid or solder sucker (for mistakes) Required software libraries:
Arduino YouTube APIArduino JsonAdafruit GFXAdafruit LED BackpackUnique data required:
Google API key YouTube channel IDWifi network name/passwordAs an alternative to the NodeMCU board, you can also use your favorite ESP8266 microcontroller board, some of which require an FTDI cable to upload new programs.
Before you dive into 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 my Internet of Things Class):
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): http://arduino.esp8266.com/stable/package_esp8266c…Click OKGo to Tools->Board-> Boards Manager…Search for ESP8266 and click the Install button in the box “esp8266 by ESP8266 Community” when it shows upTo ensure you have a proper programming connection with your board, first load up the blink sketch. You can find a sample blink sketch by navigating to File->Examples->ESP8266->Blink, or copy it from here:
void setup() { pinMode(LED_BUILTIN, OUTPUT);}void loop() { digitalWrite(LED_BUILTIN, HIGH); delay(500); digitalWrite(LED_BUILTIN, LOW); delay(500);}Plug in your USB cable to the board and configure your settings under the Tools menu as follows:
Board: NodeMCU 1.0CPU Frequency: 80MHzFlash Size: 4M (3M SPIFFS)Upload Speed: 115200Port: 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 many boards auto-detect when they’re being sent a new program, some 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. Seriously, because how can you expect the project code to upload if the test didn’t? =D”