Spotify Remote Control Demo with ThingsBoard

Hi everyone,

Check out this demonstration of a Spotify remote control application that retrieves telemetry data from the Spotify Web API and sends it to the ThingsBoard Cloud IoT platform.

Link to the demo video: https://www.youtube.com/watch?v=cZMdgpXp8pI

What is ThingsBoard ?

ThingsBoard is an open-source Internet of Things (IoT) platform designed to handle:

  • Device and asset management
  • Data collection, processing, and visualization
  • Real-time monitoring, alarm/notification rules
  • Dashboarding
  • Support for various IoT protocols

It allows users (developers, companies, system integrators) to connect devices, collect telemetry data, define rules for processing or reacting to events, visualize data, and control or monitor devices either in cloud or on-premises.

What is Spotify Web API ?

The Spotify Web API is a restful API with different endpoints which return JSON metadata about music artists, albums, and tracks, directly from the Spotify Data Catalogue. It enables the creation of applications that can interact with Spotify’s streaming service, such as retrieving content metadata, creating and managing playlists, or controlling playback.

Features

  • Fetch currently playing song
  • Fetch the available devices and identify currently playing device
  • Monitor memory usage
  • Send telemetry
  • Communicate via MQTT with ThingsBoard
  • Periodic data updates via timers
  • Basic GUI with playback controls

System Architecture

This project consist of three key components:

1- Spotify API Handler

  • Uses Spotify Web API to fetch track and device details.
  • Implements custom SSL handling for secure communication.

2- Remote Control User Interface

  • Implements a GUI meant for controlling Spotify playback.
  • Provides play, pause, next, previous, shuffle, repeat buttons.

3- Telemetry Manager

  • Manages MQTT connectivity with ThingsBoard server.
  • Publishes telemetry data (e.g. playback state, device details, memory usage).

General Workflow

This project implements authentication and authorization using the OAuth 2.0 framework, allowing end users to grant permission for the application to access their playlists. This enables the application to securely retrieve protected resources.
To learn more about Spotify Authorization please visit : Spotify Authorization Guide
Once the data is fetched from Spotify, the telemetry is restructured (for example, extracting only relevant fields), and then combined with device information before being published to ThingsBoard via MQTT.

Results

Spotify remote control application running on simulator:

ThingsBoard’s dashboard:

Happy coding!
The MicroEJ Team.