element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum X9C503 works with ESP32?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 17 replies
  • Answers 1 answer
  • Subscribers 385 subscribers
  • Views 2168 views
  • Users 0 members are here
Related

X9C503 works with ESP32?

Ricodora
Ricodora over 1 year ago

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?

[code]#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);
}[/code]
  • Sign in to reply
  • Cancel

Top Replies

  • michaelkellett
    michaelkellett over 1 year ago in reply to Ricodora +1
    Try adding resistors from the emitters of each of the 2 transistors to ground. There is nothing in your circuit to pull them down to 0V when the bases are pulled low except leakage current. If the…
  • michaelkellett
    michaelkellett over 1 year ago in reply to michaelkellett +1
    There is actually no need for the transistors at all, I would connect the control pins to the processor via a 10k resistor. MK
  • Ricodora
    Ricodora over 1 year ago in reply to michaelkellett +1 suggested
    I said the 4k7 resistor didn't work when I first assembled it wrong. Now that you've pointed out my mistake......IT HAS WORKED!!! What a great relief! mk you got it right, now if I enter the same value…
  • shabaz
    0 shabaz over 1 year ago

    You've written a lot there. Long story short:

    You're using a digital potentiometer with up/down and increment pins. You're using some Arduino library called XC910X that accepts a value between 0 and 99 and it works with Arduino Mega, but with ESP32, sometimes the volume goes up or down if you repeatedly try to set the same level.

    First question for you: where did you buy the digital potentiometer from? If from ebay/aliexpress, it may be some alternative part (marked incorrectly) that might not operate well with ESP32 logic levels.

    If it doesn't work on ESP32, there's a fair chance the connections are not good (try swapping out the jumper cables, or try using a different breadboard for instance, or try three different pins).
    Alternatively, you could simplify, and directly control the digital potentiometer by configuring the GPIO pins yourself, and not using the library code, if it's not working for you. It's not a lot of effort since there are only three pins (CS, U/D and INCREMENT). You could put in delays, and observe with LEDs (if you don't have an oscilloscope) to see that the pins are functioning correctly. If that doesn't work, then I suspect you may not have the chip you think you have, and it could be a voltage level issue.

    A detailed photo of your setup will also help. Also a detailed photo of the digital potentiometer IC, if it was purchased from AliExpress or eBay.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Ricodora
    0 Ricodora over 1 year ago

    image

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Ricodora
    0 Ricodora over 1 year ago in reply to shabaz

    Hello shabaz, thanks for participating.

    1) Yes, Aliexpress. But... If I buy an original IC will it work well with the logic levels of Arduino Mega and also ESP32?

    Good advice that I had not done yet: change all the cables, change the board, change the diodes and change the ESP32 pins.

    Unfortunately the problem was not resolved. I have 4 units of X9C503 and they all work the same.

    I've also tried using the component without a library...sometimes it does it right and other times it does it wrong. Code example:

    <code>

    void doDecrement() {
    digitalWrite(up_down, LOW);
    delay(10);
    digitalWrite(select, LOW); //se activa el cambio de R
    delay(10);
    digitalWrite(increment, HIGH);
    delay(100);
    digitalWrite(increment, LOW);
    digitalWrite(select, HIGH); //se desactiva el cambio de R
    }

    </code>

    Arduino mega gives 4.93v and ESP32 4.55v. I have tried using a constant 5v external power supply, with the supply powering the ESP and the rest of the circuit (I am not getting the voltage from the ESP). Continue to fail.

    With the knowledge I have this is a mystery to me. I use other ICs in the project that run at 5v and work fine using the '2N3904'

    Do you think that by purchasing an original component the problem will disappear? I can't find examples on Google of using ESP32 with X9C503

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 1 year ago in reply to Ricodora

    Try adding resistors from the emitters of each of the 2 transistors to ground.

    There is nothing in your circuit to pull them down to 0V when the bases are pulled low except leakage current.

    If the slew rate (speed at which the voltage on the pins changes) of the ESP and Arduino are different this might account for why one works an the other does not.

    4k7 would be a suitable value.

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 1 year ago in reply to michaelkellett

    There is actually no need for the transistors at all, I would connect the control pins to the processor via a 10k resistor.

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 1 year ago in reply to Ricodora

    The Arduino Mega uses 5V logic levels, whereas the ESP32 uses 3.3V levels, so there's a chance that the digital potentiometer isn't functioning with 3.3V levels. Did you remove the transistors when it was working with the Arduino Mega?

    If it's a genuine X9C503 then 3.3V logic levels ought to work. However the X9C503 in the photo doesn't look normal (the left side looks like it has chipped just below the top corner). It's normal for a lot of AliExpress chips to be fakes (with a sanded surface, remarked) so the chances of getting a genuine X9C503 from there might be low. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Ricodora
    0 Ricodora over 1 year ago in reply to michaelkellett

    Hi MK, thanks for your time.

    I have done the test that you propose. I upload a new image to verify that what I have done is correct. I am a programmer and I have no knowledge of electronics, although I have already designed my first PCB and little by little I am learning.

    X9C503 with ESP32 without transistors does not work, does nothing. In Arduino Mega I don't use transistors.

    If the problem is the response speed... ... ... ... I don't know what tests to do. I'm going to read up on the subject to see if I can think of any "non-random" test.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Ricodora
    0 Ricodora over 1 year ago in reply to shabaz

    In Arduino Mega I don't use transistors. And in ESP32 I have to use transistors for it to work (without transistors it does nothing)

    I have always thought that it works at 5V, but... and if so... Why doesn't it work with transistors? I don't have much experience but for the rest of the ICs that work at 5V I use them with transistors and they work.

    It's from AliExpress, I think it won't be original, but another thing is that it doesn't work. In fact it works on Mega.

    Because of your words I am going to buy right now in an electronics store. This IC is causing too many problems.

    Right now I'm going to buy in an electronics store in my country, but for the future... is there a global, reliable and economical store for electronics?

    Now I have new doubts and fears. I have bought many components on AliExpress such as resistors, cables, ceramic and electrolytic transistors, diodes, manual potentiometers... are these basic components reliable or should I also buy them in an electronics store?

    For example, the transistors I am using are extremely cheap, I know they are not original, but they are doing their job well.

    In my project I use few ICs:

    X9C503 -> Works with Mega but not with ESP32
    M62429 -> Works on ESP32
    MSGEQ7 -> Can't buy on AliExpress, never works.
    74HC4051N -> Works with ESP32

    Right now in the AliExpress shopping cart I have 74HC4051N x 100 = less than 9 euros. Should I buy them? Am I making a rookie mistake? To save money, should I use those AliExpress components that work for me?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 1 year ago in reply to Ricodora

    You have connected the resistors to the collectors of the transistors and to ground - this will do nothing at all except slightly warm the resistors.

    They must be connected to the emitters of the transistors, so that there is a path for current to ground to pull the X9C503 control pins to 0V when they are meant to be at a low logic level.

    What test gear do you have available ?

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Ricodora
    0 Ricodora over 1 year ago in reply to Ricodora

    After doing the test the behavior is the same, if I enter the same value I do not always get the same output. Apparently nothing has changed

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube