Changes between Version 2 and Version 3 of mycroft_mark-2_sound


Ignore:
Timestamp:
05/01/20 17:37:04 (2 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • mycroft_mark-2_sound

    v2 v3  
    11=== Adafruit Volume control ===
    2 I am controlling the volume of the MAX9744 using the CircuitPython Libraries (see [https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi] ).
     2
     3UPDATE: Based on a posting of user j1nx on the mycroft forum (thanks a lot!) the better way to control the initial value of the Adafruit using i2cset and an udev-rule
     4==== Enable I2C ====
     5I2C is not enabled by default so run and enable I2C in the Interfacing Options
     6==== Volume control with i2cset (preferred) ====
     7Install the i2c-tools:
     8* sudo apt-get install i2c-tools
     9The command to set the volume (30) is:
     10* i2cset -y 1 0x4b 30
     11Create the udev-rule:
     12* sudo nano /etc/udev/rules.d/10-i2c-sound.rules
     13with the content:
     14{{{
     15SUBSYSTEM=="i2c", ATTR{name}=="bcm2835 I2C adapter", RUN+="/usr/sbin/i2cset -y 1 0x4b 30"
     16}}}
     17This blindly sets the volume as soon as the i2c adapter is seen by udev.
     18===== How to find the value for the udev rule =====
     19Use the command:
     20* udevadm info -a -p /sys/bus/i2c/devices/i2c-1
     21to get the values for SUBSYSTEM and ATTR
     22==== Volume control with the Adafruit python library (alternative) ====
     23Control the volume of the MAX9744 using the CircuitPython Libraries (see [https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi] ).
    324The things that I had to do:
    4 ==== Install the library ====
     25===== Install the library =====
    526while in (.venv)
    627* pip3 install RPI.GPIO
    728* pip3 install adafruit-blinka
    829* pip3 install adafruit-circuitpython-max9744
    9 ==== Enable I2C ===
    10 I2C is not enabled by default so run and enable I2C in the Interfacing Options
    11 ==== Python script ====
     30===== Python script =====
    1231Use this script to set the initial volume to about the half (the range is 0 to 63). Create ~/bin/ada_volume.py with the following content
    1332* nano ~/bin/ada_volume.py
     
    2039amp.volume = 30
    2140}}}
    22 ==== Start using systemd ====
     41===== Start using systemd =====
    2342Place a service file in the user directory:
    2443* nano ~/.config/systemd/user/myadavolume.service