DIY YouTube Subscriber Counter with LCD and ESP8266

Please read this article fully!!

This article is an extension to the recent KARO Episode where I showed how I made the YT Subscriber counter.

With some extra details such as files and dimensions and full parts list, even other can replicate it. PS, This will also be available as a kit for purchase. Be the first to pre-order it so that you don’t miss out!!)

As of now, it has abilities to hold a rechargeable battery, but I did not install it due to size constraints.

The base covering piece is in my case a piece of Ply. But the kit will come with some pure wood that will cover its base.

The kit variant will also come with WiFi Manager inbuilt, so you don’t have to code! Best for those who lik no-code solutions. And best part, everything for under 20USD!!!! The people to pre-order it first will get their kits/assembled devices based on choosing by a specified time. Also, this costs 10 times lesser than other counters in the market and also comes with life-time support since, once released, the code will be made open-source right here!

Well, if you feel like making it on your own, you may. The code and files will be available below. But I would appreciate it if you could take a look at the kit too, since that will also support my lab.

Want to purchase this as a kit or assembled piece?? Click the button below to be redirected to pre-order!!

The Project!

Parts

  • LCD 16*2
  • I2C Backpack for LCD
  • Wires
  • HeatShrink
  • ESP8266/NodeMCU boards
  • TP4056 with USB C
  • Wood
  • 3D Printed Parts

Real TIme assembly video:

It can also be noted that a cradle was also made so that the device can be wall mounted. All parts can be 3D-Printed. But the base alone is made out of wood since it provides a beautiful accent.

The code that will be given below need all credentials to be manually written unlike that of the kit. The Kit will need a one time no-code setup. The code for that and any other changes will be made available once the kits start shipping out

Hand-Coded Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//Special Thanks to Brian Lough for creating the wonderful YoutubeAPI library which ended up being the base of this code
//Code modified to work as a subscriber counting devcie by ESCcrasci from esccrasci.in
//Replace the SSID, PWD, API KEY and CHANNEL ID below for smooth running.
//Works with a 16*2 LCD with I2C
//WIll soon be made available as a kit with a one time no-code system. Feel free to follow me on twitter to be notified when that happens! @ESCcrasci


#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <YoutubeApi.h>
#include <ArduinoJson.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

//------- Replace the following! ------
char ssid[] = "xxxx";       // your network SSID (name)
char password[] = "xxxxxxx";  // your network key
#define API_KEY "ABCDEFGHIJKLMNOPQRSTUVWXYZ"  // your google apps API Token
#define CHANNEL_ID "AAAAAAA" // makes up the url of channel
//------- ---------------------- ------

WiFiClientSecure client;
YoutubeApi api(API_KEY, client);

unsigned long timeBetweenRequests = 1000;
unsigned long nextRunTime;

// #define subscriberCount String

long subs = 0;

void setup() {

  Serial.begin(115200);
   Wire.begin(5, 4);

  // Set WiFi to station mode and disconnect from an AP if it was Previously
  // connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  // Attempt to connect to Wifi network:
  Serial.print("Connecting Wifi: ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  IPAddress ip = WiFi.localIP();
  Serial.println(ip);

  // Required if you are using ESP8266 V2.5 or above
  client.setInsecure();

  // If you want to enable some extra debugging
  api._debug = true;
    lcd.init();
  lcd.display();
  lcd.backlight();
  lcd.print("ESCcrasci");
}

void loop() {

  //lcd.clear();
  lcd.setCursor(0, 0);
  if (millis() > nextRunTime)  {
    if(api.getChannelStatistics(CHANNEL_ID))
    {
      //lcd.println("---------Stats---------");
      lcd.println("Subscriber Count:");
      lcd.setCursor(0,1);
      lcd.println(api.channelStats.subscriberCount);
      Serial.println(api.channelStats.subscriberCount);
      Serial.println("------------------------");

    }
    nextRunTime = millis() + timeBetweenRequests;
  }
}

3D Printable FIles and dimensions for wood:

FILES: (Are to be downloaded from Printables as linked below)

Download from here:

Base wood piece must be of 8.4*4*0.5 cm (L*B*H)

Also, the wood can be left as such as I did or be stained. The assembled version will come with a beautifully finished base piece and stand. The kit will come with an unfinished piece of wood that you can finish yourself!

This project will again be updated once the kit version and assembled version start to ship with no code setup features. So, stay tuned!!

Thank You for reading so far!

Atul

(lab-man ESCcrasci)

Leave a Reply

Your email address will not be published.