Home > News & Updates > Electronics News Updates > Display YouTube Stats on LCD Screen

Display YouTube Stats on LCD Screen

Summary of Display YouTube Stats on LCD Screen


This Instructable demonstrates building a device to display YouTube channel stats (subscribers and views) on an Arduino Uno via a 320x240 TFT LCD. The system updates every minute by fetching data through the Google API, processed by a PHP script, and transmitted to the Arduino via an MQTT broker using an Ethernet shield.

Parts used in the YouTube Stats Display:

  • Arduino Uno
  • Arduino Ethernet Shield
  • 2.8" TFT LCD Arduino Screen
  • Female header connector
  • MCUFRIEND_kbv library
  • GoogleAPI account with developer key
  • MQTT broker (e.g., Mosquitto)

This little Instructable will show you how to use a 320×240 pixel LCD screen connected to an Arduino Uno with a network shield too, to show stats for Youtube channels.

I created this as I wanted to see how many subscribers and views I had on my channels without having to check Youtube 🙂 The stats update on the LCD screen every minute using the google api.

You will need the following:

  • Arduino Uno
  • Arduino Ethernet Shield
  • 2.8″ TFT LCD Arduino Screen

The TFT screen that I’ve used was from banggood.com (http://www.banggood.com/2_8-Inch-TFT-LCD-Shield-Touch-Display-Module-For-Arduino-UNO-p-989697.html). But others may well work.

I’m using the MCUFRIEND_kbv library as this one seemed to work with my screen, so will work with the screen linked to above from banggood.

Step 1: “Build” the Display

Pretty easy to do, just plug the network shield into the Arduino Uno.

The network shield has pass through pins/sockets so that the TFT screen can still plug in on top.

Push the network shield onto the Arduino and make sure you get all the pins in correctly. Once you have it sitting correctly you can push the TFT screen on top. I found using a female header connector between the network shield and the TFT screen helped raise it enough so that it fit over the RJ45 socket.

Step 2: Program Your Uno

The sketch needed to display things on the TFT screen was taken from an example you get with the libraries.

You can download the library from github here :

https://github.com/prenticedavid/MCUFRIEND_kbv

Once you have this installed you can use my sketch which will connect to your MQTT server (which is hardcoded in my sketch as const char* mqtt_server).

You will also have to set the IP address of the network shield, (which is hard coded as IPAddress ip(x, x, x, x);

Step 3: Update Stats on LCD Screen From YouTube Using GoogleAPI

You will need a GoogleAPI account for this next step and you’ll need to create a developer key that you can use in the php script attached here.

You will also need to have a MQTT broker setup, you can either install one on a ubuntu server or use a public one.

You can find more details about setting up Mosquitto (MQTT broker) on a ubuntu server in step 2 of my Instructable “Remote temperature monitoring using MQTT and ESP8266 modules”.

Once you have the MQTT broker working, you can get the Uno subscribed to the broker and the php script will publish the stats to the same MQTT server (in my script it is set to 127.0.0.1).

Read more: Display YouTube Stats on LCD Screen

Quick Solutions to Questions related to YouTube Stats Display:

  • How often do the stats update?
    The stats update on the LCD screen every minute.
  • What library is required for the screen?
    The project uses the MCUFRIEND_kbv library.
  • Can I use a different TFT screen?
    Other screens may work, but the author used one from banggood.com that is compatible with the specified library.
  • Do I need a specific network setup?
    You must set the IP address of the network shield and ensure the Uno is subscribed to an MQTT broker.
  • How is the data retrieved from YouTube?
    Data is fetched using the Google API and processed by a PHP script attached to the project.
  • Where can I find the code sketch?
    The sketch connects to an MQTT server and utilizes examples from the installed libraries.
  • Is a local MQTT broker mandatory?
    You can either install a broker on a Ubuntu server or use a public one.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top