• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

HLM, an open source homebrew Genelec GLM solution for volume control and more

Thanks for the update, @markb ! I managed to make a few changes based on your findings, but haven't checked them in yet. Will definitely review your new findings before check-in, though. I don't have a subwoofer, so it's great to see you managed to find out more. And good to know my specs helped someone.

I'm glad the Waveshare unit works. Mine was delayed, I should get it on Wed. I'm looking forward to test your code on my system. Alas, last week and the coming one are really busy, so won't be able to do much
 
First I want to say thanks to both of you! I will try this at home in the near future. Another thing that caught my attention was the volume display. I have near-zero technical skills, is it too hard to implement?
 
First I want to say thanks to both of you! I will try this at home in the near future. Another thing that caught my attention was the volume display. I have near-zero technical skills, is it too hard to implement?
If you buy the modules I describe in my project and wire them with Dupont wires as I explain, everything should work, including the volume display. You will need to figure out VSCode as well, but hopefully I set everything up so that "it just works". My project, though, doesn't give you Home Assistant integration

If you can assemble the hardware and can't figure out how to compile, I can send you the binary and instructions on how to flash it into your device. You don't need really any deep technical skills, just ability to follow instructions and possibly ask a LLM to help you when you get stuck (and, of course, ask us)

@markb's project doesn't require assembly, but doesn't use a volume controller or screen. That's a side effect of having two independent projects. I think that over time we might converge into one, but for now I think that each of us is more focused on a subset of features based on our speakers and priorities (for example, I'm half way to implementing a command line interface, so that you can use your python code to send anything to Genelec speakers)

I could not find any existing device that includes a RS485 interface, screen and an encoder. A possible solution might be, one of these https://www.elecrow.com/wiki/CrowPanel_1.28inch-HMI_ESP32_Rotary_Display.html and a simple RS485 module wired with the 1.25 connectors on that device.

What would people here like to see? I think that there's value in having a physical volume controller and display, in addition to the Home Assistant integration
 
I could not find any existing device that includes a RS485 interface, screen and an encoder. A possible solution might be, one of these https://www.elecrow.com/wiki/CrowPanel_1.28inch-HMI_ESP32_Rotary_Display.html and a simple RS485 module wired with the 1.25 connectors on that device.

What would people here like to see? I think that there's value in having a physical volume controller and display, in addition to the Home Assistant integration
My plan has been to build the hardware volume controller/UI into a separate (sibling) project on its own microcontroller, also based on ESPHome and LVGL, that controls espgensam through Home Assistant via its exposed entities. This is also a convenient for my use case compared to building it into a single all-in-one solution, as my GLM network cables/adapter are terminated in a separate room (tech cabinet) from where I want to control my media system. I can then put it anywhere with just USB-C power and wifi.

A few weeks ago, along with working on espgensam, I had quickly built a small prototype with a rotary dial & touch screen display, with basic functionality (dial volume control, mute, power on/off) for that with a M5Stack Dial. So far that has worked pretty well. I had not yet published that on Github as I've not given it much attention yet, but I'll see if I can push it soon if people want to try that. I know the M5Stack Dial is not the prettiest and not everyone's cup of tea, but there are many nice alternatives around (like also the CrowPanel above) which should be easy to support as well, they are overall pretty similar.

Of course, through Home Assistant, one can also tie it into just about anything else that can control a media player entity (or a number for colume control), like a Zigbee/Matter remote, or a dimmer light switch, or a scene button. Or tie it into your voice assistant if you like. There are also existing projects like deloop for rotary dial buttons like the M5Stack Dial that should already work for this or any other media player.
 
Yes, I can see how a split solution (UI and RS485) is best for some scenarios. And probably can be easily implemented using BLE and auto-discovery to avoid complex setup steps.

I just ordered a Nextion https://nextion.tech/wiki/onx2424g013/ . Unlike the Elecrow panel, this one "clicks" instead of supporting touch. While touch might be best to implement complex UI, for a simple volume + mute+ standby+source scenario I prefer physical clicks. Also, the Elecrow 1.28" was out of stock. Nextion and Elecrow are the best documented options and have sample code. There are quite a few option for a smart knob with a 2 board solution on Aliexpress, but documentation is horrible. And, yes, the M5stack which gives me nausea just by looking at it :)

Most of the smart knobs have yamls that act as a Home Assistant volume. The screen driver and encoder are all already in ESPhome. But not everyone has Home Assistant, and I'm trying to offer a solution that appeals to most people
 
Yes, I can see how a split solution (UI and RS485) is best for some scenarios. And probably can be easily implemented using BLE and auto-discovery to avoid complex setup steps.

I just ordered a Nextion https://nextion.tech/wiki/onx2424g013/ . Unlike the Elecrow panel, this one "clicks" instead of supporting touch. While touch might be best to implement complex UI, for a simple volume + mute+ standby+source scenario I prefer physical clicks. Also, the Elecrow 1.28" was out of stock. Nextion and Elecrow are the best documented options and have sample code. There are quite a few option for a smart knob with a 2 board solution on Aliexpress, but documentation is horrible. And, yes, the M5stack which gives me nausea just by looking at it :)
That's a nice one :) And it has PSRAM as well, so I can consider it for my separate dspin project as well, to directly combine with a DSPi board into a Music Assistant Sendspin target/network streamer.
Most of the smart knobs have yamls that act as a Home Assistant volume. The screen driver and encoder are all already in ESPhome. But not everyone has Home Assistant, and I'm trying to offer a solution that appeals to most people
Yes, makes sense.
 
I updated my specs to V13 with help from mark's docs, with fewer open questions. I also updated the code to reflect the changes. https://github.com/robcazzaro/hlm

I took the opportunity to add a cli mode to the HLM_HEX_DUMP build. The embedded device now receives input from the USB CDC port, properly formats the message (escape, CRC) and sends it to the RS485 bus. I also wrote a python example to send commands to the speakers, which was helpful to test unclear aspects of the protocol (like 2B and the LEDs/mute). The python script shows 3 windows onscreen, one with the received messages, one at the bottom to input commands, and a middle section with the response of the speakers to the command just sent. In order for the speakers to respond properly, the python script must act like a hub, sending discovery messages, assigning IDs and receiving telemetry. It can be used a starting point for custom code E.g. implement room correction on the PC with REW in an automated way). The UI also shows which speakers are assigned which ID and if they are not responding properly (shows a ! next to the speaker ID/serial)

