Adding Track Info Display (part 2)

 

In my previous post, I outlined some improvements I wanted to implement for the track display project using the Yamaha R-N602. This time, I’ve tackled two key enhancements: supporting non-ASCII characters and displaying the time when the receiver is off. Here’s how it came together.

Handling Non-ASCII Characters

I enjoy a wide range of music, some of which isn’t in English. This often means track titles, artist names, and album titles include characters the LCD display doesn’t render correctly. The R-N602 provides these details as UTF-8 encoded JSON but my LCD display can’t handle non-ASCII characters. Since I couldn’t find an Arduino library to convert UTF-8 to ASCII, I decided to write my own solution.

The implementation is straightforward. I created helper lambda functions to assist the processDetails function. A small map translates specific UTF-8 characters to their ASCII equivalents—for example, the character è becomes e. The map is intentionally kept short to optimize performance as it’s searched linearly. So some characters aren’t mapped.

Two lambda helpers complete the setup:

  1. One maps individual characters.
  2. The other replicates the behaviour of strncpy, applying the mapping to entire strings.

This approach allowed me to seamlessly replace strncpy calls in processDetails with my helper function. Now, a track title like Florence sur les Champs-Élysées appears as Florence sur les Champs-Elysees on the display. While this transformation sacrifices accents, it significantly improves readability—though a French speaker might disagree!

Adding a Time Display

I also added functionality to display the current time, day, and date when the R-N602 is turned off. This feature uses two Arduino pins which my LCD display shield exposes.

  • Pin A1: Toggles between GMT and BST (British Summer Time), the two time zones in Scotland. The default is GMT, but pulling the pin low switches to BST.
  • Pin A2: Controls whether the time display is always active. By default, the display shows track details, but pulling this pin low forces the clock to display.

With these additions, the project doubles as a clock.

For simplicity, the time is fetched from an NTP server since the Arduino doesn’t have a real-time clock module. Accuracy isn’t perfect—it can drift by up to 30 seconds—but it’s sufficient for this use case.

Initially, I tried using an existing Arduino library to handle the time, but I encountered issues with the day() function, which appeared unavailable probably due to a misconfiguration in my setup. Rather than spending more time troubleshooting (I’ve already dealt with my fair share of library issues), I opted to reuse some lambda functions from a previous project. Functional programming really shines here: self-contained, global-free functions are easy to repurpose with minimal effort.

Bug Fixes Along the Way

While working on these features, I also fixed a few bugs. The most significant was a scrolling issue: the last two characters of a scrolling text string weren’t displaying due to a -1 where there should have been a +1. A small fix, but it made a big difference in usability.

Wrapping Up

That’s it for now. These enhancements have made the track display project much more functional and user-friendly. If you’re interested, the updated code is available here: yamaha-song.ino.zip.

I hope this inspires some ideas for your own projects! If you’ve got questions or suggestions, feel free to share in the comments.

Adding Track Info Display to a Yamaha R-N602 with Arduino

If you’re like me, and you listen to music on a Yamaha R-N602 network receiver via Qobuz, you will  appreciate that the R-N602 can stream directly without needing a phone or tablet as an intermediary. Qobuz, with its detailed remastering, delivers the kind of sound quality that I prefer over other streaming services.

However, there’s a minor drawback: the R-N602’s display doesn’t show any track information—just a generic “Qobuz” label. I decided to fix this with a small, adaptable project using an Arduino R4 Wi-Fi and an LCD shield to display the track, artist, and album information in real-time.

Project Overview

The concept is straightforward: the Arduino connects to the same Wi-Fi as the R-N602, retrieves the currently playing track information from the receiver, and then displays it on a 2×16 LCD screen.

Here’s how it works:
1. Interfacing with the R-N602: The Yamaha receiver serves a web page in JSON format, containing details about the current track. By connecting to this page, the Arduino can extract the artist, track title, and album name.
2. Displaying the Info: The artist and album are initially shown one per line on the LCD. Then, the track name appears across both lines. If the information is longer than the screen’s width, it scrolls once to show the full text before switching to a truncated display.
3. Continuous Updates: The code loops to refresh the display periodically, keeping it in sync with the receiver’s current playback status.

Setting Up the Project

Here’s what you’ll need:
• An Arduino R4 WiFi and a compatible 2×16 LCD shield. I used these because they were to hand.

• To install some libraries needed by the project—WiFiS3, ArduinoHttpClient, ArduinoJson and LiquidCrystal.

• Access to your WiFi credentials, which are saved in a separate arduino_secrets.h file. Here’s how that file should look:

#define SECRET_SSID “Your Wifi SSID”
#define SECRET_PASS “Your Wifi Password”

Code and Demo

You can find the complete code for this project in my next post. To see it in action, check out the demo video here: IMG_2071.mp4. (BTW this video shows a scrolling bug which has been fixed.)

You’ll need to edit the code to put in your Yamaha’s IP address.

This project, while initially intended to add track info display to my setup, could be adapted for other similar use cases.

Improvements on the Horizon

There’s always room for some tweaks. Here are a few ideas I’ve been considering:
• Split track lines at a word: Ensuring clean breaks in text can make track info easier to read.
• Handle non-ASCII characters: tracks and albums often include accented characters—like “Florence sur les Champs-Élysées”—and properly supporting these would make them much more legible.
• Instant track info updates: As soon as a track changes, the displayed details should switch immediately, keeping everything in sync. This doesn’t look easy.

I’m leaning towards prioritizing non-ASCII character handling first. Many of the albums I enjoy feature accented characters, and ensuring they’re displayed correctly feels like a good improvement.

Enjoy tinkering, and happy listening!