In this project we will be building an Instagram followers counter with ESP32 board and an Oled display. We will be using the Instagram username to get the data for the number of followers.
This project is perfect for those who want to display their Instagram followers in a physical form. We’ll be using the Arduino IDE to program the ESP32, and the 0.96″ OLED display will be used to display the count. Control LED with Telegram Bot Using ESP8266/ESP32
Required Material
You will need the following components:
- ESP32 Development Board
- OLED Display
- Jumper Wires
- Breadboard
- USB Cable
We will be using the ESP32 module, which features a powerful 32-bit Xtensa® Dual-core CPU with a clock speed of up to 240MHz. It comes with 4MB of flash memory, 520Kbytes of RAM, and supports standard WiFi 802.11 b/g/n and Bluetooth BLE 4.2.
The OLED display has a resolution of 128×64 pixels, which can be used to display graphics and text.
Wiring – Instagram Followers Counter With ESP32
Connect the OLED display to ESP32
Following pin connections:
- OLED VCC -> 3.3V
- OLED GND -> GND
- OLED SDA -> GPIO5
- OLED SCL -> GPIO4
Setting up Arduino IDE For ESP32
In order to program ESP32, you need to follow the following steps to install the board in the Arduino IDE: Check out Getting Started With ESP32 – Setting up Arduino IDE for ESP32
- Open the Arduino IDE.
- Go to “File” -> “Preferences”.
- In the “Additional Boards Manager URLs” field, paste the following URL: https://dl.espressif.com/dl/package_esp32_index.json
- Go to “Tools” -> “Board” -> “Boards Manager”.
- Search “esp32” and Click Install on “esp32 by Espressif Systems”.
- After installing, select the ESP32 board under “Tools” -> “Board”.
Installing the required libraries
To assemble the Instagram follower counter program with ESP32, we will use three libraries: ESP32 and ESP8266 OLED driver for SSD1306, InstagramStats, and Json Streaming Parser.
All of these libraries can be installed directly from Arduino IDE under the menu Sketch > Include Library > Manage Libraries. Manage Libraries.
First, let’s install the OLED display library. In the Library Manager, search for SSD1306 and select ESP32 and ESP8266 OLED driver for SSD1306 Display.
Next, install the InstagramStats library, which connects to Instagram and retrieves data regarding the number of followers.
Lastly, install the Json Streaming Parser library, which is necessary for InstagramStats to work properly.
After installing the required libraries, we can now move to writing the code for the Instagram follower counter program using ESP32 and OLED display.
Source Code – Instagram Followers Counter With ESP32
The following program will connect to a Wifi network and retrieve the number of followers for a specified Instagram account.
The username for the account can be found in the account’s profile URL on Instagram.
https://www.instagram.com/diyprojectslab/
Before running the program, make sure to enter your Wifi network name and password on lines 9 and 10, respectively.
1 2 |
const char* ssid = "ESP Repeater"; const char* password = "antivirus"; |
Also, enter the Instagram username on line 24.
1 |
String userName = "diyprojectslab"; |
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
#include <InstagramStats.h> #include <WiFi.h> #include <WiFiClientSecure.h> #include <SSD1306Wire.h> #include <JsonStreamingParser.h> // Network credentials const char* ssid = "ESP Repeater"; const char* password = "antivirus"; // Initialize WiFiClientSecure object and InstagramStats object WiFiClientSecure client; InstagramStats instaStats(client); // OLED display initialization on pins 5 and 4 SSD1306Wire display(0x3c, 5, 4); // Time interval between consecutive checks unsigned long delayBetweenChecks = 60000; // 1 minute unsigned long whenDueToCheck = 0; // Instagram username, as per the URL // https://www.instagram.com/diyprojectslab/ String userName = "diyprojectslab"; void setup() { // Initialize Serial communication Serial.begin(115200); // Connect to WiFi network Serial.print("Connecting to WiFi network: "); Serial.println(ssid); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println(""); Serial.println("WiFi connected!"); Serial.println("IP address: "); IPAddress ip = WiFi.localIP(); Serial.println(ip); // Initialize OLED display display.init(); display.flipScreenVertically(); } // Function to show the number of followers on the OLED display void showFollowersCount() { // Get user statistics from InstagramStats object InstagramUserStats response = instaStats.getUserStats(userName); // Print number of followers to the Serial monitor Serial.println("Getting Instagram data for user " + userName); Serial.print("Number of followers: "); Serial.println(response.followedByCount); // Display data on OLED display display.clear(); display.setTextAlignment(TEXT_ALIGN_LEFT); // Instagram logo on the top display.drawHorizontalLine(7, 5, 15); display.drawVerticalLine(5, 7, 15); display.drawVerticalLine(23, 7, 15); display.drawHorizontalLine(7, 23, 15); display.setPixel(6, 6); display.setPixel(6, 22); display.setPixel(22, 6); display.setPixel(22, 22); display.setPixel(19, 9); display.drawCircle(14, 14, 4); display.drawCircle(19, 9, 1); display.setFont(ArialMT_Plain_16); display.drawString(30, 5, "INSTAGRAM"); display.drawString(31, 5, "INSTAGRAM"); // Show the number of followers display.setFont(ArialMT_Plain_24); display.drawString(38, 32, String(response.followedByCount)); display.display(); } void loop() { // Check if it is time to show the number of followers again unsigned long timeNow = millis(); if (timeNow > whenDueToCheck) { showFollowersCount(); whenDueToCheck = timeNow + delayBetweenChecks; } } |
How did you get InstagramStats working? i’m getting 0 followers, and poked around github and people mention the library is broken. Is it working for you?
I have the same problem , did you find a solution ?