Social Stats Counter




About: Hey everyone! My name is Brian and thanks for checking my Instructables. I'm a software developer by trade but I've recently gotten into Arduino development after discovering the esp8266 chip, a WiFi enab...

Hey Everyone,

This is a instructable for a social media stats counter, that fetches and displays data from Facebook, Twitter, YouTube and Instructables. I've seen commercial solutions for this cost over $400, but the total cost of this project was less $20.

These days there are APIs for everything! With this project I wanted to show how the ESP8266 can be used to integrate with these APIs.

There are 4 arduino libraries that I have written used in this project that integrates with the APIs. The YouTube one you might have seen before (bekathwia uses for a really cool project), but I wrote 3 new APIs just for this project: one for Twitter, Facebook and one for Instructables. These APIs allow you to connect to the various services and fetch data from them, directly from the ESP8266. Each of these libraries can be used individually if you have a project where you want to fetch the data from just one of these endpoints.

To be honest I wanted to add more to this project before submitting, such as Instagram and Twitch but I just ran out of time as I wanted to submit for the microcontroller competition. The project could easily be extended in the future though.

Hopefully you find the project interesting and please let me know if you have questions.

So lets get started!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts

Let's first take a look at the parts we need for this project.

There are two core parts to the project (the ESP8266 and the LED Matrix display), everything else could be done however you would like to, but I'll list what I used anyways.

Step 2: Soldering the MAX7219

You will need to solder the MAX7219, it's pretty straight forward soldering though.

NB: Don't do what I have done in some of the photos and solder straight pins, it doesn't fit in breadboards! (I broke the board while de-soldering them and had to add a manual wire direct to the chip!)

First solder the angled pin headers. You want to position the pin headers so the small straight side is sticking through the board, so the angled side and the plastic is on the same side as the chip. Solder both sides for all 4 boards. I'd recommend holding them in place using blu tac to make it easier.

Then you want to solder the LED Matrix. I recommend sticking the pin header that came with it onto the LED matrix all the way before you solder, as shown in the picture. Leave the pin header connected on both sides and insert it into the board. NOTE: There is a lip on the white plastic of the LED matrix on one side, make sure that is aligned on the same side of the board as shown in the picture. Solder the pin headers in while still connected to the LED matrix to ensure they are lined up straight. Do it for all 4 boards.

Step 3: Wiring the MAX7219

Arranging the MAX7219 is a little complicated. and you definitely want to test it out before sticking it in place.

  1. Download and install this library as per it's instructions.
  2. Load the example from the library
  3. Wire up the first MAX7219 board as follows (make sure to use the pins labeled IN):
    VCC -> 3.3v
    GND -> G
    DIN -> D7 (GPIO13)
    DS -> Defined by CS_PIN in the example sketch (I went with D3)
    CLK -D5 (GPIO14)
  4. The first board will be the furthest right in your display. The side with the IN pins will be the top.
  5. Connect the output pins of the first board and connect it to the IN pins of the second board, it should be placed to the left of the first. Repeat for the remaining boards.
  6. Run the example sketch, you should see the text animate on the screens.

One thing that I take advantage of in the project is VCC ,GND, DS, and CLK are all common pins on the input and output. so when wiring up I connected those pins only to the OUT pins, and only connected DIN as described above, this cut down on the amount of wires needed.

Step 4: Install the API Libraries

All the libraries you need to install are available on the Arduino Library Manager, which you can open by clicking Sketch -> Include Library -> Manage Libraries
(Note: if the search returns more than one, install the one where the Author is Brian Lough)

To use the Twitter, Facebook and Youtube APIs you need to get API keys. Instructions are provided on the ReadMe of the Github pages linked above.

Step 5: Sketch for the Social Counter

The code for the project is available on my Github

You will need to replace the parts in the section up the top as shown in the picture.

The sketch will fetch data from the services every 5 minutes and will rotate what is shown on the LED matrix every 20 seconds.

Install it to your board and make sure it is working correctly for you, I recommend running it with the serial monitor open as you can see if something did not work as expected.

Step 6: Assembling the Hardware

