Need potentiometer at end of 7' cable. Twisted pair w/ I2C. Potential issues? - Page 1
Forum section: electronics / projects

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 01:39:28 pm
content: I have a project where I need to stick a potentiometer at the end of a Cat5 cable which will also be carrying power and an I2C bus. I've already discussed the I2C stuff here and done the calculations. I know it's not the best idea, but the cables are robust and cheap. The signal lines are twisted with ground returns. That leaves me four more wires, two of which need to supply 5V.The potentiometer will be used for volume adjustment but won't be carrying audio signals. It will be read by a microcontroller and then the volume will be adjusted in software. This I assume should lead to lower potential for interference mucking with the audio, and if necessary I can digitally filter the input.What I'd like to do is either connect two analog pins to the cable, twisting each with one 5V line, or connect one analog pin to two wires, each twisted with a 5V line.Do you see any serious potential issues with doing this that couldn't be overcome with a little averaging of the analog input? Do you think a 10K pot will be fine, or should I use a 5K? Would 100K be fine as well? I assume more power draw (5K pot) = less potential for noise coupling from outside and the data being transferred in the twisted pairs running alongside the cable.

author: Kalvin
author_rank: Super Contributor
timestamp: January 22, 2016, 01:47:55 pm
content: Please, draw a simple (freehand) schematics what you are thinking to do as it makes easier to figure out the intent.

author: Richard Crowley
author_rank: Super Contributor
timestamp: January 22, 2016, 01:59:47 pm
content: I agree. A picture is worth 1000 words. Much of your verbal description is vulnerable to ambiguous interpretation. But I would use one of the cat pair to feed the voltage to the pot, and another pair to bring the resulting voltage back. Using a separate return "ground" removes the effect of the series resistance of the line. And I would lean in the direction of lower resistance pot. 5K seems good to me. That is only 1mA at 5V, so dissipation doesn't seem like a big deal unless this is a battery-operated, low-power circuit.

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 02:49:06 pm
content: 5V microcontroller analog pin -> 7ft CAt5e cable -> PotentiometerPin mapping on the cable currently is:1st pair: IO, 5V2nd pair: SDA, GND3rd pair: SCL, GND4th pair: IO, 5VI need two 5V and two GND lines because it's only 24awg wire and there's a bunch of LEDs and stuff at the other end drawing significant power and I need to keep the voltage drop to a minimum.QuoteWhat do mean by remove the effect of the series resistance?I can see how it would make sense to have separate lines supplying power and ground to the pot, but since I need SDA SCL, and two lines each dedicated to power and ground for the LEDs, I only have two lines left to work with.I mean if I absolutely have to I could use a separate servo cable for the pot. But that would look really hack-ish and add to the cost of the whole thing which is already high. And I could do that regardless of whether the pot works with the Cat5 since the pins will be there on the board to plug the cable into.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 22, 2016, 04:24:53 pm
content: Ehhhh....Eww..Please, just... don't.For the sake of your own sanity, and for the sake of others.Your I2C communications will be all but fully shat upon for even a small amount of ambient noise (~1V). An unfiltered Chinese power adapter will blot it out. Appliances and lights turning on and off will corrupt packets. Driveby radio communications will talk over it.Likewise, nearby radios (from AM BCB to SW, though probably not into the VHF range) will be completely swamped any time your I2C is talking.At the very least, use a shielded (as in braid) multiconductor cable, and shielded metallic (D-sub or circular) connectors. But much better, use a signaling standard suitable for transmission, like RS-422/485 (or -232 if slow is okay), which being differential can still use UTP cable.Tim

