Digital Potentiometer Control Using Arduino - X9C103

Sdílet
Vložit
  • čas přidán 18. 09. 2018
  • The X9C series of digital potentiometers feature a simple 3 wire control interface, provide 100 steps of wiper adjustment, and can optionally save the wiper position for automatic recall of the setting after power on.
    Here's an Arduino Uno sketch showing how easy it is to control and use the X9C family of digital pots.
    This is a follow up to two previous videos:
    Digital Potentiometer Control Basics - X9C103
    • Digital Potentiometer ...
    Digital Potentiometer and Rotary Encoder Direct Control X9C103
    • Digital Potentiometer ...
    Sketch: github.com/GadgetReboot/Ardui...
    Original Library:
    github.com/philbowles/Arduino...
    Workbench equipment I regularly use:
    946C Solder Hot Plate 200mm x 200mm www.banggood.com/custlink/K3D...
    ANENG AN8008 True RMS Multimeter www.banggood.com/custlink/KKD...
    Minleaf NPS3010W Power Supply www.banggood.com/custlink/KKK...
    FY6900 Dual Channel 60MHZ Signal Generator www.banggood.com/custlink/vGK...
    Siglent SDS1104X-E 100Mhz Digital Oscilloscope 4 Channels Standard decoder
    Amazon.com: amzn.to/36fH1ui
    Amazon.ca: amzn.to/36fNWUc
    (These are affiliate links. I may earn a commission if you shop through the links, it supports the channel and doesn't cost you extra)
    Support me on Patreon: / gadgetreboot
    #ElectronicsCreators
  • Věda a technologie

Komentáře • 62

  • @WilliamDeboer
    @WilliamDeboer Před 5 lety +3

    Just started looking at these online. Thanks for the explanation

  • @AlexMandrakemaker
    @AlexMandrakemaker Před 5 lety +4

    The explanation is good, clear, understand and comfortable this is = 1 subscriber more

  • @LandMineFX
    @LandMineFX Před 9 měsíci +1

    I've been building guitar pedals, and I think you just opened up a whole new world for me

    • @GadgetReboot
      @GadgetReboot  Před 9 měsíci +1

      i’m about to do a video on a different digital pot because I think these are more obsolete right now so maybe that will be of interest as well in the next couple of weeks.

    • @LandMineFX
      @LandMineFX Před 9 měsíci +1

      Is it the MCP41010? I ordered just one of those on my last parts order, but then lost it @@GadgetReboot 😆

    • @GadgetReboot
      @GadgetReboot  Před 9 měsíci +2

      it’s the MCP 42100 so it’s a dual 100 K version. I have to set up some experimental circuits for it but the video should be out within a week.

  • @eugy2008
    @eugy2008 Před 3 lety +1

    Thank you! Very clear presentation. I am thinking of using this on a solar charger.

    • @petermccool9396
      @petermccool9396 Před 2 lety

      How did that go? I'm here due to the same requirements. I'm thinking to replace the V&I pots on an off the shelf DC-DC buck converter with these XDCPs.

  • @markusmitph8987
    @markusmitph8987 Před 4 měsíci +1

    Thank you for the video and the detailed explanation :)

  • @anshbhatnagar557
    @anshbhatnagar557 Před 4 lety +1

    Thank I found issue in my circuit the value is storing in the nvram it just the issue of recalling and by the way I have change the 2 function you mention once again thank for helping

  • @rothenbergt
    @rothenbergt Před 3 lety +1

    Fun video thanks for sharing

  • @user-cm6sj7uf5i
    @user-cm6sj7uf5i Před 2 lety

    thanks for the explanation. do you have the wiring diagramm for this test in order to undrestand better the functions?thanks in advance

  • @electronic7979
    @electronic7979 Před 5 lety

    Useful video

  • @samuelebasso
    @samuelebasso Před 3 lety +1

    Hi, nice video. I'm looking to use Arduino to transform a 800-1000 ohm potentiometer that I can't change into a 0-190 ohm variable resistance. It's possible in this way? Thank you

  • @ryzenryne8747
    @ryzenryne8747 Před 2 lety +1

    How do you make the digital potentiometer go to it's zero position (middle) quickly?

  • @landyandy
    @landyandy Před 4 lety +1

    Really a well done explanation. I wanted to know if this digital potentiometer can be applied as a continuous variable resistance. In a circuit based on a Hall sensor that makes me vary the resistance according to the magnetic flux. The magnetic flux varies tens of times per second and the resistance should vary in the same way. Bye

    • @GadgetReboot
      @GadgetReboot  Před 4 lety

      From the data sheet AC operation characteristics table on page 5 www.renesas.com/in/en/www/doc/datasheet/x9c102-103-104-503.pdf , where it shows the timing of the control signals and the response of the wiper, it looks like the wiper will change within 100 µs per step each time it is incremented so that could be considered fast for several times a second moving the full scale 100 steps if you have to go between minimum and maximum resistance continuously. And it is just switching in the different resistors electrically so it should be suitable for continuous operation.
      There is one note I saw in the data sheet that may need consideration, while changing the wiper, there may be a temporary change in resistance rather than just going to the next increment based on the way it works so the application may need to consider that and testing should be done.
      “The electronic switches on the device operate in a “make-before-break” mode when the wiper changes tap positions. If the wiper is moved several positions, multiple taps are connected to the wiper for tIW (INC to VW/RW change). The RTOTAL value for the device can temporarily be reduced by a significant amount if the wiper is moved several positions.”

  • @dcsymbols4450
    @dcsymbols4450 Před rokem +1

    How would you incorporate this into a joystick instead of buttons?.

  • @steffan9415
    @steffan9415 Před 5 lety

    Can I use it on AC loads?

  • @leblancexplores
    @leblancexplores Před 2 lety

    I am looking at using this XC9 in combination with a PWM fan controller (ultimately a 555 timer and some transistors) to control a 60W fan. If I want to be able to turn the fan off should I also consider a relay as well or would setting the resistance to it's highest (or maybe lowest?) be sufficient to ultimately get me a 0% duty cycle?

    • @GadgetReboot
      @GadgetReboot  Před 2 lety

      it would definitely be good to have a relay or some thing to do a complete shut off, I know the 555 cannot achieve 100% or 0% duty, or possibly both. So when you try to make it go completely flat either high or low, you might still get the little blip momentarily.

  • @jln5352
    @jln5352 Před 2 lety

    I need to put Vh=15V and Vl=13.75V. Any idea how to do that?

  • @jonnymartin8414
    @jonnymartin8414 Před 3 lety

    Does the chip itself store the last value without the arduino?
    The datasheet says "Wiper Position Stored in Nonvolatile Memory and Recalled on Power-Up"
    So does the arduino quickly turn the pot to one side and then turn it to the arduino memory on powerup?

    • @GadgetReboot
      @GadgetReboot  Před 3 lety

      the chip itself stores the position if requested by the control lines from arduino at some point, so when powered back on the chip itself moves the wiper where stored. I think it always starts at one end of the range and then moves to the setting.

  • @angelcuba733
    @angelcuba733 Před 4 lety

    Do you have the circuit diagram?

  • @bijoyendrasharma4781
    @bijoyendrasharma4781 Před 5 lety

    I am having a problem with my digital pot, I cant figure out how to increase or decrease the resistance through the micro controller

    • @GadgetReboot
      @GadgetReboot  Před 5 lety +1

      Using Arduino or another platform? This video looks at the pot more generally for learning to use it: czcams.com/video/U3K-PXcv7Uo/video.html

  • @wackerburg
    @wackerburg Před 3 lety

    Are these digital resistors also available with a higher resolution aka more steps? Like 10 or 12 bits? Great video!!! :-) Thank you.

    • @GadgetReboot
      @GadgetReboot  Před 3 lety +1

      I've seen them with as many as 1024 steps like this one www.analog.com/media/en/technical-documentation/data-sheets/AD5174.pdf
      but of course all the features and limitations of each different digital pot need to be looked at to see if it fits the application. They're more like a specialized part where trade offs would need to be decided between number of steps vs voltage handling, or control interface method, ability to store wiper at power down etc

  • @timwzk1139
    @timwzk1139 Před 4 lety +1

    I'm so daft, looking at the screenshot of the data sheet in the vid, can I use the x9c and an Arduino to ”translate” one potentiometer to different values on the fly? Say, to turn my B25k expression pedal into a 100k?

    • @GadgetReboot
      @GadgetReboot  Před 4 lety +1

      as long as the voltage swing doesn’t exceed +/-5 V on the pot and the current through the wiper of the pot doesn’t exceed 4.4 mA, this digital pot can be used in a circuit where a regular pot is used. that assumes any nuances of the digital pot behaviour can be accepted in the circuit like while powering on, letting the wiper settle to a certain position, or while moving the wiper, momentary resistances may vary from the expected final wiper position so in an audio circuit volume or some other effect may temporarily be fluctuating depending how it’s all used. so experimenting would be needed to see if it’s even suitable for the application.
      if it is, if I want to use an Arduino to switch this pot in and out of circuit either in parallel or series with an existing pot, or to disconnect another physical pot and connect this one in on its own, I would probably use a digitally controlled switch like the CD4066. this has four built-in switches so I could use it to switch various terminals of multiple pots in and out of circuit as needed. Arduino would be controlling each switch with a single pin to open or close that switch.
      I did something similar using digital pots to control frequency of Tone generators and output volume of an audio circuit and used those digital switches to connect various features in and out from Arduino.
      czcams.com/video/oFtGOOA25tA/video.html

    • @timwzk1139
      @timwzk1139 Před 4 lety

      @@GadgetReboot Thanks for the detailed (and prompt) reply! I've been looking into ways to avoid having three different expression pedals to control non-midi capable guitar pedals that have expression inputs; B10k/B25k/B100k without necessarily having three seperate expression pedals. Already have an Arduino, and a passive trs 25K expression pedal. Wouldn't need to be all outputs at once, but that's a bonus. The devices typically take 9V DC inputs are typically 9V DC, but some claim to operate internally at 24V. If I understood correctly, I'm glad you reminded me to be mindful that these external devices would possibly/likely pass more than five volts through the chip. Thanks again.

  • @francochiesadocampo3205

    Where do you sense the output voltage resulting from the X9C?

  • @neothehackerV2
    @neothehackerV2 Před rokem

    I'd like to emulate a temperature sensor. Basically the Arduino pulls the temp from the internet and "codes" it to the wire w/the according resistance. The device that is supposed to have a temp sensor would show the temperature. Something like this possible?

    • @GadgetReboot
      @GadgetReboot  Před rokem

      it sounds possible but it’s a bunch of separate projects like one to go get the temperature from the Internet, then if you are saying you want to convert that temperature into a physical resistance value to emulate a sensor, does that mean the real sensor actually produces a certain resistance that varies with temperature?
      If so then as long as you have a digital pot that the resistance can be adjusted within the temperature range to match, you would just have a project that takes that temperature number and uses it to control the pot and so on but it’s all just vague concepts, like saying it’s possible to take an audio signal and put it through a circuit to boost the bass and cut the trouble. Lots of ways to do it.

  • @anshbhatnagar557
    @anshbhatnagar557 Před 4 lety

    Hi I try the same with the button I succeed in varying the resistance or voltage but not able to save thevalue I keep cs high while Inc signal is high so can you help me in this

    • @GadgetReboot
      @GadgetReboot  Před 4 lety

      One thing I recall is I found some issues in the X9C library I used, so I had to change two functions in the library code. I made a comment at the top of my sketches here github.com/GadgetReboot/Arduino/blob/master/Uno/X9C_Button_Test/X9C_Button_Test.ino
      and it looks like Deselect And Save is one of them, so I wonder if all you need to do is tweak the library like I had to. I forget exactly how I did it and if I talked about it in the video.
      Here's the info from one of the sketches, so if you find the X9C.cpp file in the library, you can search for these 2 functions and replace them with this code:
      Changes required to the original X9C.cpp file from the above GitHub
      library (as of Last commit Jun 8 2017)
      The following 2 functions should be replaced with this code:
      void X9C::_deselectAndSave(){
      digitalWrite(_inc,LOW); //***********GADGET REBOOT CHANGED******************
      delayMicroseconds(1); //***********GADGET REBOOT CHANGED******************
      digitalWrite(_inc,HIGH); //***********GADGET REBOOT CHANGED******************
      delayMicroseconds(1); //***********GADGET REBOOT CHANGED******************
      digitalWrite(_cs,HIGH); // unselect chip and write current value to NVRAM
      }
      void X9C::_stepPot(uint8_t amt,uint8_t dir){
      uint8_t cnt=(amt > X9C_MAX) ? X9C_MAX:amt-1; //***********GADGET REBOOT CHANGED******************
      digitalWrite(_ud,dir); // set direction
      digitalWrite(_cs,LOW); // select chip
      delayMicroseconds(1);
      while(cnt--){
      digitalWrite(_inc,LOW); // falling pulse triggers wiper change (xN = cnt)
      delayMicroseconds(1);
      digitalWrite(_inc,HIGH);
      delayMicroseconds(1);
      }
      delayMicroseconds(100); // let new value settle; (datasheet P7 tIW)
      }

  • @browaruspierogus2182
    @browaruspierogus2182 Před 5 lety

    What exactly is the difference between digital pot and voltage regulator? Aren't they almost the same?
    What exactly this can be used for?

    • @GadgetReboot
      @GadgetReboot  Před 5 lety

      I suppose a variable resistor like this could be used as a voltage reference but it won’t be able to deliver significant current to power something else. In order to maintain a regulated voltage and provide a certain load current, a voltage regulator is needed. If you use a pot as a voltage divider you will get a certain voltage out of the wiper but it’s only meant for measuring rather than powering circuits.
      The most obvious example usage for this would be a volume control where the audio input signal goes to one end of the pot, ground is on the other end of the pot, and the wiper is the output which goes into another audio section or a speaker. As the wiper is moved toward the ground the volume goes down because you have more ground than audio signal coming out of the wiper. As the wiper is moved toward the audio input, you get closer to having a direct short through the pot which is full volume.

  • @suhailanjumabdurraheemsayy7639

    Nice explanation sir. Can we use this pot to carry out IV measurements of solar cells? Please do reply.

    • @GadgetReboot
      @GadgetReboot  Před 4 lety +1

      It’s probably not practical because at least for this specific device there is a maximum voltage of 5 V and the maximum current through the wiper can only be just over 4 mA so if the voltage or current being presented to this part is going to be higher than that, it won’t work.
      If this part is not being used directly as a load and is just used for some other function that’s within those voltage and current ratings then that’s OK.

    • @suhailanjumabdurraheemsayy7639
      @suhailanjumabdurraheemsayy7639 Před 4 lety

      @@GadgetReboot Thank you sir. Can you please suggest a digital pot for IV measurements of a small solar cell having voltage below 5v and current below 500 mA?

    • @GadgetReboot
      @GadgetReboot  Před 4 lety

      I don’t know if a digital pot can directly handle that much current, I didn’t research fully but one I found is 25 mA like this one.
      www.mouser.ca/new/microchip/microchip-mcp41hvx1-potentiometers/
      And maybe there’s limitations like it can only do 25 mA for short duration not continuous and things like that.
      There may be some other kind of circuits that can be added on to buffer the potentiometer though, so the potentiometer can be part of a low current circuit controlling a higher current path in some way that the desired result is still achievable.
      Maybe some sort of thing where the digital pot is connected to an op amp so that the digital pot changes the voltage control of the op amp and that controls a fet on the output like a variable resistor DC load so the solar cell would have a fet providing a load current safely controlled digitally by the digital pot.
      But at that point just a straightforward digital to analog converter chip can do the same thing so it comes down to the reason for using a digital pot in the first place.

  • @redlightdrive5432
    @redlightdrive5432 Před 2 lety

    X9c103p is 10k, at sao it display 100k?

  • @dwalden74
    @dwalden74 Před 4 lety +1

    A mechanical pot 100K can handle higher voltages. The x9c- series only supports 5v. How would I control a 20v or 30v circuit with a digital potentiometer and arduino?

    • @GadgetReboot
      @GadgetReboot  Před 4 lety +1

      without doing the math to double check, I wonder if the digital pot can handle the normal resistor divider of a buck or boost voltage regulator to set the output voltage, maybe with other resistors as part of the network and not just the digital pot alone.
      or maybe the digital pot could be used safely in conjunction with an op amp circuit and the output of the op amp ties in to the voltage regulator so instead of using a variable resistance to set the voltage we are directly setting the voltage with an op amp. Something along those lines.
      I’m sure there’s lots of Circuit ideas like that in all the app notes of all the silicon vendors where something could be put together.

    • @petermccool9396
      @petermccool9396 Před 2 lety

      @@GadgetReboot Did you ever dig deeper into that? I've got an off the shelf dc-dc converter coming for experimentation.

  • @brandontroppens6326
    @brandontroppens6326 Před 3 lety

    Does the digital pot hold its previous value when power is off?

    • @GadgetReboot
      @GadgetReboot  Před 3 lety

      If the software procedure is followed to store it, yes. It re-loads the last stored value on power up but the wiper isn't immediately there, it has to move there during configuration so resistance will vary while it gets set up.

  • @kjur18
    @kjur18 Před 5 lety

    I have been wondering for some time now, why you have a piece of blue tape on that dmm?

    • @GadgetReboot
      @GadgetReboot  Před 5 lety

      It’s a conversation starter! The question came up in another video once upon a time. It’s there to cover a crack and a gouge in the plastic that kept spreading and one day I will get around to trying to fix it more permanently.

    • @kjur18
      @kjur18 Před 5 lety +1

      It seems that it performs well. As a conversation starter, I mean. It made me remember some stock photos where they remove brand names from dmm's in their photos, sometime they wipe it out in software, some other time they use a piece of tape:-)

    • @GadgetReboot
      @GadgetReboot  Před 5 lety

      I should share screen time with my other Fluke meter which I’ve owned about 10 years longer than this one. I just never think of it because the probes used to be broken but now I have eBay replacements. Someday I will need to measure voltage and current at the same time and then I’ll get it all going.

  • @syaduinotech3681
    @syaduinotech3681 Před 3 lety

    Thanks for the idea and explaination. I am new, and would like to ask, if we use the map function in arduino, what will happen sir? Any idea

    • @GadgetReboot
      @GadgetReboot  Před 3 lety

      In general or in something to do with the video (I can't remember what's in the video)? It maps one range of numbers to be within a different range, so it can take 0 to 10 and stretch it out to 70 to 500 if wanted, so 0 maps to 70 and 10 maps to 500 and everything in between is scaled.

    • @syaduinotech3681
      @syaduinotech3681 Před 3 lety

      @@GadgetReboot tq sir..

  • @bartdepauw1156
    @bartdepauw1156 Před měsícem

    Is it possible to use 2 of these in series, to have 200 steps ? Did someone tried this already ?

    • @GadgetReboot
      @GadgetReboot  Před měsícem

      I haven’t tried it but I think it makes sense if you’re only using the wiper and one terminal of each pot so you’re using it like a rheostat and then you put two of those in series where the wiper of 1 feeds in to the one end terminal of the second one, then you should be able to control the two sections to go from minimum resistance up to the value of two resistors in series.

  • @shokdj1
    @shokdj1 Před rokem

    I’ve not used an arduino yet I feel like this is going to be a long project I want to do :sigh: