two ADCs; two uC; one pot - Page 1
Forum section: electronics / projects

author: brownt
author_rank: Regular Contributor
timestamp: July 15, 2018, 12:30:53 pm
content: Hi,I want to drive two ADCs from one pot. The ADCs are in microcontrollers in separate enclosures. But i guess there is an issue tying the rails together. How can that be done?

author: Gibson486
author_rank: Frequent Contributor
timestamp: July 15, 2018, 01:13:09 pm
content: You can do it, but do not be surprised is the counts do not match, especially since you have two 5 v rails, which, in your case, is not the best thing to do.

author: towlerg
author_rank: Contributor
timestamp: July 15, 2018, 01:27:23 pm
content: If you use a dual pot you wont need to tie anything together.

author: firewalker
author_rank: Super Contributor
timestamp: July 15, 2018, 01:32:40 pm
content: Connect only grounds. +5 volts rail doesn;t have to be tied together.Alexander.

author: Jebnor
author_rank: Regular Contributor
timestamp: July 15, 2018, 02:25:50 pm
content: It there are uC's in both units, why not make one uC do the Read then send via I2C or something to the other uC? Is there some reason that they both need to read the same value?Jeb

author: towlerg
author_rank: Contributor
timestamp: July 15, 2018, 03:06:41 pm
content: Jebnor's solution is rather more elegant, but unless the two uC's share the same supply, you still have to tie Gnd. Do you need both the uC's to read the same value? If so go with Jebnor's idea. If not using a dual pot the two will reamin isolated.

author: KrudyZ
author_rank: Frequent Contributor
timestamp: July 15, 2018, 03:18:57 pm
content: Quote from: towlerg on July 15, 2018, 03:06:41 pmIf you want to maintain isolation, you could use one pot, read it on one micro and convert it to PWM which is easy to deliver to the second micro through an opto-isolator. Most micros have HW PWMs and timers so there would be little overhead.

author: Raj
author_rank: Frequent Contributor
timestamp: July 15, 2018, 03:47:25 pm
content: I see nothing wrong,with either op's or firewalker's solution. Power can be or not be shaired but ground does need to be common.But the fact remains,if the impedience of microcontrollers is very low (like extremly low).then there's a problem,in that case, only one microcontroller should be reading the pot at a time and the other one should remain floating.Also code should be inspected multiple times to check if the pin states are set right (both should be low impedience and floating)Also,he mentions seperate enclosure...There might be noise in the lines between the enclosures.I don't see what problem he's having.

author: KrudyZ
author_rank: Frequent Contributor
timestamp: July 15, 2018, 04:59:41 pm
content: Quote from: Raj on July 15, 2018, 03:47:25 pmI can see a few things that are wrong with the original schematics.If the pot is turned all the way up then the shared wire is directly connected to the 5 V of the box on the left.A short on this wire will take down the system.Also, if the right box is not powered then its micro controller ADC input will very likely conduct through its protection diodes, possibly destroying it.Of course it is possible that the OP has designed in all kinds of safe guards that he hasn't shown us, but running internal power supply voltages out of a box to an external pot is usually not a good idea.Combine that with two independent systems trying to read the pot and you're pretty far down hacker's lane.

author: rx8pilot
author_rank: Super Contributor
timestamp: July 15, 2018, 05:04:14 pm
content: Quote from: Jebnor on July 15, 2018, 02:25:50 pmPretty sure this is the path I would vote for.

author: Raj
author_rank: Frequent Contributor
timestamp: July 15, 2018, 05:10:53 pm
content: Quote from: rx8pilot on July 15, 2018, 05:04:14 pmYeah,since it also removes the possibility of both microcontroller reading something different from each other because of line faults.i'd even suggest going all digial with a rotary incoder.

author: brownt
author_rank: Regular Contributor
timestamp: July 16, 2018, 02:35:48 am
content: Quote from: KrudyZ on July 15, 2018, 04:59:41 pmI am not having a problem, just checking before I hook it up and blow things up. The only safe guard is a 1Kohm resistor on the 5volt line leading out of both enclosures.I have hooked it up and it works ok with only one 5 volt line connected. Can you tell me about the right box potentially blowing up if it is not powered.

author: KrudyZ
author_rank: Frequent Contributor
timestamp: July 16, 2018, 03:51:55 am
content: Your schematics shows the pot being hooked up directly between 5 V and ground.When the pot is turned all the way up the wiper would be connected to the 5V without any current limiting.If the right box is not powered, then you would have 5 V hooked up to the ADC input and since the micro is not powered current would flow through the ADC pin into the unpowered 5 V rail of the micro.Depending on the load on that line you could have too much current flowing there and kill the part.Of course, you should have ESD protection and current limits on everything entering and exiting the boxes.However your (simplified?) schematics didn't show any of that...

author: brownt
author_rank: Regular Contributor
timestamp: July 16, 2018, 06:16:57 am
content: I See. So, will 1Kohm limiting to 5mA be enough to prevent the un-powered micro from cooking?ESD protection. Is that the vcc to wiper to gnd Schottkey diode pair arrangement?