author: Ian.M
author_rank: Super Contributor
timestamp: January 22, 2016, 04:36:14 pm
content: Got a higher supply rail available at the MCU end? If so, you'd do best to put a regulated DC-DC converter at the remote end for the local 5V rail, and keep its -ve supply separate from the I2C ground at that end. You can easily halve the DC supply current through the cable if you go to 12V to feed the converter. As has been pointed out, I2C is *NOT* a good choice for this - even with I2C line drivers, and if you let the supply return current lift the I2C ground you haven't got a snowflake's chance in hell of it working.For the remote pot, consider a 4-20ma current loop. e.g.:You get near enough to an Audio taper from a linear pot and if you add some filtering and a Zener clamp at the MCU end, its more or less bulletproof. Use the same supply as the feed to the DC-DC converter, and you'll only need 1 wire back or put it and the converter each on their own twisted pair. The 8V supply is a minimum to leave a little headroom for the LM317 at the 20mA end. You could go up to 12V or 24V with no problems.LM317 model from yahoo attached. If you don't have one, make a "3rd party" folder under "lib\sym", drop the LM317.asy file in "lib\sym\3rd party" and the LM317.lib file in "lib\sub" and it should 'just work'.

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 05:14:26 pm
content: Quote from: T3sl4co1l on January 22, 2016, 04:24:53 pmI've already had this conversation here. The I2C specification says twisted pair is fine so long as you use appropriately sized pullups (2K in my case) and twist each pair with ground, or twist one with 5V one with ground and have a small decoupling capacitor.And are you seriously implying that turning on a light or having an unfiltered power adapter could cause the voltage in my data lines to change by as much as 1V? I mean maybe if I were using 100K resistors and the signal was high I could see it being overpowered.QuoteIf that's true, how is it normal networking traffic doesn't interfere with anything? Also, would using SPI make any difference here? Not that I could. The design is way past the stage where I could make that kind of change.Also, I see a lot of people driving Neopixel/WS2812 LEDs with these networking cables. Wouldn't those interfere with radio as well?If it helps, I'll be using fast mode+ which is 1MHz. That seems to be outside the normal band of AM radio and well below VHF.QuoteBeen there, done that. Two different Chinese manufacturers nicked 50% of the cables and hid the damage beneath heat shrink. Cables cost me a fortune, the failing devices hurt my reputation, and I had to replace them and pay for shipping on top of it.QuoteThere are chips designed to convert I2C to differential signals which after a quick glance at what RS-422 is seems to be what that's about. I considered using them, and perhaps in a future revision of the board I will consider going that route. The present design would allow for it without too much difficulty.But I've been working on this for a year now and I'm almost out of money. I've gotta get something up and running in the next month if I hope to stay in business and there's a bunch of other stuff I need to do which takes priority over maybe interfering with someone's CB radio. If it makes you feel better I don't sell a lot of these boards and they're not something that is used more than 3-5 times a year for a few hours.

author: Kalvin
author_rank: Super Contributor
timestamp: January 22, 2016, 05:37:24 pm
content: Juts put a 10Kohm potentiometer between the 5V and GND and connect the wiper to the wire. At the other end place a 100ohm resistor in series with the wire and place a 100nF capacitor to the ground from the other end of the resistor in order to provide some filtering**. Then feed the filtered signal into A/D-input of your processor. You may want to do some digital filtering (averaging) for the results you read from the A/D-converter in order to get cleaner signal.Ps. If this works, you owe me a beer** ie. 100nF capacitor between the A/D-input and the ground.

author: Ian.M
author_rank: Super Contributor
timestamp: January 22, 2016, 05:48:33 pm
content: Radical thought! Why not put an I2C ADC at the pot end to read the pot?

author: Fungus
author_rank: Super Contributor
timestamp: January 22, 2016, 05:50:02 pm
content: Quote from: Starlord on January 22, 2016, 01:39:28 pmShould be fine.Be sure to put a nice ceramic capacitor on the microcontroller's analog input pin (pin->ground) to help absorb any noise. 0.1uF should do it.

