Bluino Bluino
INDONESIA • + Follow
Edit Project
Components
|
Wemos D1 mini ESP8266 |
x 1 | |
|
8 Digit 7segment MAX7219 module |
x 1 | |
|
LED 3mm white diffused |
x 3 | |
|
R 100 ohm 1/4w |
x 1 | |
|
Active Buzzer 5V |
x 1 | |
|
Slide Switch SPDT SS-12D00G3 |
x 1 | |
|
Battery Holder AA |
x 1 |
Description
YouTube Subscriber Counter ESP8266 Wemos
#include <YoutubeApi.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
//Outputs
#define MAX7219_Data_IN D7 //D4 of WeMos
#define MAX7219_Chip_Select D6 //D3 of WeMos
#define MAX7219_Clock D5 //D2 of WeMos
int buzzer = D8; //D8 of WeMos
//Variabels
byte adr = 0x08;
byte num = 0x00;
int i = 0;
long subs = 0;
String thisString_prev;
//////////////////////////////////////////////////////////////////////////////////
//------- Replace the following! ------
char ssid[] = ""; // your network SSID (name)
char password[] = ""; // your network key
#define API_KEY ""
#define CHANNEL_ID "" // makes up the url of channel
WiFiClientSecure client;
YoutubeApi api(API_KEY, client);
unsigned long api_mtbs = 10000; //mean time between api requests
unsigned long api_lasttime; //last time api request has been done
void shift(byte send_to_address, byte send_this_data)
{
digitalWrite(MAX7219_Chip_Select, LOW);
shiftOut(MAX7219_Data_IN, MAX7219_Clock, MSBFIRST, send_to_address);
shiftOut(MAX7219_Data_IN, MAX7219_Clock, MSBFIRST, send_this_data);
digitalWrite(MAX7219_Chip_Select, HIGH);
}
void setup() {
Serial.begin(115200);
delay(100);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, LOW);
delay(100);
//Define the pins as outputs and disable CS
pinMode(MAX7219_Data_IN, OUTPUT);
pinMode(MAX7219_Chip_Select, OUTPUT);
pinMode(MAX7219_Clock, OUTPUT);
digitalWrite(MAX7219_Chip_Select, HIGH);
delay(200);
//Setup of the 7seg module
shift(0x0f, 0x00); //display test register - test mode off
shift(0x0c, 0x01); //shutdown register - normal operation
shift(0x0b, 0x07); //scan limit register - display digits 0 - 7
shift(0x0a, 0x0f); //intensity register - max brightness
shift(0x09, 0xff); //decode mode register - CodeB decode all digits
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
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);
client.setInsecure();
}
void loop() {
if (millis() - api_lasttime > api_mtbs) {
if(api.getChannelStatistics(CHANNEL_ID))
{
unsigned long Count = api.channelStats.subscriberCount;
Serial.println(Count);
String thisString = String(Count, DEC);
if(thisString != thisString_prev)
{
digitalWrite(buzzer,200);
delay(1000);
digitalWrite(buzzer,LOW);
}
thisString_prev = thisString;
i = thisString.length();//This variable will go character by cahracter and send the value to the 7 segment display
if(i==8)
{
shift(0x0b, 0x07); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==7)
{
shift(0x0b, 0x06); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==6)
{
shift(0x0b, 0x05); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==5)
{
shift(0x0b, 0x04); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==4)
{
shift(0x0b, 0x03); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==3)
{
shift(0x0b, 0x02); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==2)
{
shift(0x0b, 0x01); //scan limit register - display digits 0 thru 7
adr=0x01;
}
if(i==1)
{
shift(0x0b, 0x00); //scan limit register - display digits 0 thru 7
adr=0x01;
}
i=i-1;
while (i >= 0)
{
if(thisString[i] == '0')
{
num = 0x00;
}
if(thisString[i] == '1')
{
num = 0x01;
}
if(thisString[i] == '2')
{
num = 0x02;
}
if(thisString[i] == '3')
{
num = 0x03;
}
if(thisString[i] == '4')
{
num = 0x04;
}
if(thisString[i] == '5')
{
num = 0x05;
}
if(thisString[i] == '6')
{
num = 0x06;
}
if(thisString[i] == '7')
{
num = 0x07;
}
if(thisString[i] == '8')
{
num = 0x08;
}
if(thisString[i] == '9')
{
num = 0x09;
}
shift(adr, num);
adr=adr+0x01;
i=i-1;
}
}
api_lasttime = millis();
}
}
Jul 23,2020
3,082 views
YouTube Subscriber Counter ESP8266 Wemos
Notification display your Youtube Channel Subscriber
3082
6
0
10.00 (2)
Published: Jul 23,2020
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-ShareAlike (CC BY-SA)
License.
- Comments(0)
- Likes(6)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
It looks like you have not written anything. Please add a comment and try again.
You can upload up to 5 images!
Image size should not exceed 2MB!
File format not supported!
View More
- Engineer Sep 10,2021
- Brian Taudahl Boergesen Dec 07,2020
- Engineer Sep 02,2020
- (DIY) C64iSTANBUL Aug 10,2020
- Guang Ning Aug 10,2020
- Ahmed Elsmahy Jul 28,2020
View More
VOTING
2 votes
- 2 USER VOTES
10.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
-
10design
-
10usability
-
10creativity
-
10content
10.00
-
10design
-
10usability
-
10creativity
-
10content
10.00
More by Bluino Bluino
- ESP32-Cam Motor Driver Shield L293D Android App: ESP32 Camera Wifi Robot CarTutorial Assembly:https://www.instructables.com/DIY-ESP32-Ca...
- LED Blinking Robot Badge - Soldering Kit This article is proudly sponsored by PCBWAY.PCBWAY make high quality prototyping PCBs for people all...
- 3 Panel LED Dot Matrix MAX7219 for Common Anode Dot Matrix Part List per Panel:1 x PCB LED Dot Matrix MAX7219 (PCBWay)1 x Led Dot Matrix 8x8 Common Anode1 x IC...
- 2 Panel LED Dot Matrix MAX7219 for Common Anode Dot Matrix Part List per Panel:1 x PCB LED Dot Matrix MAX7219 (PCBWay)1 x Led Dot Matrix 8x8 Common Anode1 x IC...
- IoT Basic Kit ESP8266 Wemos D1 Mini Part List:1 x PCB IoT Basic Kit (PCBWay)1 x ESP8266 Wemos D1 Mini board1 x OLED I2C 128x641 x Humidi...
- ESP32 IoT Basic Shield Part List:1 x PCB ESP32 Basic Shield (PCBWay)1 x ESP32 DEV KIT V1 board1 x LED 5mm1 x LED 3mm1 x Act...
- Nodemcu Amica ESP8266 IoT Starter Shield Learn Basic IoT use ESP8266 boards is very easy with Nodemcu IoT Starter Shield board and following ...
- ESP32 Motor Shield 2WD Control Robot Car 4WD Mecanum Wheel use app Android, install app here:https://play.google.com/store/...
- ESP32 Motor Shield 4WD Mecanum Wheel Control Robot Car 4WD Mecanum Wheel use app Android, install app here:https://play.google.com/store/...
- ESP32 IoT Starter Shield Ver 2.0 The difference from the previous version is that there is an additional slot for the HCSR04 ultrason...
- nanBluino - DIY Arduino Nano USB Type-C Overview"Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use h...
- Drawbot Wifi ESP32 GRBL - Drawing Robot Plotter Pen OverviewThe Drawbot is a drawing art robot that can draw. You will needs two stepper motors, a micro...
- Topeduino - DIY Arduino Uno USB Type-C use Solder Paste Stencil Overview"Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use h...
- Eggbot Wifi ESP32 - Drawing Robot Plotter Pen OverviewThe Eggbot is a drawing art robot that can draw on spherical or egg-shaped objects. You coul...
- ESP32 Balancing Robot Shield Part list:1 x PCB ESP32 Balancing Robot Shield (PCBWay)1 x ESP32 DEVKIT V1 board2 x Stepper Motor Dr...
- Pi Pico Starter Shield Easy Way to Started learn Raspberry Pi Pico, based on official tutorial download Get Started Pi Pico...
- ESP32 IoT Starter Kit Learn Basic IoT use ESP32 boards is very easy with ESP32 IoT Starter Kit board and following the 110...
- LED blink_ing RoBadge#2 - Basic Soldering Kit You can support/donate by download gerber here This article is proudly sponsored by PCBWAY.PCBWAY ma...
You may also like
-
Build a Walking Robot: Theo Jansen Style 3D Printed Octopod
110 0 3 -
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
139 0 0 -
DIY Laser Power Meter with Arduino
213 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
186 0 2