Raspberry Pi YouTube Counter

by cheapreviews in Circuits > Raspberry Pi

9909 Views, 58 Favorites, 0 Comments

Raspberry Pi YouTube Counter

main.Still029.jpg
main.Still004.jpg

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:

Explain and Buy

main.Still011.jpg
main.Still009.jpg
main.Still007.jpg
main.Still005.jpg
main.Still008.jpg
main.Still010.jpg
main.Still014.jpg

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.

Supplies

Vizualize, Code, Test, Repeat

main.Still006.jpg
Nested Sequence 05.Still001.jpg
main.Still013.jpg
main.Still012.jpg

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.

RetroPie and Cut Crap Out of Box

main.Still031.jpg
main.Still016.jpg
main.Still015.jpg

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?!?

Screw for Awhile Then Plug

main.Still017.jpg
main.Still018.jpg
main.Still019.jpg
main.Still020.jpg
main.Still021.jpg
main.Still022.jpg
main.Still023.jpg
main.Still024.jpg

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!

Disregard 2nd Amendment Use Hot Glue Gun

main.Still025.jpg
main.Still026.jpg
main.Still027.jpg
main.Still028.jpg

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.

Sleep Soundly. You're Awesome.

main.Still030.jpg
Nested Sequence 10.Still002.jpg

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!