Custom Voltage Range for Custom Potentiometer

Hello enthusiasts! This is my first post, and I have a question related to signal sensing with custom potentiometers and/or variable resistors.

I'm making a custom potentiometer using resistance wires (Kanthal) and 3D printed parts (PLA) to be employed on Arduino UNO or ATmega328P. As demonstrated in the attached figure, the result would be a dial-like module where the conductive wiper (i.e., a piece of metal sheet) slides over the resistance wire when rotating the shaft (3D printed) and acts as a voltage divider to the analog input (just like a plain potentiometer), to generate a signal between 0 and 1023.

In this project, however, the entire resistance wire extent has a relatively low resistance (e.g., between 10 and 40 ohms), which means that I may burn the Arduino if I connect the 5V directly to the GND. Therefore, to limit the current, I put a 500 ohm resistor before the potentiometer (R1 in the figure). On the other hand, considering that R1 also lowers the read signal values (possibly because it divides the voltage from the reference voltage), the analog input signal will be always offset to a maximum value (e.g., 666 or lower instead of 1023), whereas the desired range is between 0 and 1023. Naturally, I could use the map function to correct the values, but this would impact the signal resolution as well, which is not desired in this project.

In this sense, how do I set a custom voltage range so that my custom (~20 ohm) potentiometer could read signals between 0 and 1023 at full resolution?

Some additional considerations:

  • I thought about using a custom voltage reference by the AREF pin. However, it seems that setting this pin may impact other sensor modules as well, so I'm avoiding it for now. Correct me if I'm wrong;
  • I read somewhere that op-amps could be used to voltage reference applications, and I happen to have some common op-amps here, but I don't know whether they would help in this situation nor how to apply them in this scenario;
  • Since I live in a developing country with few electronics stores and absurdly high import taxes, I may not have access to very specific electronic components. The popular ones are OK though.

I think that solving this problem will also help other people who asked me similar questions in the past regarding custom voltage ranges for analog input.
Thanks in advance.


Note 1: Figure jokes apart, my UNO is actually from Italy, so burning it is not an option :slight_smile:
Note 2: The "Khantal" is mispronounced in the figure, the correct is "Kanthal". Guess I was thinking about Genghis Khan at the time.

Hi,
Welcome to the forum.

Why do you need a custom potentiometer?
What is the application?

Can you please tell us your electronics, programming, arduino, hardware experience?

You could look to rescaling/mapping your ADC values back to 0 to 1023.
Look at map function, however you would loose resolution.

If you do not want to reassign Vref, the only other solution would be a DC amplifier between the pot and ADC input to bring your signal back to 0 - 5V.

Tom... :slight_smile:

I like the Chinese/Italian Uno image.
This exercise appears to rule out the use of an external voltage reference for the analog to digital converter but appears to allow you to solve the problem with an OP amp. Are any of the OP amps in your possession rail to rail devices ?

TomGeorge:
Hi,
Welcome to the forum.

Why do you need a custom potentiometer?
What is the application?

Hi, Tom! Thank you for your considerations.
I want a custom potentiometer to have full control of the resolution, number of turns, quality, space, design, among other many things. Most potentiometers have just one turn and a lot of noise, and in my country I don't have access to high-quality multi-turn potentiometers (well, at least not with a reasonable price). I also want to be able to apply my custom designs to the potentiometer's "body" with the aid of my 3D printer.

Can you please tell us your electronics, programming, arduino, hardware experience?

Graduate and long-term experience with programming, but only in the recent years I begun my studies with hardware and electronics (mainly, but not exclusively using Arduino).

You could look to rescaling/mapping your ADC values back to 0 to 1023.
Look at map function, however you would loose resolution.

As already quoted in the question, the full resolution is desired, so mapping unfortunately is not an option.

If you do not want to reassign Vref, the only other solution would be a DC amplifier between the pot and ADC input to bring your signal back to 0 - 5V.

Could you give an example of such application?

This exercise appears to rule out the use of an external voltage reference for the analog to digital converter but appears to allow you to solve the problem with an OP amp. Are any of the OP amps in your possession rail to rail devices ?

Hi 6v6gt! Thank you for considering that. Not sure how to answer to you, but my op-amp is a DM311 (an 8DIP IC).
Datasheet in this link. (Wrong datasheet! It seems that this specific model has no references, sorry...)
Does that help?

Hi,
That DM311 you linked to is not an Op-Amp it is a high voltage switch(MOSFET).

Tom... :slight_smile:

TomGeorge:
That DM311 you linked to is not an Op-Amp it is a high voltage switch(MOSFET).

Sorry, my mistake. I coudn't find a datasheet for this op-amp IC :confused:

Anyway, you could put the outer connections of the 20 ohm potentiometer between 0 and 5 volts and put the 500 ohm resistor between A1 and the wiper. The potentiometer may get a bit warm but you would use the full range of the ADC (0 to 1023)

6v6gt:
Anyway, you could put the outer connections of the 20 ohm potentiometer between 0 and 5 volts and put the 500 ohm resistor between A0 and the wiper. The potentiometer may get a bit warm but you would use the full range of the ADC (0 to 1023)