author: KrudyZ
author_rank: Frequent Contributor
timestamp: July 16, 2018, 02:57:57 pm
content: Quote from: brownt on July 16, 2018, 06:16:57 amThat's one way of doing it. However it relies on the 5V rail which means you can still power the second box inadvertently from the outside.Also if the right box is not powered then the wiper would be loaded by the Schottky to the (unpowered) 5V line of the right box, so the left box would not get correct readings either.I would really recommend using only one micro to read the pot and have it transmit its readings to the other via on opto-isolator (PWM or UART link).

author: KL27x
author_rank: Super Contributor
timestamp: July 16, 2018, 10:27:32 pm
content: You guys is all nuts with the overcomplicated solutions.First off, does it have to be 10K pot? If you can make it lower in value, you can easily get an accurate reading from both micro. You can even add a cap between wiper and ground and put a small value resistor between this and each micro ADC to reduce any voltage variation if/when both ADC caps are recharging at the same time.Even if you can't go lower on the pot, F it. It's still probably good enough for most applications. You can get consistent readings anyway, by taking averages, if time constraint isn't an issue, and any offset on the lower values might not even matter for your app. And can be tuned, if it does matter. If it does matter, you often end up tuning things, anyway.

author: KrudyZ
author_rank: Frequent Contributor
timestamp: July 17, 2018, 02:52:55 am
content: Quote from: KL27x on July 16, 2018, 10:27:32 pmVery much depends on what the application is, don't you think?If it's a toy, go ahead and wire it up any way you like.If this goes into an industrial setting, then you better do it right.Maybe the OP should let us know a bit more about the application, e.g. how far apart are these boxes?

author: b_force
author_rank: Super Contributor
timestamp: July 17, 2018, 11:24:39 am
content: Quote from: KL27x on July 16, 2018, 10:27:32 pmWhy on earth would a 10k pot less accurate?It will only give some more noise. But with a 10k that's way beyond the accuracy of a standard microcontroller.What I personally would do is to use a dual opamp to buffer, althoug some series resistors would also probably work just fine.

author: brownt
author_rank: Regular Contributor
timestamp: July 17, 2018, 10:11:47 pm
content: Is there a problem with doing this for multiple uC. Say, one pot to four uC's?What would happen if the 5volt rails on both enclosures 'were' wired together?

author: towlerg
author_rank: Contributor
timestamp: July 17, 2018, 11:18:13 pm
content: IMHO the risk vs reward makes no sense. The uC with the should send vales measured via some serial link, my favorite would be, the uC with the pot as SPI master, all the others SPI slave.

author: KL27x
author_rank: Super Contributor
timestamp: July 17, 2018, 11:41:04 pm
content: QuoteADC's specify a maximum impedance of the signal. This varies by part and by frequency/speed. It really depends on the brevity of the sampling window, in case it is adjustable (as it might be on a micro). Most ADC are fine at 10K signal impedance in any scenario.PIC micro ADC, for instance, have specified maximum impedance of 20K, IRC.The only fundamental issue you (might) even need to take into consideration (power issue is IMO is just standard fare/issue; normal details) when hooking up two ADC to a single pot is that the ADC cap of each micro may be "opening up for business" after the last read/timed-discharge at the same time. There's a certain impedance of the signal coming out of the pot, and it may not be fast enough to fill both caps before the respective ADC's assume the cap is done charging. So the maximum impedance value that is listed for the micro should be derated. Else you may get a sporadic low reading in this event (not increase noise). Kind of like quantum physics, the act of measuring the signal will affect the signal. While being sampled, the signal will sag. The higher the impedance (in this case, the higher the value of the pot), the more sag you will get. Two measurements at once takes more juice to avoid clipping the reading.QuoteYes, theoretically. But no, not really.QuoteThis is a pot. With variation in itself. Turned by a human. To make something happen. As long as you get the range and resolution you need and the result is consistent, the rest is just details. You have to keep things in perspective. But if you wanted the shortest sampling time and immunity to noise, and to remove as much offset as possible, you should maybe consider putting a voltage follower on the output of the pot. An amp with a gain of 1, or whatnot. A buffer. If the two micros should agree on a single value for w/e reason, then yeah, best to have the reading done by one micro and shared with the other. But devoid of that reason, there's no reason to rig up I2C bus just do to this.When someone asks simple question like this with noobish schematic, 20 people want to give him specific solutions to problems they are only guessing at and which were never asked. Firewalker nailed it. You need a common ground. Done. I2C bus? Rotary encoders? Why not cover the fundamental issue at hand and let him figure out what, if anything, else he needs from there? If he had an I2C bus already in place, then he would already know how to share a couple bytes between micros. It's obvious he doesn't. He doesn't even have a common ground. Not all micro's even have I2C port. Maybe he should simply bit bang his own I2C instead of connecting a ground rail?