I thought that, for most people, writing in python is more convenient than changing and debugging embedded code

I also realized that Waveshare sells two identical looking ESP32 RS485 devices, one with a CAN interface (the one Mark bought https://www.waveshare.com/wiki/ESP32-S3-RS485-CAN) and one with a relay https://www.waveshare.com/wiki/ESP32-S3-Relay-1CH. They cost roughly the same, and for our purposes work the same for the GLM bus. But I'd argue that if you were to buy one, you should get the relay one, especially if you use Home Assistant. In many cases, having a relay to control other devices is more useful than a CAN bus
 
I updated my specs to V13 with help from mark's docs, with fewer open questions. I also updated the code to reflect the changes. https://github.com/robcazzaro/hlm

I took the opportunity to add a cli mode to the HLM_HEX_DUMP build. The embedded device now receives input from the USB CDC port, properly formats the message (escape, CRC) and sends it to the RS485 bus. I also wrote a python example to send commands to the speakers, which was helpful to test unclear aspects of the protocol (like 2B and the LEDs/mute). The python script shows 3 windows onscreen, one with the received messages, one at the bottom to input commands, and a middle section with the response of the speakers to the command just sent. In order for the speakers to respond properly, the python script must act like a hub, sending discovery messages, assigning IDs and receiving telemetry. It can be used a starting point for custom code E.g. implement room correction on the PC with REW in an automated way). The UI also shows which speakers are assigned which ID and if they are not responding properly (shows a ! next to the speaker ID/serial)