The problem is that this setting would draw 250 mA from the Arduino across the 20 ohms resistance wire (I = V/R, I = 5V/20Ω = 0,25A), whereas Arduino can only provide 200 mA. Moreover, heat is a concern for 3D printed PLA parts, so controlling the current flow is mandatory in this case.

nunesu:
The problem is that this setting would draw 250 mA from the Arduino across the 20 ohms resistance wire (I = V/R, I = 5V/20Ω = 0,25A), whereas Arduino can only provide 200 mA. Moreover, heat is a concern for 3D printed PLA parts, so controlling the current flow is mandatory in this case.

The solution would be in this case to provide an external 5V supply capable of the current drawn by the custom pot.
The gnd of the external 5V supply and the Arduino would need to be connected together.
Tom.. :slight_smile:

TomGeorge:
The solution would be in this case to provide an external 5V supply capable of the current drawn by the custom pot.
The gnd of the external 5V supply and the Arduino would need to be connected together.
Tom.. :slight_smile:

Well, that may burn all the plastic XD
If at least there was some way to decrease the current requirement without breaking the Ohm's law...
Perhaps the op-amp would help with it. Even without the datasheet, if I had some theoretical model/idea adapted to this case, I could apply it using any op-amp IC.

Are you able, together with that DM311 (or some other means), to set up a low duty cycle PWM which you feed through that "potentiometer" you are constructing. You could then set up the ADC to make the measurement during the on part of the duty cycle. The heating effect would be reduced, depending on the duty cycle.

6v6gt:
Are you able, together with that DM311 (or some other means), to set up a low duty cycle PWM which you feed through that "potentiometer" you are constructing. You could then set up the ADC to make the measurement during the on part of the duty cycle. The heating effect would be reduced, depending on the duty cycle.

Good point! In fact, that would be applicabe if the PWM had a low frequency, thereby limiting the heating.
However, I wonder if the PWM cycles should take way too long to benefit from this heat limitation. Wouldn't they delay way longer than the cycles from Arduino?
Anyway, this solution still requires an external power supply to draw the current, which wastes an unacceptable amount of current and heat, in addition to introducing more complexity such as managing additional supplies. Using the 5V from Arduino is OK, the problem is with the voltage reference used by the analogRead() from an analog pin when I use a resistor to limit the current. I can't figure out how to set the reference for that specific pin only.

Use a voltage divider to drop the maximum wiper voltage (3.26V?) down to 1.1V and use internal reference.
Uhh, with the values in your picture (500 and 20) the maximum voltage (with 5V in) will be 0.385V. Current through "pot" will be about 9.6mA. 20 Ohm wire will dissipate about 2mW.

If you used a 75 Ohm instead of 500, with 5V, current would be 5V / (75 + 20) = 95 = 52.6mA * 20 Ohms = 1.052V.
Power from wire I^2R = 55mW. 1.052V read with 1.1V reference = ADC value 980.

JCA34F:
If you used a 75 Ohm instead of 500, with 5V, current would be 5V / (75 + 20) = 95 = 52.6mA * 20 Ohms = 1.052V.
Power from wire I^2R = 55mW. 1.052V read with 1.1V reference = ADC value 980.

Is there a way to set this 1.1V reference that you mentioned without messing with other sensors/modules connected to analog pins whose voltage reference must be 5V?

You can change back and forth between them using the commands on the Reference page provided earlier.

CrossRoads:
You can change back and forth between them using the commands on the Reference page provided earlier.

I see, good point! I'll test your suggestion to see if it works well with other sensors.
In the worst case, I may end up using a cheaper MCU like ATtiny to manage my "not-so-potentiometer" with very low voltage references, then use it as a separate module that communicates to the main Arduino using SPI.
Thank you CrossRoads, JCA34F, and others for the helpful advices. :slight_smile:

(Note: If by chance any op-amp genius see this thread and has found a solution using op-amps, please let me know! Thank you in advance)

Finally managed to find a reasonable solution using op-amps! I took some fundamental concepts from books and tutorials concerning the application of non-inverting op-amps and adapted them to this problem. In the end, the final implementation was a lot simpler than I thought.

Solution using Operational Amplifiers (Op-amps)

As demonstrated in the attached figure below, I added a resistor of Rlim ohms (e.g., 10kΩ) to my custom potentiometer of Rpot ohms (e.g., 20Ω), causing the maximum signal voltage to drop by a ratio of Rpot / Rlim. Then, I used an op-amp to bring the signal voltage back to 0V~5V by multiplying it by Rlim / Rpot, which can be achieved by attaching a resistor of Rpot to the op-amp voltage divider together with a second Rlim resistor. Actually, the op-amp multiplier should be (1 + (Rlim / Rpot)), but the added 1 becomes meaningless if Rlim is a lot greater than Rpot.

The solution is not perfect though. In my configuration, by using a custom potentiometer of 20Ω and a limiting resistor of 10kΩ, the output signal will range from 28 to 1015 instead of 0 to 1023, so it still requires a bit of mapping to correct the values. Nevertheless, it's a lot more accurate than not using it, doesn't waste large amounts of heat and current, and can be adapted to any low resistance potentiometer (i.e., something between 1Ω and 100Ω).
I think this model has a lot of room for improvement, so I'm also open for further discussion.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.