author: Kalvin
author_rank: Super Contributor
timestamp: January 22, 2016, 05:55:39 pm
content: Quote from: Ian.M on January 22, 2016, 05:48:33 pm

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 05:59:03 pm
content: Quote from: Ian.M on January 22, 2016, 04:36:14 pmYes I have a 12V supply. I considered this approach at one point but balked at the added cost of sticking switching regulators on each satellite module. This project is already getting ridiculous on the cost/profit ratio.QuoteI've done the calculations. Forget ground lift for a moment. If the pullups are to 5V on the microcontroller side but the Vcc supply drops below I think it was 4.75V at any time then I would be outside the max voltage specs for the pins. That's why I have two power and two ground, and why I used Cat5 cable which has 24awg wire. The original plan was to use a flat flex cable, but there wasn't enough copper in that to keep the voltage drop low enough if I was drawing a worse case assumption of 1A.So I know what my maximum voltage droop and ground lift might be. And they should be in spec.And if something works, is is really a bad choice, if it reduces the cost of the design, and makes the cables much more reliable on my extremely limited budget? I mean yeah I'd be making my life easier on the engineering side if I weren't trying to walk such a fine line, and if I screw it up and the data transmission is unreliable, that's bad.QuoteWhen you say a 4-20mA current loop, what do you mean by that? Are you suggesting I select a pot whose resistance is low enough that 4-20mA flows through it constantly? So a 1K pot? I don't understand your schematic. On first glance I'd say Vpot is connected to the wiper but what's with R1 and R3 and the diagram below them?Furthermore why are you suggesting implementing an audio taper in hardware? I can implement that programmatically. And in doing so I can support both linear and logarithmic pots.QuoteWhat is that application? LT Spice or something? I've never had time to learn that. Don't laugh! I've had very good success with my boards working even without simulating everything.I have occasionally used some online simulators to understand circuit behavior when implementing high pass filters or to determine what size resistors I should use for a level shifter that needed to operate at several MHz.

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 06:05:16 pm
content: Quote from: Ian.M on January 22, 2016, 05:48:33 pmMoney.If it doesn't work the way I want it to I can just tell my users who insist on sticking a pot at the end of the cable (most of them will not) to use a separate servo cable and then they can either buy that themselves or I can charge them extra for it. But adding another $3 to the cost of my board for a tiny fraction of people who insist on that volume pot isn't worth it.

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 06:10:50 pm
content: Quote from: Kalvin on January 22, 2016, 05:37:24 pmWhat is the purpose of the 100 ohm resistor here? My gut says its to prevent ringing, but is ringing a concern for a signal that changes as slowly as one from a potentiometer?And what's the 100nF there to filter out? Stuff it picks up by acting like an antenna I assume, but like, what frequencies will that particular size cap filter and why not a larger or smaller cap? Just wanna learn what I can about this stuff rather than just implement something not knowing why it works.

author: Kalvin
author_rank: Super Contributor
timestamp: January 22, 2016, 06:21:24 pm
content: Quote from: Starlord on January 22, 2016, 06:10:50 pmThe 100ohm is intended to provide rudimentary protection fro the controller's input from possible voltage spikes in the cable and provide slight filtering together with the 100nF capacitor. As I do not know the input impedance of your A/D-converter I selected 100ohm resistance. It can be increased to 1kohm or more in order to provide better protection and improve filtering if the A/D-converter input. You can also increase the 100nF to 1uF if needed. The component values are not too critical here.

author: Ian.M
author_rank: Super Contributor
timestamp: January 22, 2016, 06:22:53 pm
content: R3 is the pot, 220R wired as a simple variable resistor. The stuff in the dashed box under R3 lets the LTSPICE simulator sweep its value in simulation time as it doesn't have an arbitrary variable resistor model. The current source Ipot3c (purple line) corresponds to pot rotation, 0A to 1A is 0% to 100%. Its arranged so that 0% rotation is the max resistance, for minimum output at Vpot for your ADC. V(in-out) (green line) is the voltage drop across the LM317 so you can check there is enough headroom for it to regulate the current.However, its over-complex compared to a simple remote I2C ADC with the pot wired across its supply pins, which also frees up more wires in your cable for the supply and ground. Put it on a small option board soldered to the pot legs, with a fly lead to plug into a four pin header on your remote board and charge what the market will bear for the remote pot upgrade! If you think there's ever a need to have more remote pots, or buttons etc. you can extend the concept subject to I2C addresses being available. The software can poll for the I2C ADC's presence so it can be entirely plug&play.

