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 2175 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…
Parents
  • 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
Reply
  • 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
Children
  • 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
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