X9C503 works with ESP32?
Posted: Wed May 08, 2024 11:38 pm
I can't get X9C503 to work with ESP32 but it can with Arduino Mega.
What do I need --> To be able to operate the X9C503 to lower the volume of an audio line input. I don't want to use common manual potentiometers.
X9C503 Scheme:
INC__| o o | VCC
U/D__| o o | CS
RH___| o o | RL
GND__| o o | Rwiper
In my case:
INC------| o o | VCC (5v)
U/D------| o o | GND
Audio in | o o | GND
GND------| o o | Salida
On Arduino Mega I connect everything directly to the board and the operation is correct.
In ESP32 if I connect it to the board it doesn't work, so I have used the 2N3904 diode for the 'INC', 'U/D' pins (I have also tried with 'CS' but Arduino Mega does it well being grounded), and It works but it doesn't do it well, I describe the problem:
You have to enter values between 0 and 99, and in general it does it well, for low values the volume goes down and for high values the volume goes up. I detected the problem by always entering the same value.
In this case it was '91', if I enter it several times in a row I get different results, normally the volume remains constant but sometimes it goes up, other times it goes down and even total silence occurs
With Arduino Mega I enter the '91' 500 times and the
The volume never changes, it is constant and its operation is always correct.
What could be the problem?
What other component can I use?
As an alternative, I have tried the FM62429, with ESP32 it works correctly, but it has the amplification function that does not suit me. For the line input I already use 22kΩ resistors, then the potentiometer and finally the MSGEQ7, it doesn't make much sense to change a potentiometer to lower the voltage and replace it with a component that can amplify. I can limit the FM62429 by code, for example, to 60% and only use it to lower the volume, although I don't think it is a very elegant solution.
Audio Line In -> 22kΩ resistors -> X9C503 -> MSGEQ7
Audio Line In -> 22kΩ resistors -> FM62429 -> MSGEQ7
Any ideas or suggestions?
What do I need --> To be able to operate the X9C503 to lower the volume of an audio line input. I don't want to use common manual potentiometers.
X9C503 Scheme:
INC__| o o | VCC
U/D__| o o | CS
RH___| o o | RL
GND__| o o | Rwiper
In my case:
INC------| o o | VCC (5v)
U/D------| o o | GND
Audio in | o o | GND
GND------| o o | Salida
On Arduino Mega I connect everything directly to the board and the operation is correct.
In ESP32 if I connect it to the board it doesn't work, so I have used the 2N3904 diode for the 'INC', 'U/D' pins (I have also tried with 'CS' but Arduino Mega does it well being grounded), and It works but it doesn't do it well, I describe the problem:
You have to enter values between 0 and 99, and in general it does it well, for low values the volume goes down and for high values the volume goes up. I detected the problem by always entering the same value.
In this case it was '91', if I enter it several times in a row I get different results, normally the volume remains constant but sometimes it goes up, other times it goes down and even total silence occurs
With Arduino Mega I enter the '91' 500 times and the
The volume never changes, it is constant and its operation is always correct.
What could be the problem?
What other component can I use?
As an alternative, I have tried the FM62429, with ESP32 it works correctly, but it has the amplification function that does not suit me. For the line input I already use 22kΩ resistors, then the potentiometer and finally the MSGEQ7, it doesn't make much sense to change a potentiometer to lower the voltage and replace it with a component that can amplify. I can limit the FM62429 by code, for example, to 60% and only use it to lower the volume, although I don't think it is a very elegant solution.
Audio Line In -> 22kΩ resistors -> X9C503 -> MSGEQ7
Audio Line In -> 22kΩ resistors -> FM62429 -> MSGEQ7
Any ideas or suggestions?
Code: Select all
#include "X9C10X.h"
#define CSPIN 33
#define INCPIN 14
#define UDPIN 27
X9C503 pot;
void setup() {
Serial.begin(9600);
pot.begin(INCPIN, UDPIN, CSPIN); // pulse, direction, select
Serial.println("Introduce un valor entre 1 y 99");
}
void loop() {
if(Serial.available() != 0){
int value = Serial.parseInt();
if (value != 0) {
pot.setPosition(value, true);
delay(30);
Serial.print("Valor introducido: ");
Serial.println(value);
}
}
delay(100);
}