Thank you for your donation!


Allo Attenuator
#11
I think I figured it out. Here is the recipe.

Code:
sudo apt-get -y install python-smbus i2c-tools libi2c-dev

sudo nano /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev
i2c-bcm2708

sudo reboot

Then test communications
Code:
sudo i2cdetect -y 1

    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                        

I tried @andrewewa code but could not get it to work so I wrote something from scratch and it indeed controls the Allo relay attenuator :-)
Code:
#    Attenuator volume range: 63 - 127 (64 steps)
#    - 63 or less is mute
#    - 64 is 0dB
#    - 127 is -63dB

import smbus
import sys

program_version = "1.0"

bus_address = 0x21
bus = smbus.SMBus(1)

def main():
    # Parse input args
    if len(sys.argv) > 1:
        if sys.argv[1] == "--version" or sys.argv[1] == "-v":
            print("relay-attenuator.py version " + program_version)
            sys.exit(0)

        if len(sys.argv) > 2:
            print("Too many arguments")
            sys.exit(0)
        else:
            volume = int(sys.argv[1])

            if volume <= 0:
                volume = 63
            elif volume >= 63:
                volume = 64
            else:
                volume = 127 - volume

            update_volume(volume)

def update_volume(volume):
    print(volume)
    bus.write_byte(bus_address, volume)

#
# Script starts here
#
if __name__ == '__main__':
    main()

I'll have to defer integration into moOde until the 6.3.0 timeframe (October). One of the challenges is that the attenuator volume range is 64 steps while moOde knob is 100 steps.

-Tim
Reply
#12
Nice!

Ah the good old days when I was programming early minicomputers from the front-panel switches (think DEC PDP8/PDP11/Data General Nova/etc). Knew all the powers of two up to 2^18 by heart. 

Of course our amps go to 64!

Regards,
Kent
Reply
#13
I bought the Allo unit when it came out but unfortunalty it didn't have moode support. 
I think Moode is the best from all its competition paid and free so its been sitting unused ever since.
Suddenly I saw this thread, followed the first part of your procedure Tim, but after that was lost.

Any chance for a quick step by step would really appreciate it ?
Reply


Forum Jump: