This is a step-by-step guide that I have created for beginners and arduiNOOBS like me.
In this tutorial, we will go through the steps necessary to enable and obtain our API key from Google Cloud Resource Manager and use it to login and view our Youtube Channel Statistics by using a D1 Mini Board and a 16x02 LCD with I2C backpack.
I also want to say thank you to all the developers and programmers in the Arduino and Github Community who share their creations for free and for everyone to use. You guys are awesome!
NECESSARY LINKS:
ESP8266 LIBRARY: https://gist.github.com/carljdp/e6a3f5a11edea63c2c14312b534f4e53
ESP8266 BOARDS MANAGER URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json
YOUTUBE API: https://github.com/witnessmenow/arduino-youtube-api
ARDUINO JSON: https://github.com/bblanchon/ArduinoJson
GOOGLE DEVELOPERS: https://developers.google.com/
GOOGLE CLOUD RESOURCE MANAGER: https://console.developers.google.com/cloud-resource-manager
WeMos WIKI: https://wiki.wemos.cc/products:d1:d1_mini
Social Media Links To Follow (I mean, if you want to):
Facebook - https://fb.me/HeathenHacks
Twitter - https://twitter.com/HeathenHacks
Instagram - https://instagr.am/HeathenHacks
Project Overview
"Tube-Stats" is a definitive application of Cloud-Data Forensics and Asynchronous RESTful Handshaking. In an era of high-velocity social metrics, manual tracking is inefficient. Tube-Stats leverages the Wemos D1 Mini’s ESP8266 core to establish a secured TLS link with Google’s Cloud Infrastructure. By parsing real-time JSON payloads from the YouTube Data API V3, the system provides a persistent, hardware-based HMI for monitoring subscriber growth, view counts, and video volume with industrial-grade precision.
Technical Deep-Dive
- RESTful API Handshaking Forensics:
- The HTTPS Security Layer: The D1 Mini must handle SHA-1 fingerprinting or modern Root-CA validation to establish a secure SSL/TLS tunnel to
googleapis.com. The forensics involves the construction of a specific GET request containing the localized "Channel ID" and the unique "API Key," ensuring that the telemetry request is authenticated within Google’s quota-management diagnostics. - Recursive Polling Harmonics: To prevent excessive API unit consumption, the firmware implements a deterministic polling interval. This timing forensics ensures that the channel metrics are refreshed frequently enough for live-monitoring while remaining well within the developer-tier request limits.
- The HTTPS Security Layer: The D1 Mini must handle SHA-1 fingerprinting or modern Root-CA validation to establish a secure SSL/TLS tunnel to
- JSON-Buffer Diagnostics:
- ArduinoJson Memory Mapping: YouTube returns a complex, nested JSON object. The project utilizes the
ArduinoJsonlibrary to perform Memory-Pool Forensics, dynamically allocating a specific buffer to extract key-value pairs (e.g.,subscriberCount,viewCount). This process requires precise memory diagnostics to prevent heap-fragmentation on the ESP8266’s limited RAM. - Data-Type Quantization: Raw API strings are converted into 64-bit integers to handle large-scale metrics $(>1,000,000\text{ views})$, ensuring the HMI display does not suffer from integer-overflow artifacts.
- ArduinoJson Memory Mapping: YouTube returns a complex, nested JSON object. The project utilizes the
Engineering & Implementation
- I2C Bus & Visual Telemetry:
- I2C Protocol Diagnostics: The 16x2 LCD is interfaced via an I2C backpack $(\text{Address: 0x27 or 0x3F})$. This reduces the required GPIO pin-count to just two (SDA/SCL), facilitating a clean mechatronic assembly. Resistor-pullup diagnostics on the backpack ensure that the signal-rise times are sufficient for high-speed bus communication.
- Adaptive String Formatting: The LCD forensics includes a specialized routine to format large numbers with commas or "K/M" suffixes, maximizing the readability of the social metrics within the limited 32-character visual footprint.
- API Security Best-Practices:
- Credential Obfuscation: The project emphasizes the importance of managing API keys. Field diagnostics recommend storing credentials in a separate
.hfile or using environment variables to prevent accidental key-leakage during public code deployments.
- Credential Obfuscation: The project emphasizes the importance of managing API keys. Field diagnostics recommend storing credentials in a separate


Conclusion
Tube-Stats demonstrates the successful integration of Web-Services and Embedded I/O. By mastering API Forensics and JSON Diagnostics, Heathen_Hacks-v2 has delivered a robust, interactive social telemetry node that serves as a cornerstone for content creators and IoT engineers looking to bridge the gap between cloud-data and physical displays.
