Stephen Harrison
Published © CC BY

Scanlime-in-Progress Indicator (aka YouTube Live Indicator)

Never miss your favourite YouTube channel going live with this Particle Photon based indicator.

BeginnerFull instructions provided1 hour1,101
Scanlime-in-Progress Indicator (aka YouTube Live Indicator)

Things used in this project

Hardware components

LED (generic)
LED (generic)
Wide ThingySticks Prototype PCB
Particle Photon
Resistor 1k ohm
Resistor 1k ohm

Software apps and online services

Google YouTube Data API (V3)
You need the channel id from the YouTube channel you wish for the notification from. i.e. scanlime-in-progress is UC8G48_G7suQlScUudVXyGkg

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)


Read more




Particle Webhook Template

    "event": "youtubelive",
    "responseTopic": "youtubelive",
    "errorResponseTopic": "youtubeliveerror",
    "url": "<Insert your Google YouTube Key Here>",
    "requestType": "GET",
    "noDefaults": true,
    "rejectUnauthorized": true,
    "responseTemplate": "{{pageInfo.totalResults}}"

Scanlime Live

YouTube Live indicator for a specific channel
// Detect if the channel has a live stream going
// See:
// Uses:[API_KEY]
// in a webhook (replace [API_KEY])

bool isLive = false;

void setup() {
    pinMode(D7, OUTPUT);
    // LED drives
    pinMode(D2, OUTPUT);
    pinMode(D3, OUTPUT);
    pinMode(D4, OUTPUT);
    pinMode(D5, OUTPUT);
    pinMode(D6, OUTPUT);
    pinMode(D7, OUTPUT);
    // Optional external functions to allow the LEDs to be "manually" controlled
    Particle.function("on", ledsOn);
    Particle.function("off", ledsOff);
    Particle.subscribe("youtubelive/0", youTubeLiveHandler, MY_DEVICES);
    Particle.publish("Scanlime live V0.3");
    // Take control of the onboard LED
    // Blue - don't know - no response.
    RGB.color(0, 0, 255);

void loop() {
    digitalWrite(D7, HIGH);
    // Request Webhook query YouTube API for Scanlime channel.
    digitalWrite(D7, LOW);
    // give it n seconds before we try and check again.

void youTubeLiveHandler(const char *event, const char *data) {
    // "responseTemplate": "{{pageInfo.totalResults}}"
    // data contains the number of results
    // this should be 1 if a live stream in in progress.
    int resultCount = atoi(data);
    // Set the LEDs to on if their are results.
    setLEDs(resultCount > 0);
    // Publish a status message so this can also 
    // be picked up by Tinamous or another platform (e.g. IFTTT)
    if (resultCount > 0) {
        if (!isLive) {
            Particle.publish("status", "Scanlime live stream started. count: " + String(resultCount));        
        isLive = true;
    } else {
        if (isLive) {
            Particle.publish("status", "Scanlime not live!");        
        isLive = false; // :-(

void setLEDs(bool state) {
    // LEDs are active low.
    digitalWrite(D2, !state);
    digitalWrite(D3, !state);
    digitalWrite(D4, !state);
    digitalWrite(D5, !state);
    digitalWrite(D6, !state);
    digitalWrite(D7, !state);
    if (state) {
        RGB.color(50, 205, 50); // Lime Green
    } else {
        RGB.color(0, 0, 0);

int ledsOn(String args) {
    return 1;

int ledsOff(String args) {
    return 0;


Stephen Harrison

Stephen Harrison

18 projects • 50 followers
Founder of, software developer, hardware tinkerer, dyslexic. @TinamousSteve
Thanks to Sparkfun.


Add projectSign up / Login