author: Starlord
author_rank: Frequent Contributor
timestamp: January 22, 2016, 08:44:21 pm
content: Hm...http://www.digikey.com/product-detail/en/MCP3021A5T-E%2FOT/MCP3021A5T-E%2FOTCT-ND/1979808$0.89. Plus labor. So maybe $1.25 more per board.Versus creating yet another PCB which will cost $20 min to manufacture, plus a $3 flat flex cable to go with it, plus a pot for $1. And then having to try to convince my customers that it's worth $35 so I can make a little profit...Also, I'd have to put a connector that'll cost me $2 w/ labor on the the board the Cat5 goes to in order to provide a way to connect the thing to it. So, a $1 JST PH connector + a $1 chip vs a FFC connector that costs $2 with labor. Whether or not the end user decides to purchase the upgrade...Ehh...It's a neat idea being able to connect multiple pots though, I'll give you that. Unfortunately at the quantities I'll be manufacturing these it doesn't make a lot of sense since I can't get away with charging $10-$15 for the upgrade and not lose money.Maybe I'll use the ADC chip. Or this one by TI since it can handle the higher I2C bus speeds:http://www.ti.com/lit/ds/symlink/adc081c021.pdfOnly thing is that one's 8 bit, and not sure what that will do to my volume control with the audio tapering code. Ie, converting the value to float between 0 and 1 and then multiplying it by itself to approximate the log curve. Worried about hearing the volume suddenly step down on the low end. Guess I could interpolate the value over a period of time to smooth the transitions out. Hm...Well, thanks for all the help guys!

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 22, 2016, 10:47:09 pm
content: Quote from: Starlord on January 22, 2016, 05:14:26 pmFor signal quality, it should survive just fine.That means it'll function, in the average case.That doesn't mean it's guaranteed to function in the worst case, or at all!Appnotes rarely discuss EMC, for probably three reasons:1. People hardly know anything about it;2. It's a fairly complicated subject. Not at all intractable, but beyond the scope of the average graduate;3. The authors themselves are just as likely, to be unaware of, or inexperienced with, the subject. Misinformation abounds.So if you haven't seen much on the subject... it's not unusual, sadly.QuoteYes! Absolutely!A light switch doesn't seem like much, but a mechanical contact is extremely fast, having a rise time of fractional nanoseconds. Closed during the mains voltage peak, you get 160V (or more) of ringing, dancing around the power lines. It quickly permeates the building, and even at a modest distance from the wiring (within a room, say), can be several volts on a modest length of wire. The pulse is over in some tens of nanoseconds, so it's very easy to miss (and doesn't much disrupt limited-bandwidth radio transmissions), but if you have something susceptible (like digital logic inputs, which can respond in nanoseconds), it can be a big deal.Note that the pull-up strength has almost no effect on signal quality or susceptiblity. At RF, the impedance of the cable is the important factor (~100 ohms, give or take wide peaks and valleys at characteristic frequencies).The FCC recommends (but does not require) susceptibility testing at a level of 3V conducted, and 3V/m radiated. The IEC (to acquire a CE mark) requires this. Robust or special equipment may need to be tested for more.Those are the levels on the outside. Very crudely speaking, you can expect about half that to appear on the signal lines. Maybe it'll be a lot less (1/10th, say), because most of the AC current is carried by the power and ground lines; maybe it'll be a lot more (10 times, say) due to resonance and poor grounding.In any case, we're talking levels that are well within the ballpark of "fail", which isn't a very good place to be. Wouldn't it be much better to be, say, one or two orders of magnitude outside of that?You can apply some filtering, but I2C is fundamentally limited on how much capacitance it can be loaded with, especially for "high speed". And the combination of open-collector loads, single ended digital pins, and high impedances, makes any kind of inductive filtering relatively ineffective. And you can't really shove it into a more robust standard like RS-422, because it's bidirectional and open collector. (Possibly a pair of CAN PHYs could be used, though?)QuoteYou mean normal for CAT5, i.e., Ethernet?Ethernet is a great signaling standard. It's very stable, robust, and tolerates situations that would nuke other interconnects (like mains ground loop voltages!). The key is, its signals are transformer coupled, and filtered with common mode chokes besides. So the common mode (emissions/susceptiblity side) footprint is very small, despite carrying near-RS485-level voltages. (RF emissions need to be in the < 1mV range, so we're talking ~60dB worth of balance on the twisted pair.)RS-422 isn't quite as good, but properly implemented, can do a fine job. The receiver input common mode range is +/-7V, so it will completely ride through any commercial-level noise you throw at it, with just the bare ICs, no filtering. With a little filtering, and perhaps a reduced baud rate, it will tackle all but the worst industrial noise, too. Same goes for other robust "pair" type signals, like CAN and such. (But not most high speed pair types, like USB, HDMI, LVDS, etc. They have limited common mode range, and USB has quirks that preclude almost any kind of filtering.)Provided with a DC-DC converter and optoisolators, a galvanically isolated RS-422/485 channel can perform just as well as Ethernet. If probably slower.QuoteYes -- implemented correctly.SPI is very easy to implement with RS-422 signaling. Just tack transmitters on the output pins, and receivers on the input pins. Match up the pairs through twisted pair cable (UTP is fine). Don't forget a few ground wires, by the way: ground reference is still required (again, it's not transformer coupled like Ethernet is!).This takes up more than a few pins, but it can be used at reasonable speeds (RS-422 transmitters are available up to 30Mbaud) and distances (> 10m, anyway; though the standard does recommend a baud vs. distance tradeoff).At this point, you might simply consider other means, like a pair of microcontrollers and asynchronous serial over RS-422. It's a bother but it saves wires.QuoteJust because other people are doing it, doesn't mean they're doing it right... it just means other people are doing what yet-other people are doing...And likely, yes, they do, quite a lot. AM radio isn't much used by 'youngins', but that doesn't mean it's not interfering.QuoteNo, nooo, nononono! That's smack dab in the middle, and considerably below it, and considerably above!Consider the data stream. It won't be toggling every single clock cycle. Often it will sit still for several bit times. A few of those repeating and you've got a lower frequency component (presumably, as low as 1/16th the clock rate, if the address field is all 0's or 1's, and the data field is opposite). (There are emergency services down there, e.g. international maritime around 500kHz.) Likewise, each one of those switching edges contributes high frequency harmonics, probably extending into the 10s of MHz. (How far depends on the fall time, which is specified as 20ns minimum, so harmonics will go up to perhaps 50MHz.)In general, data covers a wide bandwidth of noise! So it's that much more important to keep it from leaking out of wires and such.QuoteYuck. Definitely put that into the contract -- dependent on approval of items, do a full proper inspection, all that good stuff.In any case, you'll have that problem with any cheaply made cable. And CAT5 is often solid core, which will flex even worse than stranded, lightly-nicked. I suppose you're more comfortable with that, then...Is the price really so critical that you can't get a local builder to do it? I've seen quotes for basic cables from US companies, they're not terrifically bad. Quantity pricing factors heavily, though.Tim

author: Fungus
author_rank: Super Contributor
timestamp: January 23, 2016, 12:21:10 am
content: Quote from: StarlordTwo spare wires? Two wires is perfect for I2C.Quote from: T3sl4co1l on January 22, 2016, 04:24:53 pmQuote from: T3sl4co1l on January 22, 2016, 10:47:09 pmQuestion: Why does it need to be high speed? A volume control could be read once per second, no problem. Add some capacitance, clock it at 20Hz (or whatever). Problem solved?

author: Starlord
author_rank: Frequent Contributor
timestamp: January 23, 2016, 12:25:53 am
content: Quote from: T3sl4co1l on January 22, 2016, 10:47:09 pmI said the Cat5 were cheap, not cheaply made.I paid $10 for each of the cables I had assembled in China.The Cat5 cables I can get for $3 each from Digikey:http://www.digikey.com/product-detail/en/DK-1511-007%2FBL/AE10488-ND/22682807 strand 24 AWG. No reason to expect it will break.QuoteLet me put it this way. This design was supposed to take three to five months to finish. It's taken a year. If I'm lucky I'll finish by the end of the month and I can order a set of prototype which will take three weeks to manufacture. If I'm lucky those prototypes will work, and it will only take a couple weeks to write the code. Because if I'm lucky I have enough cash to last me through the end of March.I don't even know where I'm gonna get the money to manufacture the boards if the prototypes do work. I'm hoping people will decide to pre-order a bunch once they see it in action. I know my customers so it's a fair bet they will. But still. Money is most definitely tight.I've got several other projects in the works too of course. I'm not putting all my eggs in one basket. Nor is this my first time at the rodeo. Let's just say the last three years have been... interesting.Anyway, thanks for all the information!

author: Starlord
author_rank: Frequent Contributor
timestamp: January 23, 2016, 12:29:49 am
content: Quote from: Fungus on January 23, 2016, 12:21:10 amBecause it's not just a volume control. There's also an IO expander for some switches and a couple LED drivers. That's why my original question was about an analog signal alongside an I2C bus. The pot itself was just going to be connected to an analog pin. It may still be. I haven't decided.

author: Paul Price
author_rank: Super Contributor
timestamp: January 23, 2016, 01:07:02 am
content: There is a simple reliable way to do this using cheap and versatile CAT5:(1) Forget about I2C and its idiosyncrasies. If not a mission-critical device, just wire the pot and just send the output of the pot back to the MCU and read the filtered value with an A2D input of a MCU or just use the pot as a analog pot and send the audio signal back, just make sure to use separate power, digital and signal ground connections. Simple and likely to be just what you need.Use 8-bit SR's if you want super noise immunity(for example CMOS CD4021BE CD4094BE SR's with 15V Vdd) to control the LED's and send the switch states back to the host. No fancy in/out expander chips required. This technique only needs clock and data to turn on/off LED's and read switch states and just use the pot as a analog vol. ctrl.(2)Use a cheap PICC MCU at the remote end of the 7' cable to handle the switches and lights and read any pot you want with it's 10-bit A2D. Send the MCU >7.6V and use a 78L05 to give the remote 5V MCU stable power. Use unfiltered >7.6V to drive LEDs through BJT's or MOSFETs to eliminate 5V MCU supply fluctuations to ensure stable A2D measurement of the pot. If the remote LED's are slaved to the main unit, a simple SR chip can control the LED's instead.Only in the most mission-critical device will need to send data to/back to the main unit using a schmidt-trigger input stage or comparator(LM393/LM339) and then output to an IRQ RBIE or INTE pin to receive data on a falling edge start bit. If anything than the most mission-critical applications, the schimdt-trigger input stage might not be needed at all since all transmissions would be error checked as described below and repeated.Very high data rates are possible for this 2-way communication just using two twisted pairs terminated by resistors at the remote and receiving end.Format data sent back like RS232 except using a custom long word, no. of bits suitable to handle the data size. Use a start bit followed by the data stream. Each bit would correspond to a switch or LED setting followed by 10-bits for the pot setting. Send data stream as one long stream transmission, but all the bits are first sent normal and then the stream inverted. Receiving MCU compares the two sequential bit sets to ensure 100% noise immunity. Use one wire for Clk and one wire for Data out for xmit and Data-in receive.Format data to control LEDs without using the remote MCU the same way, but only a few bits will be required to set states of the LED's and as a request to send signal for the start of the long data stream output going back to the host MCU. The remote MCU needn't even be involved in turning on-off LEDs by just feeding the control stream to one or more 8-bit SR chips (74HCT164 for example to drive at least 8 LED's without any other decoding). The SR can directly drive the LEDs using a small limiting resistor.