Now we need to assemble the hardware. This can be done anyway you would like but I will show you how I done it.

  1. First thing we need to is to hot glue the MAX7219 boards to a piece of thick card to hold them all together. Make sure you get them as level as possible.
  2. I then broke up a popsicle stick so it was smaller than the thick card and stuck it in 3 places to the bottom of the thick card using double sided sticky tape.
  3. I wired the LED matrix as described in the previous step. I connected each of the common wires together using this tiny breadboard I picked up on Aliexpress before. So all the VCC pins were in one row, all GND in another etc
  4. Make sure to test again that it is working.
  5. Stick the different parts down using double sided sticky tape. I stuck the popsicle sticks that were on the back of the card and also the little connected using the double sided sticky tape. The mini breadboard already had an adhesive back that I used.
  6. I plugged in the USB cable and ran it out of the frame backing where there is a corner cut off.
  7. Close up the frame and you should have your finished product!

In the future I will extend this project by the following:

  • Use Wifimanager so configuring the device can be code free.
  • Add more APIs (Reddit, Instagram, Twitch etc)
  • Tidy up the code so its a little neater to add/remove APIs

Hopefully you find this project interesting! I'm really happy with how it came out and I actually really like the look of the exposed wires. As always, if you have any questions please let me know!

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    19 Discussions


    8 months ago on Step 6

    Arduino: 1.8.7 (Mac OS X), Board: "WeMos D1 R1, 80 MHz, Flash, Enabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"
    sketch_jan14b:278:5: error: 'int max' redeclared as different kind of symbol
    int max = 4;
    In file included from /Users/jorgeteixeira/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/xtensa-lx106-elf/include/c++/4.8.2/algorithm:61:0,
    from /Users/jorgeteixeira/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.0-beta2/cores/esp8266/Arduino.h:257,
    from sketch/sketch_jan14b.ino.cpp:1:
    /Users/jorgeteixeira/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:216:5: error: previous declaration of 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
    max(const _Tp& __a, const _Tp& __b)
    /Users/jorgeteixeira/Documents/Arduino/sketch_jan14b/sketch_jan14b.ino: In function 'void displayNextData()':
    sketch_jan14b:286:16: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
    if(current > max) {
    exit status 1
    'int max' redeclared as different kind of symbol
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.


    Question 11 months ago

    I have loaded the sketch with no errors. The leds all light with no text. I am using the block of 4 in 1 module.


    1 answer

    Answer 10 months ago

    Are all your LEDs lit up? I was having the same issue, but was able to get other code working to send text/images


    10 months ago

    What are the odds of having a bastardized version of this that counts checkins?


    1 year ago

    Personal friends count works perfect (THANKS!)... but...

    I'm trying to use facebook->getPageFanCount("pageid");
    But I get the error: 'class FacebookApi' has no member named 'getPageFanCount'

    In your class there is this line:
    int getPageFanCount(String pageId);

    On the Facebook Graph API Explorer I get the correct fan_count returned.

    What am I missing here?
    Thanks in advance.


    Question 1 year ago on Step 6

    is it easy / possible to add 4 more so you end up with 8 characters? Is that as easy as soldering on 4 extra? (im thinking of buying the 4-in-1 modules)

    2 answers

    Answer 1 year ago

    I believe they support up to 8 no problem, there is one issue with the 4 in 1 modules, they dont work with the standard version of the library, the letters scroll from top to bottom of each segment rather than from left to right.

    This is a modified version of the library where the author has added a display.setRotation(true) option that should fix the rotation for those displays


    Answer 1 year ago

    Thanks for getting back to me!
    I've been digging trough the sources, but either i've missed the setRotation parameter or i'm looking in the wrong file(s), do you have a link?


    2 years ago

    Hello, I really liked your project, you have the instagram API?

    3 replies

    Reply 1 year ago

    Also interested in instagram API!


    Question 1 year ago on Introduction

    Hello, I am trying to make this project's with bekathwia's version. It doens't work with my school network. How do I do that? There is my school wifi and in general (with my computer) I connect into it with user name and password. How do I implement into the code that bekathwia's version have. If you could help that would be great. Thank you!

    Jeroen Just4fun

    1 year ago

    This is great, thank you for the intractable. I am almost done with mine. Wifi is working, the demo for the MAX7219 is working,... however I keep on getting errors on the sketch. Would you be so kind to take a look at it to find out what I am doing wrong? thank you so much. Cheers, Jeroen
    Amsterdam, The Netherlands


    2 years ago


    Could you please say if it is possible to do something like this for Etsy?
    I want to do it by myself, but need your help)


    2 years ago

    Nice project ! i'm wondering if there is an API like that for Thingiverse...

    1 reply

    Reply 2 years ago

    Hey, thanks!

    Taking a quick look, there is a thingiverse api but it seems to require approval to be allowed use it, I might request access and see what they say.