Do you get nightmares of losing your YouTube Subscribers? If you do, you are not the only one.Luckily I have made this "YouTube Desktop Notifier" to keep me up-to-date with my channels Subscriber and View Counts. This very simple DIY project cost me around $10 and it now keeps me in track with my channel. Other than displaying the Subscriber and View count this device also "Beeps and Glows" when my channel gains a new subscriber.
Step 1: Hardware Requirement - 1
Step 2: Hardware Requirement - 2
Step 3: Topic Covered
Step 4: The Plan
The plan is to make a 24cm x 10cm box to hold the circuitry in it.
When the device is powered on, it will first connect to the specified Wi-Fi network using the SSID and password pair provided in the code. Once a connection is made the code uses a combination of the "Google API key" (I will show you how to generate it in the later section) and your "YouTube Channels’ ID" to fetch the data from the YouTube server. The device then displays the view and subscribers count using the 7segment display.
After displaying the information it waits for 5 minutes before fetching the next set of information from the YouTube server. A variable is used to store the current subscriber count. If the new subscriber count is greater than the old count the buzzer goes on and the blue and white LEDs flash (glows) alternatively.
Step 5: Wiring
The wiring is very simple. We will start by connecting the 7-Segment displays to the microcontroller. Each of these displays have 4 pins, 2 for power and one for clock and the other one for data. Connect the data and clock pins to NodeMCU as per the instruction provided on screen.
Then we will connect all the VCC pins of the displays to the 3.3V pin of NodeMCU. Next, connect the buzzer shield/buzzer with the 100Ω Resistor to the D8 pin. After that connect the blue and white LEDs to D9 and D10 pins with a 220Ω current limiting resistor respectively.
Now, go ahead and link up all the ground pins to the GND pin of NodeMCU. Once all the pins are connected, connect the switch to the VIN of NodeMCU and GND to GND of the stepdown converter.
https://cdn.instructables.com/ORIG/FRN/WMIR/JQQYN72Z/FRNWMIRJQQYN72Z.fzz
Step 6: Libraries Used
The channel's user and channel IDs are listed under "Account information"Sign in to your YouTube account.In the top right, click your account icon > Settings.From left hand panel click on "Advanced settings".Here is the list of libraries that we need for this project.> Software Libraries:TM1637 LED Driver: https://github.com/avishorp/TM1637ESP8266WiFi: https://github.com/esp8266/Arduino/tree/master/li...Arduino Json: https://github.com/bblanchon/ArduinoJsonArduino YouTube API: https://github.com/witnessmenow/arduino-youtube-a...You can download them all from GitHub, I have provided the links in the description below. Once downloaded unzip and rename the libraries by removing any special characters and the "master" from their names. Place the folder in your Arduino's libraries folder. You may need to create the Libraries folder if this is your very 1st library. Restart the IDE so that it properly loads the KEYWORD file, Examples, and adds the Library to the Library Menu.> Unique Identifiers:WiFi SSID/passwordYouTube channel ID: https://support.google.com/youtube/answer/3250431...Google API Key: https://cloud.google.com/docs/authentication/api-...Along with the libraries you also need few unique identifiers for this project.The first one is the SSID and password of your wireless network.Then, you need your YouTube Channel's unique channel ID. To get that:Sign in to your YouTube account.In the top right, click your account icon > Settings.From left hand panel click on "Advanced settings".The channel's user and channel IDs are listed under "Account information"And finally you need to generate the "Google API Key" for your channel. To generate the keyGoogle search "Using API Keys" or open the link provided in the description below.Scroll down and click on "APIs & Services→Credentials"If this is the very first time you are accessing this page then you will have to create a new project by clicking on the "Create" button.Accept the terms and give your project a name then hit "Create" button to create the projectOnce a project is created you just need to click on the "Create credentials" dropdown and select "API Key" from thereSystem will take its time to generate the key. Once generated, it will show you the key in a popup dialogue. - Copy and save it in your emailNow click on the "Library" option from the left hand panel and
Scroll down and enable "YouTube Data API v3" and "YouTube Reporting API" by clicking on them and hitting the "Enable" button
Wait for 5 to 10 minutes and then you should be able to use the API Key you just generated in your code.
Step 7: Wood Working
Let’s start our project by assembling the wooden box. As discussed earlier, I am going to cut:2 x 24x10cm, 2 x 10x6cm side panels and one 24x10cm back plate. After cutting all the wooden blocks I am going to join and sand them to give the box a nice and smooth look. At the back of the unit I am going to drill 2 holes, one of them would be for the power cord and the other one for the on and off switch.
Step 8: Soldering
Once the box is ready, I am going to solder all the electronics components and install them in the box.I will start by soldering the NodeMCU. Then, I will solder the 100Ω Resistor to the D8 pin of NodeMCU. After that I will solder the buzzer to a perfboard and will link it up to the NodeMCU. Next, I am going to solder the switch and install it at the back of the box. As per the schematic one pin of the switch will connect to the VIN of NodeMCU and the other one to the +ve terminal of the stepdown converter. The -ve end of the converter will connect to the GND pin of NodeMCU. Now, I am going to solder the 7-segments as per the schematic.Next, I am soldering the blue and white LEDs to the D9 and D10 pins of NodeMCU. So, this is how my faceplate looks like. Let me do a quick test before installing the faceplate. Looks like everything is working the way they should. OK, so let me install the faceplate and then I will explain the code to you guys.
Step 9: The Code
These are the list of the libraries that we need for this project. Now, if you are using the same schematic as mine you don’t have to modify anything in this code other than these few lines. You just need to add the SSID and Password of your WiFI network and the Google API Key and the channels ID here. Rest you can leave as is and load the code to the NodeMCU. The "api_mtbs" is the mean time between the API requests made by the microprocessor. Then, I am initializing the displays by setting the clock and the data pins. After that I am setting up the buzzer and the 2 LEDs. In the setup() section I am setting up the LED pin modes and turning the blue LED on at startup. Then I am clearing all the 7-Segments and displaying 0 on display 1 and 3. After that the device will connect to the WiFI network using the provided credentials. In the loop() section when the value of the counter exceeded the api_mtbs or in simple terms, when the time comes to make the next request to the YouTube server, a API call with the channel ID is made and the result is displayed on the serial monitor and on the 7-Segment displays. You need to calculate the MOD of the count received to display the last 4 digits and then subtract the MOD value from the original value to get the first 4 digits. One thing I have noticed is that if the MOD is lets say 24 then the display only displays 24 and not 0024. So we will have to add the missing zeros to the display. This bit of the code is to add the missing 0's. And finally, this bit of the code is to turn on the buzzer and the LEDs when the new subscriber count becomes greater than the old subscriber count. Note: Pin D9 and D10 are the RX and TX pins of the NodeMCU. So, if you connect the LEDs to these pins you will not be able to get anything on the serial monitor. So, during the testing process do not connect anything to the D9 and D10 pins and comment the bit that sets the pin modes for these pins. You can download the code from the link provided in the description below.
https://www.instructables.com/files/orig/F36/T8DQ/JQWT1DT1/F36T8DQJQWT1DT1.zip
Step 10: Future Enhancement
Thanks
Nice Idea @Ashish Adhikari! Thanks for Sharing...
You should check up projects from @Fabrizio Marengo and @Zac Builds , they also have some nice electronics projects