Thank you for your donation!


Volume change with analog potentiometer_problem
#1
Good evening!
System - only Raspberry Pi 3b+
Long thought about replacing the rotary encoder analog potentiometer Idea . I connected the ADS1115 ADC and connected a potentiometer to it. As a code, I found it found in 

link
While experimenting with the output of headphones. Amixer 'PCM'
The code works, but somehow strange. The volume values in alsamixer and amixer are different. I will give an example. Amixer - 84%, alsamixer - 52%


Code:
amixer
Simple mixer control 'PCM',0
 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback -10239 - 400
 Mono: Playback -1300 [84%] [-13.00dB] [on]

Code:
Card: bcm2835 ALSA                                   F1:  Help               x
x Chip: Broadcom Mixer                                 F2:  System information x
x View: F3:[Playback] F4: Capture  F5: All             F6:  Select sound card  x
x Item: PCM [dB gain: -13.00]                          Esc: Exit               x
x                                                                              x
x                                     lqqk                                     x
x                                     x  x                                     x
x                                     x  x                                     x
x                                     x  x                                     x
x                                     x  x                                     x
x                                     x  x                                     x
x                                     xaax                                     x
x                                     xaax                                     x
x                                     xaax                                     x
x                                     xaax                                     x
x                                     xaax                                     x
x                                     xaax                                     x
x                                     tqqu                                     x
x                                     xOOx                                     x
x                                     mqqj                                     x
x                                      52                                      x
x                                  <  PCM   >

With what it can be connected?
Reply
#2
The link is broken. I get a 404 page not found error.
Reply
#3
(04-21-2019, 03:38 PM)Tim Curtis Wrote: The link is broken. I get a 404 page not found error.

Corrected the link in the first message
Reply
#4
Problem solved. At the address points in the code, a solution of the type was added to amixer:
amixer -M
Now everything works perfectly. It is more convenient than the rotary encoder. In subsequent projects I will use only analog potentiometers.
Reply
#5
Hi,

What are the advantages of having an Analog POT + ADC board over just going with a Rotary Encoder and moOde's built-in driver?

-Tim
Reply
#6
(04-23-2019, 12:32 AM)Tim Curtis Wrote: Hi,

What are the advantages of having an Analog POT + ADC board over just going with a Rotary Encoder and moOde's built-in driver?

-Tim

Hi,
I initially used the ADC board only for adaptive button illumination, then decided to connect the analog POT. The analog POT + ADC board has its pros and cons.
Pros:
- smooth volume control;
- the rotation angle is less than 1 revolution, as on a conventional amplifier, which allows you to sharply reset the volume to zero;
- in my city analog POT is much easier to find than an encoder.
Minuses:
- only the amixer volume is adjusted, the volume in the player itself remains unchanged. But for me it is irrelevant, because I mainly use the player without a browser using the IR remote control, buttons and the encoder.


I tried several types of rotary encoders, but none of them satisfied me completely.
Of the minuses:
- unpredictable volume control, depending on the speed of rotation;
- with fast rotation, the volume control is almost absent;
- by the position of the knob it is impossible to determine the volume level, you have to open the browser, which is not always convenient.
It's my personal opinion. In my projects, I use the combined DAC + AMP boards (Justboom, IQaudio) due to the compactness of the installation, so I use the analog potentiometer more conveniently.
Reply
#7
This is very interesting....perhaps you would be so kind as to make a step by step guide and post it in the FAQ and Guides thread so others  can try it.... Smile
Reply
#8
(04-23-2019, 07:04 AM)DRONE7 Wrote: This is very interesting....perhaps you would be so kind as to make a step by step guide and post it in the FAQ and Guides thread so others  can try it.... Smile
Wrote
Reply
#9
Just a suggestion. Instead of using amixer, why not use the moOde utility script /var/www/vol.sh?

That script is cognizant of moOde configuration and both adjusts the volume and updates the volume knob in the UI.

Regards,
Kent
Reply
#10
(04-23-2019, 12:44 PM)TheOldPresbyope Wrote: Just a suggestion. Instead of using amixer, why not use the moOde utility script /var/www/vol.sh?

That script is cognizant of moOde configuration and both adjusts the volume and updates the volume knob in the UI.

Regards,
Kent


Hey.
I know this scenario, it works fine with a rotary encoder, buttons, and IR remote control, but with a potentiometer, its operation will be incorrect. It is difficult to work out a working algorithm - for example, if, while the potentiometer is in the extreme right position, you change the volume in the browser to 0, then either the volume will not increase at all, or if you turn it, it will again become maximum.
If you have any suggestions how to implement it, I will be glad to try them. But I like what happened at the moment.
Thanks for the advice.
Reply


Forum Jump: