Rebuild an old potentiometer using DigiPots  - Page 1
Forum section: electronics / beginners

author: pitpat
author_rank: Contributor
timestamp: July 06, 2021, 08:25:19 am
content: Hi!I'm at the beggining of a new project and in need of some suggestions, basically I have this old Bourns dual continous 10kohm push-push from a Tek. that croubled apart.Unfortunately finding a replacemet isn't quite an option since those are not produced anymore, I'm planning to use an encoder paired with two 10k digipots that would suffice the need for a push-push switch and the 360 degrees of rotation that the old one had.According to the schematics looks like the old pot had 2 variable voltages as an output ACUR and BCURBut i couldn't understand if those those voltages should vary from 0v to 5v togheter or as opposites so that when A=5v B=0v and so on.What do you think?ThanksFederico

author: brownt
author_rank: Regular Contributor
timestamp: July 06, 2021, 08:59:35 am
content: Maybe I am missing something, but the ends of the two pots are in parallel. And so their outputs would be the same unless the physical pot arrangement actually turned one forward and the other backward, which sounds unusual. There is nothing on the schematic that indicates that fact. Actually, both pots have CW on them, which I assume is clockwise. So, tolerances aside, it seems that both pots will have identical voltages on their wipers.However, given the replacement you are considering, it sounds like you know more about these things than I do, so what is it that I am missing about what seems like an obvious answer? Is it the switches that change things around?

author: tggzzz
author_rank: Super Contributor
timestamp: July 06, 2021, 09:09:01 am
content: We don't know the instrument, nor what the controls change.I would guess that the two pots are independent, but coaxially aligned. That was sometimes used to save valuable front panel space.Nowadays such a control would be buried inside a menu system.

author: Ian.M
author_rank: Super Contributor
timestamp: July 06, 2021, 09:13:54 am
content: It says 'cursors' and PitPat stated "continous" i.e. continuous rotation.That would almost certainly be a sine/cosine potentiometer. It produces a unique paired analog output for any angular position, repeating after 360 deg. When one is 0% or 100% the other will be at 50% and visa versa.

author: pitpat
author_rank: Contributor
timestamp: July 06, 2021, 09:27:24 am
content: Hi! Thank for the replies! I totally forgot to mention the actual use of the said potentiomer, is used as a cursor control on an, indeed, old scope.Dismanteling it revealed to be coaxally allined as tggzzz suggested, I'm not sure though if they were alligned also radially since the second pot rusted away.> However, given the replacement you are considering, it sounds like you know more about these things than I do, so what is it that I am missing about > what seems like an obvious answer?I'm sorry for the confusion, I do often get lost in what i write, expecially sice English,as you may have noticed, isn't my first language.So, the main questions are:Will the double digipots configuration work with only one encoder? should I consider using a Dual-type. What about the zero crossing? how those ICs will sort this event? and if those A and B values are really equal at the same time why choosing to use 2 pot. instead of only one?

author: pitpat
author_rank: Contributor
timestamp: July 06, 2021, 09:34:27 am
content: Oh! a sin/cos pot. Thats cool never seen one before! I guess that's why i'm here, if so the only way I can think to "emulate" it is by using a MICRO, things are getting interesting..

author: Ian.M
author_rank: Super Contributor
timestamp: July 06, 2021, 11:13:14 am
content: I'd go with a MCU that can run at 5V and generate 2x 16 bit fast PWM signals with complimentary outputs, as if you have PWM + inverted PWM for each, its trivial to implement a passive second order filter. A MCU with 2x 10 bit or greater DACs would also be an option, but the devil is in the details as it may well not drive rail-to-rail, and is likely to have a higher output impedance than the filtered PWM, even with passive filtering. A QEI interface would be nice, to avoid the need for polling the encoder and running your own encoder state machine, but they are fairly rare in smaller 5V capable MCUs.

author: pitpat
author_rank: Contributor
timestamp: July 06, 2021, 12:25:39 pm
content: Hi, thanks for the tip!. I should have an arduino micro and some 5v rail to rail op-amp.I honestly dont know if the final resolution will be enough but at least i should be able to experiment with the dual pot situation.About the filter circuit, I'll start with a simple RC and see from there.