author: Starlord
author_rank: Frequent Contributor
timestamp: January 23, 2016, 03:00:00 am
content: Hm... I just realized that if I don't run a seperate 5V and GND supply to the pot then I'm likely to have serious problems. We were discusion ground lift and voltage drop earlier and I mentioned how I'd calculated what they would be in the worst case. Well the digital stuff should be able to tolerate some noise, but if the voltage is varying by 0.2V peak to peak, that's 4% of my 5V supply. That's a lot of variation in the volume level. With decent digital filtering I could correct for it but potentially at the cost of the volume not responding instantly to input.Perhaps for the sake of my sanity I should just require the user to run a long servo cable for the pot if they want one at the end of the cable. I really can't afford to spend another month rethinking and redesigning this.I may implement that suggestion to add a filtering capacitor and series resistor though. How would I calculate the best value resistor to use assuming I know the pin's impedance or whatever it was? I know the 100 ohms was just a guess.

author: Paul Price
author_rank: Super Contributor
timestamp: January 23, 2016, 03:12:21 am
content: If you simply use separate grounds for the LED's and Sw's and for the pot's analog ground you won't have these two circuits interfering with each other at all. Certainly the digital ground may rise .2V (at the remote end of the 7' cable) for example, but the analog signal and its ground level would not be affected. If you use CAT5, you have plenty of wires to resolve this groundloop problem!

author: Starlord
author_rank: Frequent Contributor
timestamp: January 23, 2016, 03:32:55 am
content: Yes, but the pot is a voltage divider and I only have one pair free to assign as I wish. I could give it it's own ground, but the 5V level would still be bouncing around with the digital circuits drawing lots of power intermittently, wouldn't it? I mean, it would cut the difference in half, but...

author: Ian.M
author_rank: Super Contributor
timestamp: January 23, 2016, 04:38:47 am
content: That is when you stick a current source at the far end controlled by the pot. Only two wires needed (or one if you can run it off the far end 5V supply) and as long as the wire insulation is good, the receiver gets exactly the same current, no matter how the voltage is bouncing around.

author: Fungus
author_rank: Super Contributor
timestamp: January 23, 2016, 12:43:26 pm
content: Quote from: Starlord on January 23, 2016, 12:29:49 amYou could have two separate I2C buses. One just for this.(And .... if this is likely to fail at high speed then won't the IO expander fail too?)

author: Fungus
author_rank: Super Contributor
timestamp: January 23, 2016, 12:48:26 pm
content: Quote from: Starlord on January 23, 2016, 03:32:55 amHow about a rotary encoder? That only needs two signal wires and adding capacitance is no problem (it's even a good idea, for all the reasons stated earlier).

author: Starlord
author_rank: Frequent Contributor
timestamp: January 23, 2016, 06:27:01 pm
content: The original plan was to use a rotary encoder. The issue with that though is that an encoder won't remember its position, so every time you power the board up the volume would have to default to max. I can't store the volume in EEPROM because there's a limited number of write cycles, and I can't store it on the SD card because I can't halt the audio to do a write operation.Then again, while the EEPROM is only good for 100K write cycles, if I were to say, write to it 250ms after the last volume adjustment and the user adjusted the volume 10 times a day every day (an absurd notion) then it would take some 27 years for the EEPROM to fail.But there's something to be said for a volume knob that stops when you reach max volume to you know it's at max volume. Also users may want o use their own pots.

author: Richard Crowley
author_rank: Super Contributor
timestamp: January 23, 2016, 06:53:11 pm
content: Perhaps we are all over-thinking this. If this is just a volume control, lets scale the solution to the actual design and operational requirements.If there is a ground-current-induced offset, can it simply be eliminated by firmware?If there is induced noise in the return analog signal, can it simply be filtered in hardware (capacitor) or software (averaging)?

author: Fungus
author_rank: Super Contributor
timestamp: January 23, 2016, 07:02:21 pm
content: Quote from: Starlord on January 23, 2016, 06:27:01 pmYep. It's really a non-issue. The 100k is usually very conservative. People have gone over amillion, no problem.Will they still be using your gadget 27 years from now?If you're really paranoid you can implement a simple wear-levelling algorithm. eg. Write a 16-bit counter along with your volume level. Increment the counter with every write. When the counter reaches 0xffff you move on to the next location in EEPROM and write the values there.At power-up you simply step over any location with a counter of 0xffff until you find your dataWhen you reach the end of your reserved area of EEPROM (eg. 32 entries) you wipe the area to zero and start over. If you have the whole of EEPROM to play with you should be OK for several millennia (the flash memory holding your program will probably self-erase before then).