YouTube Subscribers Counter ESP8266 LCD IoT

by Castor Studios in Circuits > Arduino

519 Views, 0 Favorites, 0 Comments

YouTube Subscribers Counter ESP8266 LCD IoT

Build a YouTube Subscribers Counter

Build this simple YouTube subscribers counter that updates every minute and has the number formatted with a thousands separator (comma).


Supplies

  • NodeMCU ESP8266 Wi-Fi SoC
  • Can use any version of NodeMCU.
  • Micro USB cable
  • LCD 20x2 with I2C Module
  • You can use other types of LCD's such as the more common 16x2 or 20x4 as long as it has the I2C module.
  • 4 Wires of approximately 10 cm (4") in length.
  • 3D Printer (optional)

Connecting the NodeMCU to the LCD I2C Module

chrome_2022-01-01_22-36-27.png
  1. Connect the NodeMCU VIN pin to the LCD's I2C VCC pin (may be labelled as VDD).
  2. Connect the NodeMCU GND pin (may be labelled as G) to the LCD's I2C GND pin (may be labelled as VSS).
  3. Connect the NodeMCU D1 pin to the LCD's I2C SCL pin.
  4. Connect the NodeMCU D2 pin to the LCD's I2C SDA pin.
  5. On the LCD's I2C module, the two pins for LED might not be connected, connect them together if you want the background to be lit up.

YouTube Data API V3

  1. Now that everything is wired up we will be needing to use the YouTube V3 Google API to get the data. First go to https://console.developers.google.com
  2. Click the "Library" menu item on the left and search for "YouTube Data API v3".
  3. Once you obtained the API, click the "Enable" button.
  4. Go to the left menu again and click on "API'S and Services" option and after that click on the "Credentials" button.
  5. At this point you should be on the Credentials page and you should see a button to create a new API key with the text "+ Create Credentials", just click it then click on "API key".
  6. You should now see an alphanumeric code that is your unique API key to work with the "YouTube Data API v3" API.
  7. Copy the API key as it will be needed to update the Arduino sketch.
  8. ⚠️ It's important to remember that the API key is private, so you should not share it with anyone.

YouTube Chanel ID

  1. Go to your YouTube Chanel.
  2. At the top-right click on your YouTube user profile icon.
  3. Select the menu option "Settings".
  4. On the menu located to the left select the option "Advanced Settings".
  5. Copy your Chanel ID as it will be needed to update the Arduino sketch.

CH340 Drivers

DRVSETUP64_2022-01-08_22-54-10.png

Basically, let me put it this way. Buy from Chinese site, get Chinese drivers. I got my drivers from here. If you do not install the CH340 drivers you will not be able to program the ESP8266.

Programming the NodeMCU

  1. Connect a micro USB cable to the NodeMCU.
  2. Connect the USB cable to your computer.
  3. Launch the Arduino IDE.
  4. Go to File > Preferences and copy this URL into the "Additional Board Manager URLs" text box:
  5. http://arduino.esp8266.com/stable/package_esp8266com_index.json
  6. Click the "OK" button.
  7. Go to Tools > Board > Boards Manager.
  8. Search for "esp8266", select it and click the "Install" button.
  9. Click the Ok button.
  10. Go to Tools > Board > NodeMCU 1.0 (ESP-12E Module)
  11. Go to Tools > Port > COM5 or COM6 depending on the USB port it is connected to.
  12. Go to Sketch > Include Library > Manage Libraries... and install the following libraries:
  13. YoutubeApi by Brian Lough
  14. LiquidCrystal I2C by Frank de Brabander
  15. Download and open the attached file "YouTube_Subscribers_Counter.ino".
  16. Update the WI-FI Settings variables.
  17. Update the YouTube API variables.
  18. If you are NOT using a 20x2 LCD display please ensure to update line #59 "lcd.begin(20,2);" where 20 is the number of columns and 2 is the number of rows your LCD can display.
  19. Go to Sketch > Upload.
  20. LCD should light up and display your YouTube subscribers count!

Optional 3D Printed Case for LCD 20x2

IMG_0709.JPEG

Download the attached filed to 3D print a case and snap-on lid.