Introduction: YouTube Subscriber Counter
I always wanted a YouTube Subscriber Counter that look good and clean. With the availability of e-paper displays for hobbyists like us, this idea became a reality and I've seen many people doing it, but I want to take my own approach and make the process as easy as possible for anyone that wants to build their own.
PCB sponsored by PCBWay - Full feature custom PCB prototype service: https://www.pcbway.com/
It runs on AA x4 batteries and thanks to the high efficiency of the components used, it can run for many months and even years without having to replace the batteries.
I include the sketch (code) file, the links to buy the parts, the STL files for 3D printing and I even include the gerber files so you can order the custom PCB to facilitate soldering the components.
- It shows the amount of subscribers and views of your YouTube channel.
- You can select to show the complete numbers or an abbreviation (1,234 → 1.23K). On 2019 YouTube started to abbreviate the subscriber count so even if you select to see the full amount, it's going to show a bunch of zeros to the right depending on the value (1,234,567 → 1,230,000).
- It shows the date and time from the last update, using NTP servers.
- Optimized to use as little power as possible, in case you use batteries. This includes turning OFF Wi-Fi when not in use, reducing CPU speed and going to deep sleep mode when waiting for the next refresh. Also, we can control the power of the display with a NPN transistor to be able to turn ON the display only when updating.
- You can set to wake up and refresh the data every X amount of seconds or set the time of day (example: 3AM) where you want to update the screen. It uses the data taken from the time server to calculate for how long to stay sleep, depending on the set interval.
- Warning Indicator - Connection:
- No Wi-Fi: The icon is 4 bars with an X over it.
- No Internet: The icon is a globe with an X over it.
- Low Battery: The icon is a battery with a small line, as almost empty.
- Battery Empty: The icon is a battery with nothing inside and an X over it.
- Compact design.
- It can be hang in a wall or stand in a flat surface using the retractable leg.
- Since we use a e-paper display, it doesn't produce light so it's not intrusive in the room is at.
- Power consumption:
- Average current when updating: 45mA
- Current when deep sleep: 0.014mA
- Maximum amount of subscribers and views allowed is 999,999,999,999,999.
- The wake up time can be off by several minutes or even hours.
- The time shown when it refreshes after a long deep sleep can be off by several minutes. I'm not sure why this happens and I could not find a solution, but it shouldn't matter that much if you choose to wake up every day. When resets, we get an accurate time, but when it wakes up after deep sleep, the longer it stays sleep, the larger the time shown is off.
- All the warning indicators can refresh only when we do a complete refresh cycle so don't expect them to update in real time.
- E-Paper Display 7.5 inch 3 colors (black, white and red) 800x480 https://amzn.to/30LZ8Gn or 880x528 https://amzn.to/30LZ8Gn
- ESP-WROOM-32E, ESP-WROOM-32D or ESP-WROOM-32 bare module (not a development board) https://amzn.to/2AJ4uaL or you can use a development board if you plan to use it with a plugged power supply https://amzn.to/3gi5yTI
- UART USB to TTL serial converter https://www.ebay.com/itm/362514706922
- Battery Holder AAx4 https://amzn.to/34tiOi0
- Shadow Box 6x8inch with an inside space of at least 1.1inch/28mm deep https://amzn.to/3avcKYB
- Frame Mat 6x8 for 4x6 pictures. I find that it's cheaper to buy a frame that comes with the mat that trying to buy a mat separately https://amzn.to/2VUHITJ
- Resistors 1K, 10K x2, 300K, 470K https://amzn.to/2A2gHE6
- Electrolytic Capacitors 100µF 16V x2 - It's important to buy good quality capacitors and that they are small enough to fit the enclosure that you are going to use. This is what I choose: https://www.digikey.com/products/en?keywords=Ruby...
- Ceramic Capacitor 0.1µF https://amzn.to/3xfAL0N
- Push Buttons 6x6x4.3mm x2 https://amzn.to/3zi76WD
- Voltage Regulator with low dropout voltage and low quiescent current. The best I found is the HT7333-A https://amzn.to/3538b5K
- NPN Transistor S8050 https://amzn.to/2yk6HYV
- PCB 5x7cm - You have two options: either buy a prototype PCB made for ESP32 https://amzn.to/3cvSsB6 so you have to make all the connections yourself, or order a custom PCB on PCBWay for $5 with my gerber files.
- M3 HEX screws of different sizes (12mm, 8mm, 4mm) and nuts https://amzn.to/3e44FMp
- M2x6mm HEX screws https://amzn.to/3fdb0Ff
- Washers 3x7mm x8 https://amzn.to/3fvwehO
- 2.54mm male and female pin header https://amzn.to/2xYcOlK
- Printable Sticker Paper https://amzn.to/3wbS6HR
Recommended tools for this project:
- Loctite Liquid Professional Super Glue https://amzn.to/2N7d1He
- Wera 1.5-10mm Hex-Plus Key https://amzn.to/2N4gXYW
- 6-inch Zip Ties https://amzn.to/2N6QCcQ
- Scotch Painter's Tape https://amzn.to/2AMfeFb
Note: As an Amazon Associate I earn from qualifying purchases.
- Arduino IDE Sketch for ESP32 https://drive.google.com/file/d/1tJhNqMnc8c1OAT0K...
- 3D Printed Parts https://drive.google.com/file/d/19Vge7TitSMUwSJiO...
- Custom PCB Gerber Files https://drive.google.com/file/d/1YFNecsEBCawaHT2a...
- Bill Of Materials (for PCB) https://drive.google.com/file/d/1x66G8-Xzb3y3FEJR...
- Stickers https://drive.google.com/file/d/1K-dbW-8a-SY7SGF0...
Step 1: Test the Display
If you have an ESP32 Development Board (I recommend you do), or an arduino uno/nano, test the display with an example code or maybe the main sketch of this project.
Here's a video tutorial to help you with this:
Connection from the E-Paper Display to the ESP32:
- BUSY = 4
- RST = 16
- DC = 17
- CS = SS (5)
- CLK = SCK (18)
- DIN = MOSI (23)
- GND = GND
- 3.3V = 3.3V
If you never used an ESP32 on your Arduino IDE, you need to install the board going to "File > Preferences" and add this link in "Additional Boards Manager URLs": https://dl.espressif.com/dl/package_esp32_index.json
Then go to "Tools > Board > Boards Manager...", search for "ESP32" and install it.
Remember that you also need to install a few libraries:
- ArduinoJson 6.x - You need to choose version 6.x since the older version 5.x doesn't work: https://www.arduinolibraries.info/libraries/arduino-json
- GxEPD2: https://github.com/ZinggJM/GxEPD2
- Adafruit GFX Library: https://github.com/adafruit/Adafruit-GFX-Library
Step 2: Get YouTube API Key and Channel ID
In the sketch you need to add, beside the network name and network password, the YouTube Channel ID and YouTube API Key for your channel.
To get your YouTube Channel API Key, go to the Google API webpage: https://console.developers.google.com and make sure you are logged in to your gmail account.
In the "Dashboard", click "Create Project". Choose a name for the project and click "Create".
You should see "Enable APIS and Services". Click that and then write in the search box for "YouTube Data API v3". Enable it and "Create Credentials". In the page to create credentials you'll see in small letters the link to create a "API key". Then click "API restrictions" and select "YouTube Data API v3". Click create and then you'll see your key, which you need to add on the sketch.
You also need your Channel ID. You can find it in your advanced account settings. In the top right, click your profile picture and then Settings. From the left Menu, select Advanced settings. You'll see your Channel ID.
Test the API is working by going to this address in your browser: https://www.googleapis.com/youtube/v3/channels?part=statistics&id=PutYourYoutubeID&key=PutYourYoutubeAPIKey
Replace "PutYourYoutubeID" with your YouTube ID and "PutYourYoutubeAPIKey" with your API key.
Step 3: Solder Components to the PCB
You could use an ESP32 development board, but they consume too much power when they are in deep sleep mode, and since I wanted to use batteries, I decided to use a bare ESP32 module and solder the minimum components to it. Sounds annoying, but it's not as complicated as you might think. I even solder everything with a traditional soldering iron, instead of a heat gun. To make it easier, I designed a PCB especially for this project, and you can order it from PCBWay (sponsor) using my gerber files.
It cost just $5 USD for 10 PCBs and the process is very simple.
I listed all the components that goes on the PCB, but there's one that requires some testing before soldering. I choose this voltage regulator (HT7333-A) because is very efficient consuming very little power while not having a load, but I discovered that not all units have the same performance. I bought a bunch of them and I measured the current without a load to see which one is the best to use in my PCB. This is because I want the batteries to last a long time and it's critical to get very low power consumption when the ESP32 is in deep sleep mode. So you should test them without a load and choose the one with least power consumption.
Step 4: Assembly - Display Frame
Remove the protective film from the display and attach the display to the [Display Frame] 3D printed part. I like to keep everything in a way that allows taking everything apart, just in case, so I recommend using something like masking/painter's tape to attach the E-Paper Display to the [Display Frame].
Step 5: Assembly - Display Ribbon Flex Cable Adapter
Screw the small Ribbon Flex Cable Adapter to the [Display Board Support] 3D printed part using the M3x4mm HEX screws. It should go directly into the plastic so there's no need for nuts.
Step 6: Assembly - Display Board Support
Glue (I recommend Loctite Super Glue) the [Display Board Support] to the [Display Frame] in a way that the Ribbon Flex Cable, when connected to the display, has a natural curvature and aligned correctly. This cable is usually not perfectly centered in the display so that's why we need to glue this part accordingly to each display.
Step 7: Assembly - Spacers
Glue one [Spacer] on each corner of the [Display Frame]. Make sure they don't come out from the frame because then it would not let the frame fit the Shadow Box.
Step 8: Assembly - Battery Holder
Place the Battery Holder on the [Back Cover] and apply glue around the sides. The Battery Holder should fit flat and level in the inside edges of the [Back Cover].
Step 9: Assembly - Modify the UART Module
Prepare the UART Module for installation. First, drill 2mm holes where the screws go, since the holes that come by the factory are too small to be useful. The second thing to modify is to reinforce the USB connector, adding more solder on the pads on each side of the USB connector.
Step 10: Assembly - UART Module
Screw the UART Module to the [Back Cover]. Use M2x6mm HEX screws for that. It should go directly to the plastic so there's no need for nuts.
Step 11: Assembly - Buttons
Glue the [Buttons] to the [Back Cover].
Step 12: Assembly - Wall Mount Cover
Glue the [Wall Mount Cover] to the [Back Cover].
Step 13: Assembly - Modify the Display SPI Module
The E-Paper Display should come with a module that adapts the Ribbon Flex Cable to the SPI protocol. This module is a bit too thick so we need to modify it by removing the Raspberry Pi connector. It's surprisingly easy to remove. Just use pliers and pull it off. Remove also the little pieces of metal from the connector that might remain in the module.
Step 14: Assembly - Display SPI Module
Install the Display SPI Module to the [Back Cover] using 4 M3x12mm HEX screws and 4 M3 nuts. The nuts should go in the inside part of the [Back Cover], leaving the screw heads on the outside.
Step 15: Assembly - Main PCB
Screw the main PCB with all the electronic components to the [Back Cover] using 4 M3x12mm HEX screws and 4 M3 nuts. The nuts should go in the inside part of the [Back Cover], leaving the screw heads on the outside.
Step 16: Assembly - Cables
Place all the cables and secure them with zip ties. It's also a good idea to label the connectors, if you choose to use connectors. Make sure to test everything again.
Step 17: Assembly - Leg
Join the [Leg] and [Leg Support] and put them on the [Back Cover] with 4 M3x8mm HEX screws and 4 M3 nuts. The nuts should go in the inside part of the [Back Cover], leaving the screw heads on the outside.
Step 18: Assembly - Lock Clips
To install each [Lock Clip] on the [Back Cover], make sure to place the hardware in the right position. First you put a 3x7mm washer in a M3x12mm HEX screw, then insert on a [Lock Clip], after that it goes another washer. Place it on one of the corresponding holes of the [Back Cover] and put 2 M3 nuts on the other side. We use two nuts to lock them to each other and prevent them from unscrewing them-selves accidentally.
Step 19: Assembly - Hole on Shadow Box for Lock Clips
My shadow box came with some flaps that I removed because they brake too easily after bending them a few times. Now we are ready to put the display assembly and the back cover assembly into the Shadow Box. Remember to place the Frame Mat too. All this will allow us to mark where the holes should be made for the locking clips to extend and support the back cover assembly against the Shadow Box.
Step 20: Final Assembly and Stickers
Connect everything and put everything on the Shadow Box in the following order:
- Transparent Front Cover (make sure to remove the protective film on each side)
- Frame Mat
- Display Assembly
- Connect the Ribbon Flex Cable for the display
- Turn the Battery Holder (switch) ON and put the [Back Cover] on the Shadow Box
The last touch is adding some stickers in the [Back Cover] to indicate the buttons and the USB connector.
1 Person Made This Project!
- aguyngueran made it!