volumio@aoide2:/volumio/app/plugins/system_controller/i2s_dacs/scripts$ sudo pip3 install smbus2 websocket-client --break-system-packages
Looking in indexes: Simple index, piwheels - Simple index
Requirement already satisfied: smbus2 in /usr/local/lib/python3.11/dist-packages (0.6.0)
Requirement already satisfied: websocket-client in /usr/local/lib/python3.11/dist-packages (1.9.0)
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.14.2 documentation
volumio@aoide2:/volumio/app/plugins/system_controller/i2s_dacs/scripts$ cd /volumio/app/plugins/system_controller/i2s_dacs/scripts
source venv/bin/activate
/volumio/app/plugins/system_controller/i2s_dacs/scripts/venv/bin/python3 ES9018K2M_I2C_Volumio.py
Traceback (most recent call last):
File “/volumio/app/plugins/system_controller/i2s_dacs/scripts/ES9018K2M_I2C_Volumio.py”, line 6, in
import smbus2
ModuleNotFoundError: No module named ‘smbus2’
Really I have no clue why it still gives this errors if we already have smbus2 module installed.
Perhaps there is some conflicts between the models in your system, but this is just a guess.
Better to ask someone more knowledgeable in Linux to help. @nerd @Josh2000
On a clean system, everything installs according to the instructions without any problems.
ok - i will start from scratch on a clean system tomorrow again with all the info i collected today
thank you
i will report ![]()
Thanks Josef, good luck!
Hi @nerd,
I see what you mean and that the current approach may be risky and break OTA updates.
But on the one side i just want to use my ES9018K2M based DAC hats with Volumio 4 and i am aware that i will have to do all installation steps from scratch if i want to update to a new version and on the other i know i don’t have to expect support on it.
Therefore i first wan‘t to get it running at all and then - maybe „with a little help from a friend“, who does an odd scribble here and there
i would love to help testing while development of a „real“ and conform plugin could get started.
unfortunately i don’t have the necessary coding skills to do it
BR
Josef
Hi,
Did a complete new install (with npm install and without RPi.GPIO) and now it is working.
![]()
Most likely i forgot to enable the venv yesterday at the first try of pip install…
Also pip list shows much less than yesterday. Now it shows:
(venv) volumio@aoide4:/volumio/app/plugins/system_controller/i2s_dacs/scripts$ pip list
Package Version
pip 23.0.1
setuptools 66.1.1
smbus2 0.6.0
websocket-client 1.9.0
Now the next question is how does one prebuild the npm package and create a valid volumio plugin
@Grey_bird - do you think you can do it ? I’d be there for testing ![]()
@Josh2000 @Grey_bird - Good to see progress.
To answer the question about prebuilding npm packages with native modules - the short answer is: avoid native modules entirely if possible.
The i2c-bus npm package requires compilation because it contains C++ bindings. Shipping pre-compiled binaries means building for every architecture (armhf, aarch64, x64) against the correct Node.js version and glibc. When Volumio updates Node.js or the kernel, those binaries break. This is why plugins that ship native modules are maintenance headaches.
The cleaner approach is to use i2c-tools which is already in the Volumio base image. Instead of:
const i2c = require('i2c-bus');
const bus = i2c.openSync(1);
bus.writeByteSync(0x48, 0x0F, value);
Use:
const { exec } = require('child_process');
exec('i2cset -y 1 0x48 0x0f ' + value);
No compilation. No native modules. Works across OTA updates.
I have put together a plugin concept using this approach:
git clone --depth=1 https://github.com/foonerd/es9018k2m-plugin.git
cd es9018k2m-plugin
volumio plugin install
It includes:
- Volume sync via WebSocket (no Python service)
- Mute-on-track-change for pop prevention
- Fixed 64FS overlays (Type A and Type B boards)
- Filter/DPLL/balance controls
No guarantees - I do not have ES9018K2M hardware to test with. This is based on code review and datasheet. Would appreciate testing feedback and bug reports via GitHub issues.
One note: the plugin requires selecting i2s-dac in Volumio Playback Options first (to establish ALSA/mixer), then configuring the board type in plugin settings. README has details.
Take a note - No support is offered. Until further notice - this is concept only.
Kind Regards,
I do not mean to take over your work and guide, it is simple yet effective replacement of the logic and methods you started with and I have mentioned before.
Update on the plugin concept:
v1.1.0 further simplifies the architecture significantly based on feedback from @Darmur:
REMOVED:
- Type-A / Type-B board selection (all ES9018K2M HATs have onboard oscillators)
- Custom overlay management (standard i2s-dac works fine)
- 150ms mute on track change (was breaking gapless playback)
ADDED:
- Optimal init registers derived from ES9038Q2M work
- Hardware soft-start via register 0x0E for pop-free sample rate changes
- Prerequisites banner in UI explaining setup
The DAC handles FS changes smoothly at hardware level with proper register configuration - no software mute needed.
Setup is now simpler:
- Select i2s-dac in Volumio Playback Options
- Reboot
- Install and enable plugin
I do not have access to ES9018K2M hardware. If you have the hardware and want this plugin to work - you need to test it and report back. Without testing feedback I have no idea if this actually works. Please raise issues on GitHub with logs and observations.
https://github.com/foonerd/es9018k2m-plugin
Kind Regards,
Quick update on ES9018K2M plugin testing:
Got hardware access for testing (Aoide DAC II). Found and fixed few issues:
- Chip ID detection was broken
- Socket.io incompatible with Volumio 4 - replaced with internal callbacks
- Volume range was wrong (0-127dB instead of sensible 0-50dB range)
- Added seek mute for pop prevention
- Added configurable debug logging (default off)
- Fixed polling to not destroy SD cards
Still needs work on event-driven state detection - currently using polling which is not ideal. Volume sync works well via internal callbacks though.
v1.1.1 pushed to GitHub with these fixes. Set “Seek Mute Duration” to 0 if you want minimal system impact and can live with seek pops.
https://github.com/foonerd/es9018k2m-plugin
Testing continues. Feedback welcome via GitHub issues.
Kind Regards,
Installation is working smooth.
After the installation the mixer type is set to none and has to be changed to software.
How can i check if volume control is done in hardware and not in software ?
The new version 1.2.1 solves the mixer type issue directly.
Hardware Volume Mode
The plugin can now register as a hardware volume controller. This enables the volume slider when Mixer Type is set to None - no need to switch to Software mode, set your mixer to “None”.
In plugin settings:
- Set “Volume Control Mode” to “Hardware (Override)”
- Save
Volume slider should appear immediately. All volume control goes through the DAC hardware registers.
Graceful Volume Ramping
Added smooth fade in/out to eliminate pops:
- Seek operations (always uses graceful mute)
- Play/pause/stop transitions (configurable)
- Volume changes >5% (configurable)
Configurable steps (1-5) - more steps = smoother but slower.
Testing
Tested on Aoide DAC II with Volumio 4. No pops on seek, play, pause, stop. Volume slider syncs correctly in hardware mode.
Installation
git clone --depth= https://github.com/foonerd/es9018k2m-plugin.git
cd es9018k2m-plugin
volumio plugin install
Feedback welcome via GitHub issues.
Kind Regards,
ES9018K2M Plugin v1.2.3 - Safe Startup & Attribution Note
What’s New
v1.2.2/v1.2.3 adds speaker protection features for hardware volume mode:
Safe Startup Volume
- Caps volume on boot if system volume exceeds safe level
- Configurable threshold (e.g., 25%)
- Only caps down, never increases
Start Muted
- DAC starts muted on plugin load
- Use volume slider to unmute
- If “Remember Last Volume” also enabled, slider shows your remembered level
Remember Last Volume
- Saves volume on shutdown/reboot
- Restores on next start
- Uses config.save() to ensure persistence
Technical Fixes
- Waits for VOLUMIO_SYSTEM_STATUS=ready before applying startup settings (pattern from autostart plugin)
- Without this, Volumio’s own startup volume would override plugin settings
- Dynamic UI with visibleIf - hardware-only options show/hide without page refresh
Installation
git clone --depth=1 https://github.com/foonerd/es9018k2m-plugin.git
cd es9018k2m-plugin
volumio plugin install
Attribution and Plugin Store Submission
Before submitting to the plugin store, I want to address origins clearly.
Prior ES9018K2M work:
- @Grey_bird - Python systemd service with smbus2/websocket for basic volume sync
- @
Chris Song- Volumio plugin with i2c-bus npm module and own volume slider
I studied both to understand the general I2C control concept.
Key technical reference:
- @Darmur - ES9028Q2M register configuration work. The DAC initialization sequence, register values (particularly 0x0E for hardware soft-start), and hardware volume override approach all derive from Darmur’s prior work on the ES90xx family.
What’s different here:
| Aspect | Prior ES9018K2M Work | This Plugin |
|---|---|---|
| I2C Method | smbus2 or i2c-bus (compiled) | i2c-tools shell (no compile) |
| Volume | Own slider or sync only | Hardware override (native Volumio slider) |
| Seek Handling | None | Pre-emptive mute intercept |
| Pop Prevention | None | Graceful ramping, hardware soft-start |
| Startup Protection | None | Safe volume, start muted, remember last |
| State Tracking | Basic or none | socket.io + commandRouter integration |
| Register Config | Basic | From Darmur’s ES9028Q2M work |
The architecture, Volumio integration approach, and feature set are fundamentally different from the prior ES9018K2M implementations. The register configuration knowledge came from @Darmur’s ES9018 work, adapted for the ES9018K2M.
My position: This is a new implementation, not a fork. But I respect the community and original authors. If Grey_bird, Chris Song, or Darmur have concerns about overlap or attribution, I’m happy to discuss before plugin store submission.
Request: Is the distinction clear and fair? Any concerns?
Kind Regards,
great work!
of course no problems from my side to have this published
The first approach of @Grey_bird is working and has inspired me to ask @nerd to help with making it volumio conform
@Grey_bird i fully respect your work very much as it gave me a possibility to use my AOIDE DAC2 devices in Volumio4 - on the other way if @nerd would offer his conform solution in the plugin store installation would get even much easier. What do you think ?
@nerd - in case @Grey_bird agrees to publish he should anyway be mentioned in the plugin as he started with the idea. What do you think ?
@Darmur - Thank you, much appreciated.
Attribution is already in the README credits:
- Audiophonics - Serial sync reference
- Chris Song - Original plugin concept
- Darmur - ES9028Q2M register configuration
- Grey_bird - I2C control implementation
- luoyi - Kernel driver reference
There have been several attempts to bring ES9018K2M control to Volumio over the years - Audiophonics serial sync, Chris Song’s plugin, Grey_bird’s Python service, luoyi’s kernel driver approach. Each contributed something, none reached the plugin store.
This plugin exists because of a chain of contributions:
- Grey_bird’s work got your Aoide DAC II working
- You asked if it could become a proper Volumio plugin
- Darmur’s ES9028Q2M register work provided the technical foundation
- Testing on your hardware validated the implementation
So credit belongs to everyone involved. The code is new, but the knowledge it’s built on came from the community.
If @Grey_bird is happy for this to go to the plugin store, I’ll submit it. The credits stay as they are - this was a collaborative effort.
Kind Regards,
Hi guys!
Huge thanks to @nerd for this awesome work — honestly, I’m speechless ![]()
Sorry for being a bit quiet lately, I’ve just been really busy these days and don’t have much time to play around with the DAC and Volumio…
From my side, you have full permission to use anything I’ve developed. I don’t claim any authorship or credit it’s totally fine for me!
My original goal was simply to get my old DAC board, which I bought about 10 years ago, working with the newer version of Volumio. I decided to share my solution here on the forum, but I honestly didn’t expect it to become so useful for other members.
I’m really happy it helped and that it turned into something bigger and more solid🙌
Dear Volumionauts,
ES9018K2M DAC Control v1.2.5 - UI Improvements & Bug Fixes
Quick update on recent changes:
UI Restructure
The Volume Control section has been reorganized for clarity:
- External Volume Device is now a simple On/Off toggle at the top of Volume Control section
- Clear description visible: “Enable if volume is controlled by external hardware such as Allo Relay Attenuator, pre-amplifier, or AV receiver”
- Volume Mode simplified to Hardware/Software (external moved to dedicated toggle)
- Fields now show/hide dynamically without page refresh
Bug Fix: Volume Persistence
Fixed an issue where “Remember Last Volume” would sometimes restore the wrong value after restart. Root cause: Volumio was calling the plugin’s volume handler before the system was fully ready, overwriting the saved value. Now properly blocked until startup completes.
Store Submission
Plugin has been submitted to the Volumio plugin store - pending review.
Testing Feedback Welcome
If you’re using the plugin, particularly with:
- External volume devices (Allo Relay Attenuator, pre-amps, receivers)
- Remember Last Volume feature
- Safe Startup Volume
Please report any issues. Debug logging available in Device Detection section.
Kind Regards,
Thank you for this amazing features!
Will be able to do some test in a couple of days, sorry
Thank you, will test after breakfast