Author Topic: two ADCs; two uC; one pot  (Read 2439 times)

0 Members and 1 Guest are viewing this topic.

Offline browntTopic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: au
two ADCs; two uC; one pot
« on: July 15, 2018, 12:30:53 pm »
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?
 

Offline Gibson486

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #1 on: July 15, 2018, 01:13:09 pm »
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.
« Last Edit: July 15, 2018, 01:16:03 pm by Gibson486 »
 

Offline towlerg

  • Contributor
  • Posts: 39
Re: two ADCs; two uC; one pot
« Reply #2 on: July 15, 2018, 01:27:23 pm »
If you use a dual pot you wont need to tie anything together.
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2450
  • Country: gr
Re: two ADCs; two uC; one pot
« Reply #3 on: July 15, 2018, 01:32:40 pm »
Connect only grounds. +5 volts rail doesn;t have to be tied together.



Alexander.
« Last Edit: July 15, 2018, 01:35:03 pm by firewalker »
Become a realist, stay a dreamer.

 

Offline Jebnor

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ca
  • Absolutely! Yes, kind of, sort of, not really, no.
Re: two ADCs; two uC; one pot
« Reply #4 on: July 15, 2018, 02:25:50 pm »
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
Before this, there was a typo.
 

Offline towlerg

  • Contributor
  • Posts: 39
Re: two ADCs; two uC; one pot
« Reply #5 on: July 15, 2018, 03:06:41 pm »
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.
 

Offline KrudyZ

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #6 on: July 15, 2018, 03:18:57 pm »
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.
If 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.
 

Offline Raj

  • Frequent Contributor
  • **
  • Posts: 694
  • Country: in
  • Self taught, experimenter, noob(ish)
Re: two ADCs; two uC; one pot
« Reply #7 on: July 15, 2018, 03:47:25 pm »
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.

« Last Edit: July 15, 2018, 03:52:39 pm by Raj »
 

Offline KrudyZ

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #8 on: July 15, 2018, 04:59:41 pm »
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.

I 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.
 

Offline rx8pilot

  • Super Contributor
  • ***
  • Posts: 3634
  • Country: us
  • If you want more money, be more valuable.
Re: two ADCs; two uC; one pot
« Reply #9 on: July 15, 2018, 05:04:14 pm »
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

Pretty sure this is the path I would vote for.
Factory400 - the worlds smallest factory. https://www.youtube.com/c/Factory400
 

Offline Raj

  • Frequent Contributor
  • **
  • Posts: 694
  • Country: in
  • Self taught, experimenter, noob(ish)
Re: two ADCs; two uC; one pot
« Reply #10 on: July 15, 2018, 05:10:53 pm »
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

Pretty sure this is the path I would vote for.

Yeah,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.
 

Offline browntTopic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: au
Re: two ADCs; two uC; one pot
« Reply #11 on: July 16, 2018, 02:35:48 am »
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.

I 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.

I 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.
 

Offline KrudyZ

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #12 on: July 16, 2018, 03:51:55 am »
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...
 

Offline browntTopic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: au
Re: two ADCs; two uC; one pot
« Reply #13 on: July 16, 2018, 06:16:57 am »
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?
 

Offline KrudyZ

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #14 on: July 16, 2018, 02:57:57 pm »
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?

That'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).
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #15 on: July 16, 2018, 10:27:32 pm »
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.
 

Offline KrudyZ

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #16 on: July 17, 2018, 02:52:55 am »
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.

Very 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?
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: two ADCs; two uC; one pot
« Reply #17 on: July 17, 2018, 11:24:39 am »
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.
Why 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.

Offline browntTopic starter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: au
Re: two ADCs; two uC; one pot
« Reply #18 on: July 17, 2018, 10:11:47 pm »
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?

 

Offline towlerg

  • Contributor
  • Posts: 39
Re: two ADCs; two uC; one pot
« Reply #19 on: July 17, 2018, 11:18:13 pm »
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.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: two ADCs; two uC; one pot
« Reply #20 on: July 17, 2018, 11:41:04 pm »
Quote
Why on earth would a 10k pot less accurate?
It will only give some more noise.
ADC'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.

Quote
Very much depends on what the application is, don't you think?
Yes, theoretically. But no, not really.
Quote
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.
This 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?
« Last Edit: July 18, 2018, 05:14:07 am by KL27x »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf