Introduction: Raspberry Pi YouTube Counter
In this Instructable, I will walk you through, in hopefully great detail, how I constructed a real time Raspberry Pi YouTube subscriber count display for my house. This is the solution to my problem of always wanting to know how many subscribers I have. So let's get building!
Here's the video I made about the build:
Step 1: Explain and Buy
When you make YouTube videos, it's hard to not let the numbers get to you. You spend so much time making videos, you start to judge them based on how well they did. How many views? How many likes? Am I valued as a person/animal? The ultimate visible metric for this is YouTube subscribers.
Before this build, I was checking to see if I had any new subscribers multiple times a day through the Real time YouTube subscriber count webpage by Akshat Mittal. It served its purpose well, but I wanted to see some glowing red numbers at all times, so I conceptualized and executed this build. You're not there yet though. You need my direction young Padawan so let's start off with the supplies.
- Raspberry Pi Zero: goo.gl/HQ0VEr
- Micro SD Card with Raspbian Installed
- Display: https://goo.gl/Zwtlv6
- Paper Mache Box: goo.gl/pOUHXE
- Bluetooth dongle: http://amzn.to/2iASjhe
- Mini Hdmi to Hdmi: http://amzn.to/2iASjhe
- Micro USB to USB adapter: http://amzn.to/2iBuiGx
- Reset switch: http://amzn.to/2iASjhe
- Keyboard: http://amzn.to/2iASjhe
- Four Port USB Hub: http://amzn.to/2iGrU4M
- Micro USB Cables (6" and 6')
- 2.5 mm nuts (x8)
- 2.5 mm bolts (x4)
- 3 mm standoffs (x4)
- 3 mm nuts (x4)
- 3 mm bolts (x4)
- Hot glue gun
- Screw driver
- Positive Attitude
- DuPont Connector Cable (x5)
Step 2: Vizualize, Code, Test, Repeat
I had a pretty clear picture in my head on what I wanted to do and all of my parts hadn't arrived, so instead of twiddling my thumbs, I made a SketchUp of the device I was trying to create. I basically wanted a box with a number on the front that said how many YouTube subscribers I wanted.
Next I had to figure out how the heck I was going to send numbers to the display to print. This is the part of the Instructable where I give people credit for all the great scripts that they wrote that I then pieced together by barely even modifying. This took me awhile, but I was finally able to get a working script thanks to the fantastic work by Richard Hull et al in reference to the MAX7219 display. They give you a step by step guide on how to setup the seven segment eight digit MAX7219 with a Raspberry Pi as well as all the necessary wiring information. Please find my picture of the wiring in the pictures for this step. You might notice that I powered the display using the 3.3v GPIO pin on the Pi. I did this to prevent frying the board, but feel free to leave a comment about how that is wrong because honestly I'm stabbing in the dark with a butter knife.
Then I had to figure out how to find out from Google how many YouTube Subscribers I had. I pulled some insight from this Stackoverflow Question and the Google YouTube Api documentation.
My script can be found here: http://pastebin.com/id6EE69M
In a lame man's words, my script basically calls up Google and says, "Hey how many YouTube subscribers does Eric from CheapAssReviews have." It then takes that number and pushes it to the MAX7219 display. If it cannot reach Google for comment, the screen goes dark. It repeats this approximately every second as long as the device is on.
This script is run at startup as as a service. I followed the instructions laid out by the legendary SC Phillips in his fantastic blog post.
With that all working, I now wanted to see if it was possible to still utilize the Raspberry Pi for some retro gaming.
Step 3: RetroPie and Cut Crap Out of Box
I mentioned earlier that I was also going to do some retro gaming on this machine. In order to do this, I installed RetroPie on top of my existing Raspbian distribution. There are some great instructions on how to do this on the Github page for RetroPie.
With that out of the way it was time to smash all the parts into a box and call it good. I first drew out how I thought all the pieces would fit. This was basically my sketch up diagram from before. Then I made the cuts by lining up the pieces in the box to fit that location. I used an Exacto knife and scissors to complete this, but this may change for you if you use a different box, or maybe something different entirely. A stuffed animal real time YouTube subscriber counter?!?
Step 4: Screw for Awhile Then Plug
Basically I just screwed everything in at this point. The 3mm nuts and bolts were for the MAX7219 seven segment eight digit display and the other nuts and bolts were for the Raspberry Pi. For the MAX7219 disply, I first threaded the bolts through, then attached the standoffs. Next I slipped on the display and then attached the bolts. I repeated the process for the Pi with the 2.5mm bolts, then the nuts, then the Pi, then another set of nuts to hold it down.
I used a five wire ribbon cable with DuPont connectors on each end to plug the Pi into the the display. The wiring diagram can be found in the previous step. Next I plugged in the ON/OFF switch to the RUN pins on the Pi. I was getting very pumped at this point and couldn't wait for the next step!
Step 5: Disregard 2nd Amendment Use Hot Glue Gun
I lit my small fire arms permit on fire and as it burned I used my hot glue gun to make some of the pieces stay in place with more strength and determination. WOOORAW. This meant more glue for the HDMI adapter, the ON/OFF switch and the USB four port hub. I also added some Velcro to keep that damn lid on. It worked out well, but next time I'd probably use magnets, or a clasp.
Now there's nothing to do, but turn it on and bask in the red light of your real time YouTube subscriber count. Or wait.... maybe there's one more step.
Step 6: Sleep Soundly. You're Awesome.
That's right. Remind yourself that you're awesome. Not only did you complete this Instructable, you now have a realtime YouTube subscriber count for your house. You are the most beautiful little snowflake. Because it has built in power, it's portable and you can bring it with you. I carry mine around with me whenever I'm home. Oh and I leave it on my nightstand every night. Nothing better than waking up to the glowing red embers of a new subscriber. That's it! Hope you make something awesome today!
We have a be nice policy.
Please be positive and constructive.