Digital Potentiometer (X9C103S) Introduction and Demo with Arduino

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ค. 2024
  • Introduction of X9C103S digital potentiometer.
    Explain the structure and operation of X9C103S, and how to control the resistance of this digital potentiometer.
    Also shown in this video, is a demo of X9C103S controlled by Arduino nano, swiping up and down the wiper, and storing the current wiper position.
    A useful tip (or a bug?) while storing the wiper position is also revealed!!
    Demo codes and configuration can be downloaded from following link:
    drive.google.com/drive/folder...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 118

  • @manumohan5017
    @manumohan5017 2 ปีที่แล้ว +3

    Was helpful for me interfacing X9C103S 👍

  • @user-zt9us6ny3x
    @user-zt9us6ny3x 3 ปีที่แล้ว +1

    Very informative video. Thank you very much! Now I know about this one additional tap point at start up.

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว

      Your comments are greatly appreciated.
      More useful videos are to come!
      Thank you!

  • @Toschomacher
    @Toschomacher ปีที่แล้ว +1

    Thank you very much for this video and the comprehensive information about this digital potentiometer. In my project, I will use it to replace a mechanical potentiometer that controls the speed of a 12V DC blower motor (it's a car heating blower motor) with a digital potentiometer X9C104 that will be automatically adjusted from an Arduino Uno. This video helped me a lot providing all the necessary information that I needed and saved me from searching different sources of information and data to do the task.

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +1

      I am very glad this video helped!
      Your comment is really encouraging me to go on!
      Thank you for watching!!

  • @lamboking8able
    @lamboking8able 2 หลายเดือนก่อน +1

    Thank you this is exactly what I'm looking for for my next project!!

    • @gemsungelectronics460
      @gemsungelectronics460  2 หลายเดือนก่อน +1

      Thank you for watching!!
      Hope you succeed with your project!!

  • @sameerk12982
    @sameerk12982 2 ปีที่แล้ว +1

    Hello from India...Thank you very much for this easy to understand and very helpful video.... Looking forward for more electronics and arduino videos...subscribed.

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +2

      Thank you very much!
      Your comment is greatly appreciated!
      More exciting and useful videos are getting ready.
      Thanks.

  • @JoaoCarlos-gl7tb
    @JoaoCarlos-gl7tb 3 ปีที่แล้ว +2

    very good. congratulations.

  • @HouseofCustomNz
    @HouseofCustomNz 2 หลายเดือนก่อน +1

    Thank you this was very helpful

  • @smartlearn9028
    @smartlearn9028 3 ปีที่แล้ว +1

    Dear sir
    Extremely thankful to you sir for this nice information about potentiometer..i was in search of this for a pretty long time.I m now hopeful that I may built volume control for a radio with your guidance using RF.remote controller.
    Once again thank you very much sir
    Regards

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +1

      I am very glad it helped!
      If you have any questions or comments don't hesitate to ask.
      Thanks

    • @smartlearn9028
      @smartlearn9028 3 ปีที่แล้ว

      @@gemsungelectronics460
      Dear sir i want to use the pot to control volume of my radio receiver set.kindly help in setting the connections for speaker
      Regards

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว

      You need to first define on what criteria you would control the volume with.
      After that you can use the sample code I linked in one of the comments above to control the volume if it requires potentiometer control.
      Here is the example code.
      drive.google.com/drive/u/0/folders/1YxCH3byESSoGbQtQ7U2HApApApZmV-oW
      Thanks

  • @janakawijesinha
    @janakawijesinha ปีที่แล้ว

    super explained 👌

  • @ShopperPlug
    @ShopperPlug 3 ปีที่แล้ว +1

    Good explanation

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +2

      Thank you!
      Please let me know if you have any requests or comments!

    • @ShopperPlug
      @ShopperPlug 3 ปีที่แล้ว +1

      @@gemsungelectronics460 can I use this digital potentiometer for controlling a Triac? Because many Triac schematics shows it uses a potentiometer, I was wondering if it was possible to use a digital potentiometer instead.

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +2

      Hello.
      If you are intending to use the potentiometer as a dimming control, you should consider the followings.
      - Voltage : X9C103 is capable of handling +/-8V at most. So, for AC application using a triac, you should make sure the voltage doesn't exceed 8V. Using a transformer would be a good idea.
      - Current : Maximum wiper current is 1mA, so you should limit the current flowing through this pot to max. 1mA. Using extra resistors and limiting the value of the wiper position would be considerable.
      Thank you.

  • @georgesoare7937
    @georgesoare7937 ปีที่แล้ว

    Hy, i have a question, can you tell me how can i connect a loudspeaker digital volume control to a hall sensor (from finger throttle's ebike ) in order to be able to control volume. Thank you in advance for your answer

  • @alecroadarmel7451
    @alecroadarmel7451 6 หลายเดือนก่อน +1

    This that good stuff.

  • @ianuragaggarwal
    @ianuragaggarwal 7 หลายเดือนก่อน +1

    Very interesting

  • @BertGrink
    @BertGrink 11 หลายเดือนก่อน

    Subbed and upped.

  • @armincal9834
    @armincal9834 2 ปีที่แล้ว +1

    Are these used to increase and decrease sound volume in phones? I always wondered how the resistance of a circuit can be changed programmatically such as in Windows and android

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      Hello, thank you for watching!
      I believe that the volume control is integrated in an IC, but the principle should be the same.
      Thanks!

  • @sumankar4873
    @sumankar4873 8 หลายเดือนก่อน +3

    Please tell us can we supply 0 to 5V by this with Arduino programming

    • @gemsungelectronics460
      @gemsungelectronics460  8 หลายเดือนก่อน +1

      Yes, you can control the wiper value of this potentiometer with Arduino from 0V to 5V.
      Thank you for watching!!

    • @sumankar4873
      @sumankar4873 8 หลายเดือนก่อน

      Can we expect drawing voltage from 0 to 5V with it directly with nano

    • @gemsungelectronics460
      @gemsungelectronics460  8 หลายเดือนก่อน

      @sumankar4873
      Do you mean whether we can power the potentiometer with Arduino nano?
      Then yes, you can power the potentiometer with 5V coming from the Arduino nano.

  • @Tacticalgamer2011
    @Tacticalgamer2011 3 ปีที่แล้ว +1

    Thanks for this video. I'm not good at reading the datasheet. Do you know what the maximum current and voltage through the resistor of this circuit are?

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +2

      Hello,
      Can you give me more specifics of what circuit you are referring to?

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +2

      If you are referring to this potentiometer itself, the voltage and current depends on followings.
      - the wiper position of this potentiometer : R
      - the voltage applied to this potentiometer from the external circuitry : V
      With these conditions, you can apply Ohm's law to find the current I = V/R

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +2

      For the limits that this device can be operated, you should look at the Absolute Maximum Ratings, and the Recommended Operating Conditions of the datasheet.
      Some limits listed in the datasheet of X9C103 are,
      1. Voltage on CS, INC, U/D and VCC pins should not exceed -1~7V with respect to VSS, or GND pin.
      2. Voltage on VH and VL should not exceed -8~+8V with respect of VSS.
      The voltage difference between VH and VL should not exceed 10V for X9C103.
      3. The current applied to the wiper pin should not exceed 1mA.

    • @Tacticalgamer2011
      @Tacticalgamer2011 3 ปีที่แล้ว +1

      @@gemsungelectronics460 I see... Thanks

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +1

      You're welcome! If you have any more questions, please let me know.

  • @rizkydwiwisesa7350
    @rizkydwiwisesa7350 9 หลายเดือนก่อน +2

    Hi sir, can i ask? I want use digital potensiometer without using button. If it possible? Using only command in arduino? And how to program without button

    • @gemsungelectronics460
      @gemsungelectronics460  9 หลายเดือนก่อน +3

      Hi, the button in the video was just used for demonstration purposes. So yes, you can definitely get rid of the button and program it in the Arduino.
      Programming the Arduino is dependent on what you are going to build.
      For example, you can read data from the sensor for adjusting the potentiometer.
      The sensor can be replaced with ADC or any kind of device that can provide feedback from the adjustment.
      Thank you!!

  • @brucepsyduck792
    @brucepsyduck792 2 ปีที่แล้ว +1

    Hi, in INC and U/D only works if we use 0 and 1 (high/low) ? or we can use anything value in the scale of 0 to 255(pwm)?

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +3

      The X9C103S only has U/D, INC and CS for controlling the wiper position. It cannot be programmed by using a PWM signal.
      Thank you!

  • @rebintalite619
    @rebintalite619 10 หลายเดือนก่อน +1

    good day😊 can I use it to replace the analog potentiometer of a LED lamp dimmer and control the digital potentiometer by Arduino uno?

    • @gemsungelectronics460
      @gemsungelectronics460  10 หลายเดือนก่อน +1

      Yes, if the value is the same, the digital potentiometer can be used in place of the analog part.
      Thank you for watching!

  • @karartikararti3588
    @karartikararti3588 ปีที่แล้ว +1

    Hi sir, do we need to combine the two codes that you have added to your drive? And can I use these codes to connect it to an Rc controller? My goal is to change the voltage value remotely via an Rc controller.

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +2

      Hi, you might only need the code "digital_pot_control.ino" only.
      This one is the code used for the demo in this video, and it is free of use!
      A potentiometer is used for voltage control, so I think it is possible to use in your application.
      You need to make sure the specification (voltage range, resistance step) matches your requirement.
      The voltage range of this module is +/-5V, so it should not exceed this range.
      Thank you for watching!

    • @karartikararti3588
      @karartikararti3588 ปีที่แล้ว +1

      @@gemsungelectronics460 thank you sir! 😊

  • @aravindpadmasali6532
    @aravindpadmasali6532 3 ปีที่แล้ว +2

    Dear sir,
    can we use this as a volume control for audio amplifier, please share the wiring diagram of how to connect volume up and down switches

    • @gemsungelectronics460
      @gemsungelectronics460  3 ปีที่แล้ว +2

      Hello!
      Thank you for your comment!
      You can control the volume with a digital potentiometer and an OP-AMP.
      For circuitry examples, I found the following site very helpful.
      www.maximintegrated.com/en/design/technical-documents/tutorials/1/1828.html
      Thanks!

    • @aravindpadmasali6532
      @aravindpadmasali6532 3 ปีที่แล้ว +1

      @@gemsungelectronics460 thank you sir

    • @BertGrink
      @BertGrink 11 หลายเดือนก่อน +1

      @@gemsungelectronics460 Those are some neat examples, thank you for the link.

    • @gemsungelectronics460
      @gemsungelectronics460  11 หลายเดือนก่อน +1

      Thank you for your comment!

  • @junaidarshad1617
    @junaidarshad1617 ปีที่แล้ว +1

    Hello, can I use it to vary the feedback resistance of an operational amplifier to vary the gain?

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +2

      Hi, it can be used as a feedback for the voltage amplifier, but the current should be limited to 3mA max.
      Thank you for watching!

    • @junaidarshad1617
      @junaidarshad1617 ปีที่แล้ว +1

      @@gemsungelectronics460 thanks a lot. :)

  • @jsmythib
    @jsmythib 2 ปีที่แล้ว +1

    Artificial lifeforms will need smart resistors. Keep everything tuned up properly :)

  • @typingcat
    @typingcat 2 ปีที่แล้ว +3

    So..., why is the restored value 100 higher than the stored value, is it some sort of bug?

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +3

      Great question!
      Just after getting your comment, I performed the test again to make sure the wiper position doesn't change during the power on/off sequence.
      The power sequence was ok, and every store operation with a power recycling resulted in an increase of 100 ohm!
      I will try asking the vendor about this symptom and get back to you if I get some meaningful answers.
      Thank you for watching!

    • @peterlingas
      @peterlingas 2 ปีที่แล้ว +1

      @@gemsungelectronics460 did you get a response?

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      Sorry, I couldn't make the contact yet. I will update the result when I get one. I am considering to purchase an IC itself, for comparison.
      Thank you for your comment.

  • @raifhanna131
    @raifhanna131 2 ปีที่แล้ว +1

    can I change stepper motor speed using digital potentiometer THROUGH pulses generated from CNC axis pulses(let say Z AXIS PULSES)?????in another word i am requiring z axis height to control stepper motor speed proportionally

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      So, you are getting the pulses from the cnc as an input, and you want to control the stepper motor speed with a potentiometer? What are the pulses you are getting from the cnc? Is it some kind of a pwm pulses? Is so, you can use rc filter to convert the pulse to a voltage level that can be read through an ADC. Controlling the stepper motor speed with a potentiometer is definitely possible.

  • @TusharGS007
    @TusharGS007 11 หลายเดือนก่อน +1

    Is it possible for me to replace this potentiometer in "LM2596HVS DC-DC Buck Converter 4.5-50V to 3-40V Adjustable Step Down Power Module" with the X9C103S for me to control the output voltage of the buck converter?

    • @gemsungelectronics460
      @gemsungelectronics460  11 หลายเดือนก่อน +1

      Yes, I see no problem in replacing the potentiometer in the dc dc module with the x9c103s.
      Just make sure the current potentiometer has a full range of 10k for compatibility.
      Thank you for watching!

    • @TusharGS007
      @TusharGS007 11 หลายเดือนก่อน

      @@gemsungelectronics460 but can it handle upto 40v? Cuz the data sheet says 5v only😅

    • @gemsungelectronics460
      @gemsungelectronics460  11 หลายเดือนก่อน

      Yes, you're right.
      The terminal voltage should be limited to +/-5V.
      That means the output voltage should be limited to 5V as well.
      Sorry for the confusion.
      Thank you.

    • @TusharGS007
      @TusharGS007 11 หลายเดือนก่อน

      @@gemsungelectronics460 Do you know of any alternatives that I can use?

  • @minravex2326
    @minravex2326 ปีที่แล้ว +1

    Can I use it to control amplifier volume

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +3

      Hi, it can be used to control the amplifier volume, just make sure the current flowing through the potentiometer not exceed 3mA max.
      Thank you for watching!

  • @kaleenbhaiya2258
    @kaleenbhaiya2258 ปีที่แล้ว +1

    Can we change Current and Voltage both using this?

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +3

      Hi, it is possible to change both current and voltage using this potentiometer, but usually potentiometers are used to change the voltage, not current.
      The reason is, this potentiometer can handle up to 4.4mA of current.
      For current applications, rheostats are more suited.
      Thank you for watching!!

    • @BertGrink
      @BertGrink 11 หลายเดือนก่อน

      You can use a BJT transistor to control current by sending a control voltage through a resistor into the Base of the transistor, this will in turn determine how much current flows through the transistor from Collector to Emitter.

  • @zz4855
    @zz4855 2 ปีที่แล้ว

    Hallo, Is this potentiometr works with espeasy?

  • @PnyouT
    @PnyouT ปีที่แล้ว +1

    What happens when we press that switch once rather than continuosly pressing

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +1

      Hi, do you mean the up and down button? It is implementation specific, dependent on how you implement the arduino code.
      However, if you trigger the up or down pin once, the wiper moves up or down one position at a time.
      Hope your question is answered!
      Thank you for watching!

  • @Boyner.
    @Boyner. 5 หลายเดือนก่อน +1

    Can you give an example of using DC electricity?

    • @gemsungelectronics460
      @gemsungelectronics460  5 หลายเดือนก่อน +1

      Hi, the usage of DC is huge, including all the digital circuits!
      I think you can get a better idea by searching "where is DC used" in the internet.
      Thank you for watching!

  • @yasind.1057
    @yasind.1057 2 ปีที่แล้ว +2

    hi, can you tell me where i can get the program code?

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +3

      Hello, you can download the code and the configuration used in the demo from the following link.
      drive.google.com/drive/folders/1YxCH3byESSoGbQtQ7U2HApApApZmV-oW?usp=sharing
      Thank you for watching!

    • @yasind.1057
      @yasind.1057 2 ปีที่แล้ว +1

      @@gemsungelectronics460 Thank u for your answer

    • @yasind.1057
      @yasind.1057 2 ปีที่แล้ว

      @@gemsungelectronics460 hi, i need help again. do you have the program code again on vhdl? thanks in advance

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว

      Hello, you can implement in various ways.
      For example, you can just use combinatorial logic such as,
      cs

  • @kunalburman2895
    @kunalburman2895 2 ปีที่แล้ว +1

    Hello, first of thank you for the video. I wanted to know how i can connect A1,W,B1 to resistor divider circuit of TPS7A4101? Please can you tell me how i can connect it?

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      TPS7A4101 seems to be an LDO. Do you want to control the output voltage of TPS7A4101 with X9C103S potentiometer?
      If so, I think you can fix R2, and connect VH and VW in the place of R1. (Resistor reference number from TPS7A4101 datasheet)
      Since the adjustment is made from the following formula: Vout = (R1/R2+1)*Vref,
      when you set the wiper point to its maximum, R1 = 0 and Vout = Vref = 1.173V.
      When you set the wiper point to its minimum, R1 = 10kohm, Vout = (10k/R2+1)*Vref.
      If you want maximum output voltage of 48V, R2 should be 250.5 ohm.
      This assumes that there is no restriction on the range of the adjust resistor. (Which I haven't seen any comments on that in the datasheet).
      If there is some restrictions on the range of the resistor in the TPS7A4101 LDO, then consider using 100kohm potentiometer version, X9C104.
      If you have any further questions, please let me know.
      Thank you for watching!

    • @kunalburman2895
      @kunalburman2895 2 ปีที่แล้ว +1

      @@gemsungelectronics460 Hello Sir, thank you for your reply, 1. Yes I want to control the output voltage of TPS7A4101. I guess the maximum feedback resistance value is 500K. I guess R1 cannot be changed, R2 has to be used as a potentiometer because the voltage will vary and can harm the Potentiometer. Also the Potentiometer that i am using is AD5270 (10 bit). But now after calculating the R2 values:
      for 2V-> R1=10K, R2=13k
      For 48V-> R1=10k, R2=0.24k.
      Please can you tell me how i can connect A1,W,B1 to R1?

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      Hello, I took a look at AD5270 data sheet, but there were only two pins available (A and W), since this is a rheostat type variable resistor.
      If you want to replace R1 with AD5270, you can connect as follows:
      - A pin from AD5270 to Vout pin of TPS7A4101.
      - W pin from AD5270 to FB pin of TPS7A4101.
      This way, you can control the wiper position of AD5270 to adjust the value of R1.
      Thank you!

    • @kunalburman2895
      @kunalburman2895 2 ปีที่แล้ว +1

      @@gemsungelectronics460 Hello Sir, as i said earlier, applying the pin directly to Output of TPs7A4101 can cause damage to Rheostat type potentiometer. So if i replace R2 with AD5270, then A,W will be connected together or differently?
      Thank you

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      How about using R1=24k, and replace R2 with AD5270 and use 100k mode to limit the current below 2mA?
      The minimum output will be 1.457V in this case.

  • @JuanSanchez-so9ut
    @JuanSanchez-so9ut 10 หลายเดือนก่อน +1

    is it necessary the arduino for it to work?

    • @gemsungelectronics460
      @gemsungelectronics460  10 หลายเดือนก่อน +1

      Auduino is just a tool for implementing the controls needed for the digital potentiometer. You can use any other micro processor for this purpose.
      Thank you for watching!

    • @JuanSanchez-so9ut
      @JuanSanchez-so9ut 10 หลายเดือนก่อน +1

      @@gemsungelectronics460 sorry i meant if it was necessary a micro controller for it

    • @gemsungelectronics460
      @gemsungelectronics460  10 หลายเดือนก่อน +3

      You can control the potentiometer manually without a microprocessor. Even a dip switch can be used!!
      But I prefer using microcontroller, since it can simplify controlling the potentiometer.
      Sorry if this is not the answer for your question.
      Please feel free to ask if you have any other question.
      Thanks.

  • @khaizertechnology3017
    @khaizertechnology3017 ปีที่แล้ว +1

    can i use as rheostat

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +2

      Hello, functionally potentiometers are no different as rheostats, but usually, rheostats are used to handle high currents, whereas potentiometers are used to control voltage.
      Especially, this device can handle a maximum of 3mA, which is too low to be used as a rheostat.
      Thank you for watching!

  • @greglast8016
    @greglast8016 3 หลายเดือนก่อน +2

    like the data, hate the robot voice

    • @gemsungelectronics460
      @gemsungelectronics460  3 หลายเดือนก่อน +1

      Sorry for the disappointment.
      Thank you for watching!!

  • @ictrepairs6963
    @ictrepairs6963 ปีที่แล้ว +1

    I would like to repalce a stereo analog 250k logarithmic pot with a digital one, do you think are there some chance to find an IC with the required resistance value and make it usable for my application?

    • @gemsungelectronics460
      @gemsungelectronics460  ปีที่แล้ว +3

      Hello, sorry for my late response.
      There are several variants for the X9C series:
      - X9C102 : Up to 1k
      - X9C103 : Up to 10k
      - X9C104 : Up to 100k
      - X9C503 : Up to 50k
      You can combine above devices to achieve a maximum resistance value of 250k.
      Or you can search for a digital potentiometer which supports up to 250k. (I believe there are some available)
      If you have any more questions, please leave a comment below.
      Thank you for watching!

  • @WildVlogger
    @WildVlogger 2 ปีที่แล้ว +1

    Hello sir I need your help for interfacing x9c103s
    Please try to contact me 🙏
    It is important project for my collage

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      Hello!
      Thank you for watching!
      Please leave a comment here to see what I can help you with!

    • @WildVlogger
      @WildVlogger 2 ปีที่แล้ว +1

      @@gemsungelectronics460 can you send me the another code for X9C103S ic

    • @dse-66-sailbhandekar61
      @dse-66-sailbhandekar61 2 ปีที่แล้ว +2

      @@gemsungelectronics460 can i will use here arduino mega 2560

    • @dse-66-sailbhandekar61
      @dse-66-sailbhandekar61 2 ปีที่แล้ว

      @@gemsungelectronics460
      #include
      const int CS = 10;
      char ch = 1;
      int RawVoltage = 0;
      float Voltage = 0;
      void setup()
      {
      pinMode (CS, OUTPUT);
      Serial.begin(9600);
      digitalWrite(CS,HIGH);
      SPI.begin(); // initialize SPI
      }
      void loop(){
      if(Serial.available()>0)
      {
      char ch = Serial.read();
      if (ch=='1')
      for(ch = 0; ch < 255; ch++);
      {
      delay(100);
      RawVoltage = analogRead(ch);
      Voltage = (RawVoltage * 5.0 )/ 1024.0;
      Serial.print("Level = " );
      Serial.print(ch);
      Serial.print("\t Voltage = ");
      Serial.println(Voltage,3);
      }
      }
      else if (ch=='0')

      for(ch = 255; ch > 0; ch--);
      {

      RawVoltage = analogRead(ch);
      Voltage = (RawVoltage * 5.0 )/ 1024.0;
      Serial.print("Level = " );
      Serial.print(ch);
      Serial.print("\t Voltage = ");
      Serial.println(Voltage,3);
      }
      {
      digitalWrite(CS,LOW); // select the chip
      SPI.transfer(B00010001); // command byte
      SPI.transfer(ch); // data byte
      digitalWrite(CS,HIGH); // de-select the chip
      {
      int main ()
      {
      Serial.print();
      return 0;

      }
      }
      }
      please find the error

    • @gemsungelectronics460
      @gemsungelectronics460  2 ปีที่แล้ว +1

      Hello!
      Yes, you can use atmega2560 to interface with x9c103s.
      All you need is several GPIOs.
      Thank you for watching!!