Introduction: SocialStats - Combine Statistics of Your Favourite Social Media
Ever seen some of those fancy subscriber displays and said "I wish I had one of those"? After a quick search online you would soon give up on that, because it costs $400 on average, with really good ones costing up to $1200. A bit pricey for a gadget, wouldn't you agree?
Using this instructable, you can make one yourself for under $70! Interested? Let's take a look!
Step 1: Make an Account
Go to my website and register for a free account. Confirm your email address and log in.
Step 2: Adding Modules to Your Dashboard
After logging into your account on https://socialstats.motbrok.com/login, you can jump right in and add modules. You can add up to 3 modules. Supported modules are Instagram, Twitter and Youtube. Just type in your username and hit refresh to make the API fetch your statistics.
Step 3: Add a Device
After you have added the modules you wish to display, click on the "Add Device" option to generate your personal link. You will need this link later in your python code to link your device to your account.
Step 4: Materials
In order to be able to build the device, you obviously need the parts that are required to build it. This is a handy shopping list:
Step 5: Connecting the Hardware
Follow the fritzing images precisely. The 7-segment display has 12 pins. 4 of those are for powering a digit, so they don't need a resistor. Pin number 12 is for digit 1, pin 9 for digit 2, pin 8 for digit 3 and pin 6 for the 4th digit. The other pins (8) are for powering the 7-segments (7 pins) and the dot in the corner (1 pin).
Connect your indication-LED's to GPIO 26 for youtube indication, GPIO 19 for twitter and GPIO 13 for instagram. Use a resistor for the indication-LED's. All resistors should be between 220 ohm and 1 Kohm.
Step 6: The Code
The coding part will consist out of 4 small steps
- Step 1:
- go to https://github.com/Motbrok/socialstats/blob/master/device/socialstats.py and copy the code.
- Make a file on the raspberry pi called socialstats.py using the "sudo nano your/directory/of/choice/socialstats.py" command.
- Paste in the code.
- Copy your link you created earlier on https://socialstats.motbrok.com/dashboard.
- Paste it in socialstats.py in place of the PUT_YOUR_LINK_HERE
- Save your socialstats.py file by pressing ctrl+x followed by "y" and "enter"
- Make a shell script by using the "sudo nano your/directory/of/choice/launch.sh" command.
- Copy and paste the code from https://github.com/Motbrok/socialstats/blob/master/device/launch.sh and replace your/directory/of/choice with your directory you chose earlier, that contains your socialstats.py file.
Save your launch.sh file by pressing ctrl+x followed by "y" and "enter"
- Add it to the startup using crontab. Use following command: "sudo crontab -e"
- Scroll to the bottom of the file and enter the following line of code: "@reboot sleep 20 /directory/to/your/shellscript/launch.sh"
- Save your cronjob.
This will ensure that your python script will be launched from the correct directory (thanks to our shell script) and will automatically start 20 seconds after starting your Raspberry Pi.
Step 7: Glamour [OPTIONAL]
Using your GLIS box from Ikea, carefully place your device inside. Some clear plastic can be used to print logo's on for the social media you wish to use. Place the correct indication-LED behind the corresponding logo. This step is optional because you can style your SocialStats-device to match your desktop environment or taste. I finished mine of with a mate black top finish but kept the rest of the box clear so you can take a peak at the wires from the side.
Have fun with your SocialStats-device!
We have a be nice policy.
Please be positive and constructive.