Once that works, upload eiher of these sketches, with your SSID & network password:

Sketch Explanation

This sketch is not much different than the SSL test sketch.


In the pre-setup configuration, you can set up your SSID & password. Also, set what pin has the LED connected. Define the path you want to grab, change this to your favorite twitch streamer

// Define the WINC1500 board connections below.
// If you're following the Adafruit WINC1500 board
// guide you don't need to modify these:
#define WINC_CS   8
#define WINC_IRQ  7
#define WINC_RST  4
#define WINC_EN   2     // or, tie EN to VCC and comment this out

#define LED 13

// Setup the WINC1500 connection with the pins above and the default hardware SPI.

// Or just use hardware SPI (SCK/MOSI/MISO) and defaults, SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V
//Adafruit_WINC1500 WiFi;

char ssid[] = "networkssid"; //  your network SSID (name)
char pass[] = "networkpass";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
#define HOST "api.twitch.tv"
#define PATH "/kraken/streams/adafruit"
#define REFRESH 20  // seconds between refresh

Adafruit_WINC1500SSLClient client;


In setup we just check that the WiFi module is attached, and set the pin #13 LED to an output

void setup() {
#ifdef WINC_EN
  pinMode(WINC_EN, OUTPUT);
  digitalWrite(WINC_EN, HIGH);

  pinMode(LED, OUTPUT);
  //Initialize serial and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);


We start by checking if we are connected to the SSID, if not we connect

void loop() {
  // attempt to connect to Wifi network:
  if (WiFi.status() != WL_CONNECTED) {
    while (WiFi.status() != WL_CONNECTED) {
      Serial.print("Attempting to connect to SSID: ");
      // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
      status = WiFi.begin(ssid, pass);
      // wait 10 seconds for connection:
      uint8_t timeout = 10;
      while (timeout && (WiFi.status() != WL_CONNECTED)) {
    Serial.println("Connected to wifi");

Then we SSL connect to twitch.tv and ask for the path from the setup section

  Serial.println("\nStarting connection to twitch...");
  // if you get a connection, report back via serial:
  if (client.connect(HOST, 443)) {
    Serial.println("connected to twitch api server");
    // Make a HTTP request:
    client.println("GET " PATH " HTTP/1.1");
    client.println("Host: " HOST);
    client.println("Connection: close");

We then use find to locate whether the magic string appears

  boolean isStreaming = false;
  while (client.connected()) {
    if (client.find("\"stream\":{\"_id\":")) {
      isStreaming = true;

if so, then isStreaming is set to true. Finally we print out the current status, wait a few seconds, and restart the loop

Serial.print("Streaming status: "); Serial.println(isStreaming);
  digitalWrite(LED, isStreaming);
  Serial.println("disconnecting from server.");


This guide was first published on Mar 10, 2016. It was last updated on Mar 08, 2024.

This page (Final Sketch) was last updated on Mar 08, 2016.

Text editor powered by tinymce.