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 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
- Connect the NodeMCU VIN pin to the LCD's I2C VCC pin (may be labelled as VDD).
- Connect the NodeMCU GND pin (may be labelled as G) to the LCD's I2C GND pin (may be labelled as VSS).
- Connect the NodeMCU D1 pin to the LCD's I2C SCL pin.
- Connect the NodeMCU D2 pin to the LCD's I2C SDA pin.
- 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
- 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
- Click the "Library" menu item on the left and search for "YouTube Data API v3".
- Once you obtained the API, click the "Enable" button.
- Go to the left menu again and click on "API'S and Services" option and after that click on the "Credentials" button.
- 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".
- You should now see an alphanumeric code that is your unique API key to work with the "YouTube Data API v3" API.
- Copy the API key as it will be needed to update the Arduino sketch.
- ⚠️ It's important to remember that the API key is private, so you should not share it with anyone.
YouTube Chanel ID
- Go to your YouTube Chanel.
- At the top-right click on your YouTube user profile icon.
- Select the menu option "Settings".
- On the menu located to the left select the option "Advanced Settings".
- Copy your Chanel ID as it will be needed to update the Arduino sketch.
CH340 Drivers
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
- Connect a micro USB cable to the NodeMCU.
- Connect the USB cable to your computer.
- Launch the Arduino IDE.
- Go to File > Preferences and copy this URL into the "Additional Board Manager URLs" text box:
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Click the "OK" button.
- Go to Tools > Board > Boards Manager.
- Search for "esp8266", select it and click the "Install" button.
- Click the Ok button.
- Go to Tools > Board > NodeMCU 1.0 (ESP-12E Module)
- Go to Tools > Port > COM5 or COM6 depending on the USB port it is connected to.
- Go to Sketch > Include Library > Manage Libraries... and install the following libraries:
- YoutubeApi by Brian Lough
- LiquidCrystal I2C by Frank de Brabander
- Download and open the attached file "YouTube_Subscribers_Counter.ino".
- Update the WI-FI Settings variables.
- Update the YouTube API variables.
- 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.
- Go to Sketch > Upload.
- LCD should light up and display your YouTube subscribers count!
Downloads
Optional 3D Printed Case for LCD 20x2
Download the attached filed to 3D print a case and snap-on lid.