Moode Forum
Allo Attenuator - Printable Version

+- Moode Forum (
+-- Forum: Audiophile (
+--- Forum: Audio gear (
+--- Thread: Allo Attenuator (/showthread.php?tid=1644)

Pages: 1 2

Allo Attenuator - PossumJenkins - 08-20-2019

I think this was asked sometime ago and the answer was perhaps in the future.

Do you have a rough idea when/if Moode will be able to control the Allo Attenuator?

I would love to come back to Moode.


RE: Allo Attenuator - Tim Curtis - 08-20-2019


I'm not getting any demand for it and thus its not getting any priority on the TODO list but if another dev wants to write the code, integrate and test it I'll have a look.


RE: Allo Attenuator - andrewewa - 08-27-2019

(08-20-2019, 09:13 PM)Tim Curtis Wrote: Hi,

I'm not getting any demand for it and thus its not getting any priority on the TODO list but if another dev wants to write the code, integrate and test it I'll have a look.

This is simple python program written in few hours that uses onboard i2c. In my opininion it's not  that nobody awaits for Allo Attenuator to be working in Moode. I show you how simple it is to use with bare I2C and Python. To use it I2C needs to be initialized as usually on Raspberry PI and then you can issue a command like :

python 5

that will set volume to 5 with mute on

If you want to turn mute off to have to add 64 to that. Here is the script to be written in file:

# To run it you must have I2C enabled on Raspberry PI and Python working (by default it is). R-Attenuator must be connected to I2C lanes, that's all.
# Usage in linux bash:

# python VOLUME

# where VOLUME is in range of 63 - 127  , where 64 is 0dB and 127 is -63dB, 63 and less is mute ON
# mute is on 6th bit (counted from 0) , 0 is mute ON, 1 is mute OFF,
# so overall value for volume is in range of 0 - 127, but mute being off makes it 64 - 127
# Reading push buttons is not implemented because it's not needed for anything.

import smbus
import sys
bus = smbus.SMBus(1)
ADDRESS = 0x21
VOLUME = int(sys.argv[1])

class ALLO():
        def __init__(self):

        def write_command(self):

                bus.write_byte(ADDRESS, VOLUME)

from ALLO import ALLO
allo = ALLO()


moOde is superb

RE: Allo Attenuator - Tim Curtis - 08-28-2019

Thats cool.

Is this a replacement for the routines in Allo's Git repo?


RE: Allo Attenuator - andrewewa - 08-31-2019

No, it doesn't replace it. Python script is executed once, raw 1 byte value that controls relays is sent to I2C and nothing is running in the background. This way you cannot mute and un-mute because you have to remember what volume was it set to earlier. I did this script that you could interface it the easiest way to the volume control in moode if you can put python scripts in control interface somehow, I don't know. That part is beyond me. If you wish I could change this program slightly , let say to have range of 0-63, where 0 is mute and 63 highest volume, or only shift it that 0 is mute, 1 highest volume, 63 lowest or etc. I could also implement reading the actual state of volume , but is it needed? Please suggest what you would like to have to be done.

RE: Allo Attenuator - Tim Curtis - 08-31-2019

I see. It's strictly a volume control script.

It doesn't need its own mute capability because moOde maintains the current volume and mute state. I suppose I'll have to connect the attenuator to my Boss rig and see what's required to integrated into moOde.

I'll move it closer to the top of TODO list :-)

RE: Allo Attenuator - andrewewa - 08-31-2019

Sounds great Smile

RE: Allo Attenuator - Tim Curtis - 09-07-2019

I'm getting an error when testing. See below.

pi@rp2:~ $ sudo /var/www/command/ 100
Traceback (most recent call last):
 File "/var/www/command/", line 24, in <module>
   bus = smbus.SMBus(1)
IOError: [Errno 2] No such file or directory

Are there other packages that need to be installed besides smbus?

pi@rp2:~ $ sudo pip install smbus
Looking in indexes:,
Collecting smbus
Installing collected packages: smbus
Successfully installed smbus-1.1.post2

pi@rp2:~ $ sudo pip show smbus
Name: smbus
Version: 1.1.post2
Summary: Python bindings for Linux SMBus access through i2c-dev
Author: Mark M. Hoffman
License: GPLv2
Location: /usr/local/lib/python2.7/dist-packages

pi@rp2:~ $ cat /boot/config.txt


RE: Allo Attenuator - andrewewa - 09-07-2019

I don't have access to that particular Raspberry pi that I have messed with right now, but for sure I had issued commands like these:

sudo apt-get install i2c-tools
sudo apt-get install python-smbus
sudo adduser pi i2c    **************this one was unnecessary

and some

sudo apt-get update
sudo apt-get install

and exactly I have commented out few lines :

/etc/modprobe.d/raspi-blacklist.conf   and  simliar in that directory

I gave # in front of "blacklist i2c-bcm2708" and similar

and also in

/boot/config.txt I have enabled:



Anyway I have followed some general help on I2C.  I've found command : sudo raspi-config, this will run dos style config, you can try it out, should also do the thing probably.

smbus.SMBus(1) is line that resides in the begging of this two row connector. On other line it will be probably also smbus.SMBus(0) or maybe other, depends where you have connected it.

To list I2C devices you have to type:

i2cdetect -y 1

and should see one byte not being 0, probably byte 0x21, saying from heart, when you connect I2C device of course. Python script will also give some random error if I2C line is not correct, so first thing is at least to have device detected .

By the way, please share my code , license is freeware, I didn't mention it before, but for legal notice I'm doing it right now.


RE: Allo Attenuator - TheOldPresbyope - 09-07-2019

@Tim Curtis

Did you have any i2c device connected?

If not, I believe the code invoked by the smbus.SMBus() line would fail as you describe because it can't find an /dev/i2c<something> entry.

Just a guess based on "reading the tea leaves" of past Python failures of my own. Since I have no i2c device to play with I can't play along  Tongue