English version below — scroll down or click here
Aplikacja na licznik rowerowy Garmin Edge 530, która pokazuje na ekranie co aktualnie gra na Spotify i pozwala sterować muzyką. Jednocześnie wyświetla dane treningowe (prędkość, dystans, czas, tętno, temperaturę itd.) i nagrywa aktywność do Garmin Connect.
Spotify:
- Pokazuje tytuł utworu i artystę
- Pasek postępu utworu
- Polubienie utworu przyciskiem LAP
- Play/pauza, następny/poprzedni utwór
- Losowe odtwarzanie i powtarzanie
Dane jazdy (2 ekrany):
- Prędkość, średnia prędkość
- Dystans, czas jazdy, stoper
- Tętno, temperatura, godzina
- Zachód słońca, bateria
Nagrywanie aktywności:
- Start/pauza przyciskiem START
- Auto-pauza przy niskiej prędkości
- Zapis do Garmin Connect
Inne:
- Tryb jasny/ciemny (auto lub ręczny)
- Język polski i angielski
- Przewijanie długich tytułów utworów
- Garmin Edge 530 (licznik rowerowy)
- Telefon z aplikacją Garmin Connect (Android lub iPhone)
- Spotify Premium (darmowe konto nie wystarczy)
- Komputer z kablem USB do podłączenia Garmina
- Telefon musi być połączony z Garminem przez Bluetooth i mieć dostęp do internetu
GitHub to strona internetowa, na której programiści udostępniają swój kod. Nie musisz znać się na programowaniu — wystarczy pobrać pliki na komputer.
Sposób 1: Pobierz jako ZIP (najłatwiejszy)
- Wejdź na stronę projektu: https://github.com/bobok7/SpotiRide
- Kliknij zielony przycisk "Code"
- Kliknij "Download ZIP"
- Rozpakuj pobrany plik ZIP w dowolnym miejscu na komputerze (np. na Pulpicie)
- Gotowe — masz cały projekt na swoim komputerze
Sposób 2: Za pomocą Git (dla zaawansowanych)
Git to program do zarządzania wersjami kodu. Jeśli chcesz go użyć:
- Zainstaluj Git ze strony: https://git-scm.com/downloads
- Otwórz terminal (wiersz poleceń) i wpisz:
git clone https://github.com/bobok7/SpotiRide.git
To polecenie pobierze cały projekt do folderu SpotiRide na Twoim komputerze.
Słowniczek Git (jeśli spotkasz te pojęcia):
- Repository (repo) — folder z projektem przechowywany na GitHubie
- Clone — pobranie kopii projektu z GitHuba na swój komputer
- Commit — zapisanie zmian w historii projektu (jak „zapisz" w grze)
- Push — wysłanie swoich zmian z komputera na GitHuba
- Pull — pobranie najnowszych zmian z GitHuba na swój komputer
- Branch — oddzielna wersja projektu (np. do testowania nowych funkcji)
- Fork — skopiowanie czyjegoś projektu na swoje konto GitHub
Jeśli nie planujesz modyfikować kodu ani udostępniać zmian — Sposób 1 (ZIP) całkowicie wystarczy.
Każdy użytkownik musi utworzyć własną „aplikację" na stronie Spotify. To jest darmowe i trwa 2 minuty. Nie jest to prawdziwa aplikacja — to tylko sposób w jaki Spotify daje dostęp do Twojego konta.
- Otwórz przeglądarkę i wejdź na stronę: https://developer.spotify.com/dashboard
- Zaloguj się swoim kontem Spotify (tym samym co słuchasz muzyki)
- Kliknij zielony przycisk "Create App"
- Wypełnij formularz:
- App name: wpisz
SpotiRide(lub dowolną nazwę) - App description: wpisz
Garmin(lub dowolny opis) - Website: zostaw puste
- Redirect URI: wpisz dokładnie ten adres (skopiuj i wklej):
i kliknij "Add" obok
https://garmin-spotify-callback.invalid/callback - APIs used: zaznacz ptaszkiem Web API
- Zaznacz zgodę na warunki użytkowania
- App name: wpisz
- Kliknij "Save"
Teraz musisz dodać swoje konto jako użytkownika testowego (nowe aplikacje Spotify są w trybie testowym):
- Na stronie swojej aplikacji kliknij zakładkę "Settings"
- Następnie przejdź do zakładki "User Management"
- Wpisz swój adres email (ten sam co w Spotify) i kliknij "Add user"
Na koniec skopiuj swoje dane:
- Wróć do zakładki "Settings"
- Zobaczysz Client ID — skopiuj go (będziesz go potrzebował)
- Kliknij "View client secret" — skopiuj też Client Secret
Zapisz oba gdzieś tymczasowo (np. w Notatniku).
Refresh Token to specjalny klucz, który pozwala aplikacji na Garminie łączyć się z Twoim kontem Spotify. Uzyskasz go za pomocą strony dołączonej do projektu.
- W folderze projektu znajdź folder oauth-helper
- Otwórz plik index.html (dwuklik na plik — otworzy się w przeglądarce)
- Wklej Client ID i Client Secret z Kroku 1
- Kliknij zielony przycisk "Zaloguj się do Spotify"
- Otworzy się nowa karta — zaloguj się do Spotify i kliknij "Zgadzam się"
- Po zalogowaniu przeglądarka pokaże błąd (np. „nie można otworzyć strony") — to jest normalne!
- Kliknij na pasek adresu w przeglądarce (tam gdzie jest długi adres zaczynający się od
https://garmin-spotify-callback...) - Zaznacz cały adres (Ctrl+A) i skopiuj go (Ctrl+C)
- Wróć do karty ze stroną SpotiRide
- Wklej skopiowany adres w pole tekstowe (Ctrl+V)
- Kliknij "Pobierz Refresh Token"
- Pojawi się Twój Refresh Token — kliknij "Kopiuj"
Zapisz Refresh Token — będziesz go potrzebował w następnym kroku.
Aby aplikacja mogła łączyć się z Twoim kontem Spotify, musisz wpisać swoje dane do pliku z kodem. Nie martw się — wystarczy zmienić 3 linijki tekstu.
- W folderze projektu otwórz folder SpotiRide, potem source
- Otwórz plik TokenManager.mc w dowolnym edytorze tekstu (np. Notatnik)
- Na początku pliku znajdziesz 3 linijki:
var gClientId = "TWOJ_CLIENT_ID";
var gClientSecret = "TWOJ_CLIENT_SECRET";
oraz dalej w klasie:
var hardcodedRefreshToken = "TWOJ_REFRESH_TOKEN";
- Zamień tekst w cudzysłowach na swoje dane:
- Zamiast
TWOJ_CLIENT_IDwklej swój Client ID z Kroku 1 - Zamiast
TWOJ_CLIENT_SECRETwklej swój Client Secret z Kroku 1 - Zamiast
TWOJ_REFRESH_TOKENwklej swój Refresh Token z Kroku 2
- Zamiast
- Zapisz plik
Aby zamienić kod na plik, który można wgrać na Garmina, potrzebujesz dwóch rzeczy:
A) Visual Studio Code (darmowy edytor kodu):
- Wejdź na https://code.visualstudio.com
- Pobierz i zainstaluj
B) Connect IQ SDK (narzędzia Garmina do budowania aplikacji):
- Wejdź na https://developer.garmin.com/connect-iq/sdk/
- Pobierz SDK Manager i zainstaluj
- W SDK Manager pobierz najnowszą wersję SDK
- W SDK Manager pobierz też urządzenie Edge 530
C) Rozszerzenie Monkey C do VS Code:
- Otwórz Visual Studio Code
- Kliknij ikonę kwadracików po lewej stronie (Extensions / Rozszerzenia)
- Wyszukaj "Monkey C" i zainstaluj rozszerzenie od Garmin
D) Klucz developerski:
- W VS Code naciśnij Ctrl+Shift+P
- Wpisz "Monkey C: Generate Developer Key"
- Wybierz lokalizację do zapisania klucza
- Otwórz Visual Studio Code
- Kliknij File > Open Folder i wybierz folder SpotiRide (ten z plikiem monkey.jungle)
- Naciśnij Ctrl+Shift+P (otworzy się pasek poleceń)
- Wpisz "Monkey C: Build for Device" i wybierz to polecenie
- Wybierz urządzenie edge530
- Poczekaj aż budowanie się zakończy — pojawi się komunikat "BUILD SUCCESSFUL"
- W folderze bin pojawi się plik SpotiRide.prg — to jest Twoja gotowa aplikacja
- Połącz Garmin Edge 530 z komputerem kablem USB
- Garmin pojawi się jako dysk (np. dysk F: lub E:)
- Otwórz ten dysk i wejdź do folderu GARMIN, potem APPS
- Skopiuj plik SpotiRide.prg do tego folderu (GARMIN/APPS/)
- Bezpiecznie odłącz Garmina (kliknij „Bezpieczne usuwanie sprzętowe" w systemie)
- Garmin się zrestartuje
- Na Garmin Edge 530 naciśnij przycisk START (domyślnie włącza jazdę)
- Zamiast tego przejdź do Menu > Aplikacje Connect IQ > SpotiRide
- Włącz odtwarzanie muzyki w Spotify na telefonie
- Po kilku sekundach na ekranie Garmina pojawi się tytuł utworu
| Przycisk na Garminie | Co robi w SpotiRide |
|---|---|
| START (prawy górny) | Rozpoczyna lub pauzuje nagrywanie jazdy |
| LAP (prawy dolny) | Lubi aktualny utwór na Spotify (dodaje do polubionych) |
| Środkowy przycisk | Otwiera menu z ustawieniami i sterowaniem muzyką |
| UP (lewy górny) | Przełącza na poprzedni ekran |
| DOWN (lewy dolny) | Przełącza na następny ekran |
| BACK (lewy środkowy) | Zapisuje aktywność i zamyka aplikację |
Sterowanie Spotify:
- Play / Pause — wznawia lub pauzuje muzykę
- Następny utwór / Poprzedni utwór
- Losowe odtwarzanie (shuffle) — włącz/wyłącz
- Powtarzanie — wyłączone / playlista / jeden utwór
Ustawienia:
- Tryb ekranu — automatyczny (ciemny wieczorem) / jasny / ciemny
- Odświeżanie Spotify — jak często sprawdza co gra (5/10/15/30 sekund)
- Przewijanie — włącza przewijanie długich tytułów utworów
- Temperatura — Celsjusz lub Fahrenheit
- Auto pauza — automatycznie pauzuje nagrywanie gdy się zatrzymasz (próg prędkości 2-6 km/h)
- Opóźnienie pauzy — ile sekund poniżej progu zanim włączy się auto pauza (brak / 3s / 5s / 10s)
- Język — polski lub angielski
Inne:
- Zaloguj Spotify — logowanie przez telefon (uwaga: na Edge 530 ta opcja może nie działać — w takim przypadku użyj oauth-helper, patrz Krok 2)
- Odśwież token — ręczne odświeżenie połączenia
- Status Spotify — sprawdza czy połączenie działa
- O aplikacji — ekran z informacjami o autorze i kodem QR do GitHuba
- Zapisz aktywność — zapisuje jazdę do Garmin Connect
- Odrzuć aktywność — kasuje jazdę bez zapisywania
Dlaczego potrzebuję Spotify Premium? Darmowe konto Spotify nie pozwala innym aplikacjom sprawdzać co aktualnie gra. To ograniczenie Spotify, nie tej aplikacji.
Czy to jest bezpieczne? Tak. Aplikacja łączy się bezpośrednio z Twoim kontem Spotify. Twoje dane (Client ID, Secret, Token) są tylko na Twoim Garminie i w Twoim kodzie — nigdzie nie są wysyłane.
Utwór się nie wyświetla / pisze „Brak muzyki"
- Sprawdź czy Spotify gra na telefonie
- Sprawdź czy telefon jest połączony z Garminem przez Bluetooth
- Poczekaj kilka sekund — informacja odświeża się co 5-30 sekund
- Wejdź w menu > „Status Spotify" — powinno pisać „Połączono"
Token wygasł / nie działa
- Wejdź w menu > „Odśwież token"
- Jeśli nie pomaga — powtórz Krok 2 (uzyskaj nowy Refresh Token) i Krok 3
- Opcja „Zaloguj Spotify" w menu może nie działać na Edge 530 — wtedy jedyną metodą jest oauth-helper + przebudowanie aplikacji
SpotiRide/
├── manifest.xml # Konfiguracja aplikacji Garmin
├── monkey.jungle # Plik budowania
├── source/
│ ├── SpotifyApp.mc # Punkt wejścia aplikacji
│ ├── SpotifyView.mc # Ekrany — Spotify + dane jazdy
│ ├── SpotifyDelegate.mc # Obsługa przycisków i menu
│ ├── SpotifyApi.mc # Komunikacja z API Spotify
│ ├── TokenManager.mc # Logowanie i tokeny Spotify
│ └── AboutView.mc # Ekran „O aplikacji" z kodem QR
├── resources/
│ ├── drawables/ # Ikona aplikacji + kod QR
│ ├── strings/strings.xml # Nazwa aplikacji
│ ├── properties.xml # Definicje ustawień aplikacji
│ └── settings/settings.xml # Ustawienia w Garmin Connect Mobile
oauth-helper/
└── index.html # Strona do uzyskania tokenu Spotify
CLAUDE.md # Instrukcje dla Claude Code (AI)
MIT — możesz używać, zmieniać i udostępniać ten kod za darmo.
A watch-app for the Garmin Edge 530 bike computer that shows the currently playing Spotify track on screen and lets you control playback. It also displays cycling data (speed, distance, time, heart rate, temperature, etc.) and records activities to Garmin Connect.
Spotify:
- Track title and artist display
- Track progress bar
- Like a track with LAP button
- Play/pause, next/previous track
- Shuffle and repeat control
Cycling data (2 screens):
- Speed, average speed
- Distance, ride time, timer
- Heart rate, temperature, time of day
- Sunset time, battery level
Activity recording:
- Start/pause with START button
- Auto-pause at low speed
- Save to Garmin Connect
Other:
- Light/dark mode (auto or manual)
- Polish and English language
- Scrolling long track titles
- Garmin Edge 530 (bike computer)
- Phone with the Garmin Connect app (Android or iPhone)
- Spotify Premium (free accounts won't work)
- Computer with a USB cable to connect the Garmin
- Phone must be connected to Garmin via Bluetooth and have internet access
GitHub is a website where programmers share their code. You don't need to know programming — just download the files to your computer.
Option 1: Download as ZIP (easiest)
- Go to the project page: https://github.com/bobok7/SpotiRide
- Click the green "Code" button
- Click "Download ZIP"
- Unzip the downloaded file anywhere on your computer (e.g. on your Desktop)
- Done — you have the entire project on your computer
Option 2: Using Git (for advanced users)
Git is a version control program. If you want to use it:
- Install Git from: https://git-scm.com/downloads
- Open a terminal (command prompt) and type:
git clone https://github.com/bobok7/SpotiRide.git
This command will download the entire project into a SpotiRide folder on your computer.
Git glossary (if you come across these terms):
- Repository (repo) — a project folder stored on GitHub
- Clone — downloading a copy of a project from GitHub to your computer
- Commit — saving changes to the project history (like "save game")
- Push — sending your changes from your computer to GitHub
- Pull — downloading the latest changes from GitHub to your computer
- Branch — a separate version of the project (e.g. for testing new features)
- Fork — copying someone's project to your own GitHub account
If you don't plan to modify the code or share changes — Option 1 (ZIP) is all you need.
Every user needs to create their own "app" on the Spotify website. It's free and takes 2 minutes. It's not a real app — it's just how Spotify gives access to your account.
- Open your browser and go to: https://developer.spotify.com/dashboard
- Log in with your Spotify account (the same one you listen to music with)
- Click the green "Create App" button
- Fill in the form:
- App name: type
SpotiRide(or any name) - App description: type
Garmin(or any description) - Website: leave empty
- Redirect URI: type exactly this address (copy and paste):
and click "Add" next to it
https://garmin-spotify-callback.invalid/callback - APIs used: check Web API
- Accept the terms of service
- App name: type
- Click "Save"
Now you need to add your account as a test user (new Spotify apps are in test mode):
- On your app's page, click the "Settings" tab
- Then go to the "User Management" tab
- Enter your email address (same as Spotify) and click "Add user"
Finally, copy your credentials:
- Go back to the "Settings" tab
- You'll see Client ID — copy it (you'll need it later)
- Click "View client secret" — copy the Client Secret too
Save both somewhere temporarily (e.g. in Notepad).
A Refresh Token is a special key that lets the app on your Garmin connect to your Spotify account. You'll get it using a page included in the project.
- In the project folder, find the oauth-helper folder
- Open the index.html file (double-click it — it will open in your browser)
- Paste the Client ID and Client Secret from Step 1
- Click the green "Zaloguj sie do Spotify" button (it means "Log in to Spotify")
- A new tab will open — log in to Spotify and click "Agree"
- After logging in, the browser will show an error (e.g. "can't open page") — this is normal!
- Click on the address bar in your browser (where the long address starts with
https://garmin-spotify-callback...) - Select the entire address (Ctrl+A) and copy it (Ctrl+C)
- Go back to the SpotiRide tab
- Paste the copied address into the text field (Ctrl+V)
- Click "Pobierz Refresh Token" (it means "Get Refresh Token")
- Your Refresh Token will appear — click "Kopiuj" (Copy)
Save the Refresh Token — you'll need it in the next step.
For the app to connect to your Spotify account, you need to enter your credentials into a code file. Don't worry — you just need to change 3 lines of text.
- In the project folder, open the SpotiRide folder, then source
- Open the file TokenManager.mc in any text editor (e.g. Notepad)
- At the top of the file you'll find these lines:
var gClientId = "TWOJ_CLIENT_ID";
var gClientSecret = "TWOJ_CLIENT_SECRET";
and further down in the class:
var hardcodedRefreshToken = "TWOJ_REFRESH_TOKEN";
- Replace the text inside the quotes with your own data:
- Replace
TWOJ_CLIENT_IDwith your Client ID from Step 1 - Replace
TWOJ_CLIENT_SECRETwith your Client Secret from Step 1 - Replace
TWOJ_REFRESH_TOKENwith your Refresh Token from Step 2
- Replace
- Save the file
To turn the code into a file you can load onto your Garmin, you need a few things:
A) Visual Studio Code (free code editor):
- Go to https://code.visualstudio.com
- Download and install it
B) Connect IQ SDK (Garmin's tools for building apps):
- Go to https://developer.garmin.com/connect-iq/sdk/
- Download the SDK Manager and install it
- In SDK Manager, download the latest SDK version
- In SDK Manager, also download the Edge 530 device
C) Monkey C extension for VS Code:
- Open Visual Studio Code
- Click the square icon on the left side (Extensions)
- Search for "Monkey C" and install the extension by Garmin
D) Developer key:
- In VS Code, press Ctrl+Shift+P
- Type "Monkey C: Generate Developer Key"
- Choose a location to save the key
- Open Visual Studio Code
- Click File > Open Folder and select the SpotiRide folder (the one with the monkey.jungle file)
- Press Ctrl+Shift+P (the command palette will open)
- Type "Monkey C: Build for Device" and select that command
- Choose edge530 as the device
- Wait for the build to finish — you'll see "BUILD SUCCESSFUL"
- In the bin folder you'll find SpotiRide.prg — that's your ready app
- Connect your Garmin Edge 530 to your computer with a USB cable
- The Garmin will appear as a drive (e.g. drive F: or E:)
- Open that drive and go to the GARMIN folder, then APPS
- Copy the SpotiRide.prg file into that folder (GARMIN/APPS/)
- Safely eject the Garmin (click "Safely Remove Hardware" in your system tray)
- The Garmin will restart
- On your Garmin Edge 530, press the START button
- Instead of starting a ride, go to Menu > Connect IQ Apps > SpotiRide
- Start playing music in Spotify on your phone
- After a few seconds, the track title will appear on the Garmin screen
| Button on Garmin | What it does in SpotiRide |
|---|---|
| START (top right) | Starts or pauses activity recording |
| LAP (bottom right) | Likes the current track on Spotify |
| Middle button | Opens the menu with settings and music controls |
| UP (top left) | Switches to the previous screen |
| DOWN (bottom left) | Switches to the next screen |
| BACK (middle left) | Saves activity and exits the app |
Spotify controls:
- Play / Pause — resume or pause music
- Next track / Previous track
- Shuffle — on/off
- Repeat — off / playlist / single track
Settings:
- Screen mode — auto (dark in the evening) / light / dark
- Refresh rate — how often it checks what's playing (5/10/15/30 seconds)
- Scrolling — enables scrolling of long track titles
- Temperature — Celsius or Fahrenheit
- Auto pause — automatically pauses recording when you stop (speed threshold 2-6 km/h)
- Pause delay — how many seconds below threshold before auto pause kicks in (none / 3s / 5s / 10s)
- Language — Polish or English
Other:
- Login Spotify — login via phone (note: on Edge 530 this option may not work — in that case use oauth-helper, see Step 2)
- Refresh token — manually refresh the connection
- Spotify status — check if the connection works
- About — screen with author info and a QR code to GitHub
- Save activity — saves the ride to Garmin Connect
- Discard activity — deletes the ride without saving
Why do I need Spotify Premium? Free Spotify accounts don't allow other apps to check what's currently playing. This is a Spotify limitation, not this app's.
Is this safe? Yes. The app connects directly to your Spotify account. Your credentials (Client ID, Secret, Token) are only on your Garmin and in your code — they are not sent anywhere else.
Track doesn't show / says "No music"
- Make sure Spotify is playing on your phone
- Make sure your phone is connected to the Garmin via Bluetooth
- Wait a few seconds — info refreshes every 5-30 seconds
- Go to menu > "Spotify status" — it should say "Connected"
Token expired / not working
- Go to menu > "Refresh token"
- If that doesn't help — repeat Step 2 (get a new Refresh Token) and Step 3
- The "Login Spotify" menu option may not work on Edge 530 — in that case the only method is oauth-helper + rebuilding the app
MIT — you can use, modify, and share this code for free.