I thought that, for most people, writing in python is more convenient than changing and debugging embedded code

Nice, that could get in handy.

I also realized that Waveshare sells two identical looking ESP32 RS485 devices, one with a CAN interface (the one Mark bought https://www.waveshare.com/wiki/ESP32-S3-RS485-CAN) and one with a relay https://www.waveshare.com/wiki/ESP32-S3-Relay-1CH. They cost roughly the same, and for our purposes work the same for the GLM bus. But I'd argue that if you were to buy one, you should get the relay one, especially if you use Home Assistant. In many cases, having a relay to control other devices is more useful than a CAN bus

Waveshare's product line-up is too damn large! ;) Yes, a relais could be used in trigger-out use cases. I'll add this board to my list of supported hardware.
 
libcec integration with something like this:

So CEC volune up/down, mute and on+off from HDMI CEC to GLM.

I've also been wanting to integrate CEC, so all my physical remote controls (projector's remote, and Apple TV, Chromecast in my case) do the same thing, and control the same volume/mute: my Genelec's volume setting.

Your message reminded me that I still had a very old Pulse Eight CEC USB adapter lying around. It was from their very first batch of products I think, from when they were first introduced, ~2010 or so. It seems to be the same as the device they still sell today, although the firmware on it is likely older. It was a very cool solution at the time.

However, after playing around a bit with libcec this weekend, I've concluded I don't really want to build off of that. It seems the library interface is still not stable, even after 15 years. E.g. the version now used in Debian Trixie (and Raspbian) is 7.x, and looks to be breaking compatibility again with version 8.x in the future. PyCEC needed a fair bit of fiddling and manual compilation to get it to work. Nowadays there is also the independent cec-ctl from V4L which uses the kernel CEC drivers and IOCTL interface directly.

Because espgensam is primarily meant to be used along with Home Assistant, a solution that gets CEC wired into Home Assistant would work (also to control Genelec through espgensam, or do anything else). But the existing hdmi-cec integration in Home Assistant Core looks a bit dated and not following modern standards, and is based on PyCEC/libcec. It also doesn't look optimal for what I need here, i.e. listening to volume/mute control for the bus.

In my case, I actually had an old Raspberry Pi 2 running in the same cabinet as my HDMI devices. So one way of making this work was to simply connect its HDMI output into my HDMI switch or Projector input. Raspberry PIs have supported CEC control natively for a long time.

I decided to build a Python tool, cec-audio-bridge, that would run on the RPi and interact with CEC through the Linux kernel's (stable) ioctl interface directly, and talk to Home Assistant over the Websockets API, avoiding a dependency on libcec. That seems to work great so far.

https://github.com/markbergsma/espgensam/tree/main/tools/cec_audio_bridge

What it does: The python script runs as a daemon, and announces itself as the "Audio System" (A/V receiver, CEC logical address 5), under OSD name "Genelec". That means all other CEC devices send it volume control and mute messages, and report its volume level. The script then forwards that to a designated media_player entity in Home Assistant (e.g. espgensam's). It can optionally power on/off the Genelecs as well.

Although this works very well, and was essentially free in my case (I already had an RPi 2 running here), I don't think it's an ideal solution for everyone. Alternative options exist, most notably https://github.com/Palakis/esphome-native-hdmi-cec which can also be used with ready-made hardware, for less than the Pulse Eight adapter. It's likely also possible to make it work with a single microcontroller, integrated directly into HLM or espgensam.

Having my projector, media players along with their remote(s), my Genelec speakers and Home Assistant all integrated and working harmoniously together now is very nice. :)
 
Waveshare's product line-up is too damn large! ;) Yes, a relais could be used in trigger-out use cases. I'll add this board to my list of supported hardware.
Funny thing is: I thought I bought the one we discussed, and only after receiving it I realized it's a different model :) the good news is that the DE/RE and DI and RO GPIOs are the same, so same code for both
 
Back
Top Bottom