author: Ian.M
author_rank: Super Contributor
timestamp: July 06, 2021, 06:04:36 pm
content: Here's a LTspice sim of passive filtering sine and cosine dutycycle PWM signals. Each is paired with its compliment (inverted) signal to ease filtering. The filter should give 18 dB/octave rollof above its break frequency with a DC output impedance only fractionally over 2K. As the existing pot must have had 5K Thevenin equivalent resistance when either wiper was midway between 5V and Gnd. it probably wont need buffering.Hint, when the SPICE error log pops up, right click in it, selectPlot .step'ed .meas datathen add theFiltAandFiltBtraces to the new waveform window.If you are only looking at the PWM in detail, comment out the.step paramso the sim only runs once.Your next problem is figuring out how to get a pair of 10 bit fast PWMs out of an Atmega32U4, as the Arduino default PWM is under 1KHz and only eight bit!Edit: bugfix for the sim:Code:.func OnTime(angle) {limit(0, (sin({angle}/180*pi)+1)/(2*{freq}) -10n, 1/{freq}-20n)}Revised OnTime() eliminates warning at 100% duty cycle that the period will be extended. N.B. true DC level 0% and 100% duty cycles aren't implemented in this sim, there's always a triangle runt pulse remaining, in this case with 10ns rise and fall times.

author: pitpat
author_rank: Contributor
timestamp: July 07, 2021, 09:28:00 am
content: Hi, sorry for the late reply, is the first time I use LTspice so i had to learn something about it to really appreciate your work, quite a useful tool!, I always used simulink for this kind of simulations.Honestly my digital background is quite poor and this project was meant to learn a bit more about it.Anyway browsing on the internet I foundhttp://www.jetecnet.com/2230_encoder/2230encoder.htmlthat is exactly what I'm trying to achive.I spoke with the owner and it is not willing to sell me one board or the schematics...He states "Technical details: 64 pulse encoder, circuit clocks on both edges so 128 pulses per revolution. Dual 8 bit DAC counts to 1024 pulses for each cursor"Good to know I guess, something likehttp://ww1.microchip.com/downloads/en/DeviceDoc/22187E.pdfshould be quite good to be used in combination with a I2C capable mcu. Adafruit sells a board already populated with the necessary to operate with arduino or similar.

author: pitpat
author_rank: Contributor
timestamp: July 07, 2021, 05:43:02 pm
content: More i think about it and more i like the first solution Ian.M proposed, should i look for an MCU capable of deliver an inverted pwm or try to use another IC to achive it like an HEX inverter? As far as I know Arduin doesn't have that function builtin

author: Ian.M
author_rank: Super Contributor
timestamp: July 07, 2021, 06:08:36 pm
content: If you want to go the DAC route, you don't need four channels or EEPROM storage, so I would suggest the 12 bit 2 channelMCP4922SPI DAC. At the expense of a couple of extra MCU pins, its IMHO easier to pump data to quickly than the more complex I2C DAC you were looking at. Its also slightly cheaper and seems to have better availability. You can even get it in PDIP for breadboard prototyping.https://www.mouser.com/_/?Keyword=MCP4922&bws=1For the complimentary outputs for the filtered PWM version, if you can't coax the required signals out of your MCU, as long as it can output a pair of high enough frequency, high enough resolution single-output PWMs, you could always use a dual inverter e.g. any brand of74LVC2G04.

author: exe
author_rank: Unknown
timestamp: July 08, 2021, 10:47:15 am
content: Digipots have a few gotchas. One is, the voltage across them can't exceed power rails. The second is, usually they usually have very small supply voltage, like 5V. So, be sure you understand voltage specifications.There are digipots with separate voltage and logic supply, such ashttps://www.analog.com/media/en/technical-documentation/data-sheets/AD5121_5141.pdf. Those might be easier to use if one needs a "floating" (not bound to ground) digipot.

author: pitpat
author_rank: Contributor
timestamp: July 10, 2021, 12:59:06 pm
content: Hi!So, so far I'm up with two options:- An MCU with the first technique suggested by Ian.M (PWM filtered to analog) but im having some struggle to find an MCU capable of delivering two 16bit fast signals- An ATtiny 84 in combination with two digipot as the MCP4561 or just a dual one.> Digipots have a few gotchas. One is, the voltage across them can't exceed power rails. The second is, usually they usually have very small supply voltage, like 5V. >So, be sure you understand voltage specificationsI should be fine there since either the wiper voltage and the power supply should be at 5v.