NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » multiple sensors on each adc pin???

October 19, 2014
by escartiz
escartiz's Avatar

Hi everyone, I had this idea last night of connecting multiple sensors and read their different values through the same pin. I have done other projects reading up to 6 with each adc and I was wondering if I could connect more to each pin, and maybe switch mosfets to sense multiple sensors on the same adc port, I don't need to read all of them at once so maybe a loop that could read one at a time, send is id to the lcd and value that way I could know which pin and which sensor it is. I would rather try to accomplish this with a single chip although I did the led array a few years ago and I having a master and multiple slaves could work. What do you guys suggest would be the best approach? I am trying to read about 36 different sensors so 6 per each adc at least.

October 19, 2014
by sask55
sask55's Avatar

If you where looking to read digital signal data then TTL data selection chips like the 74150,74151 or 74153 could be considered to select the sensors that you wish to read. I have some experience using these chips.

The fact that you wish to select and then read analog signals requires a different multiplexing chip (MUX) designed to pass analog data. Judging from a quick search on line there appears to be quite a number of such ships available. The HCC or HCF 4529B look like they would likely do the trick, although I have no experience using them. I see a number of 8 channel analog MUX chips available a 16 or 32 channel chip may be available.

When using an 8 channel MUX chips you would require a minimum of 5 chips to read from your 36 sensors. That configuration would allow a maximum of 40 sensors on 5 ACD pins. Using the 4529B, each of the MUX chips would require 4 bits to address or select the desired sensor. It would likely be possible to address all 5 chips using just 4 output pins on the micro. Keeping in mind that when a selection is made all the MUX chips will be changing at the same time which may limit your multiple sensor selection capability somewhat. You would be selecting predetermined groups of sensors rather then individual sensors. I think you could possibly double (tandem) MUX your incoming sensor data and conceivably input all your sensors unto as little as one ADC pin if you wished.

With analog signals there will always be consideration of introducing noise, signal loss, and losing linearity on the original signal. I don’t know what level of resolution you wish to maintain but the more you handle the signal before the ADC reads it the greater the chances it will be degraded.

Perhaps someone else has a better idea and more experience MUXing analog signals.

October 21, 2014
by JimFrederickson
JimFrederickson's Avatar

Personally, I would just use Multiple AVR CPU's that communicate VIA some digital method. (SPI Serial is often easiest, but other means are good as well.)

This would give you the added flexibility of being able to average the results and throw out any that seem out of range.

You could also configure alarms to alert the primary cpu if specific condition.

Trying to read too many ADC Sensors from a single pin can produce inaccuracies and conflicts.

The best way to do this with multiple AVR CPU's is to have an ISP Programmer that the program the internal fuses.

Configure the AVR CPU's that will read the ADC Data to use the Internal 8mhz Clock as it's system clock. So that no external crystal will be available.

For communications use the following pins:

 Data Out  (Common between all AVR ADC Slaves)  
 Data In   (Common between all AVR ADC Slaves)   
 Data Clock  (Common between all AVR ADC Slaves)  
 Alert Signal  
 Chip Select

That would be my suggestion.

October 22, 2014
by sask55
sask55's Avatar

Here is a completely different thought that I might consider if I was attempting to read that many sensors. I don’t know the nature of what the sensors are reading temperature, pressure, photo intensity or whatever so this idea may not be practical. Also the physical distances involved would have an influence on what I would likely attempt to do. I don’t know if you have acquired all the necessary sensors and may not wish to start over at this point.

There is an inherent issue using analog signals to transmit information from the sensors to the reading hardware. Your ADC hardware whether it is one or multiple CPU’s will be reading voltage levels on the incoming data lines and using that level as a indication of the sensor readings. A number of possible things could degrade the signal as it is carried between the sensors and the reading hardware. RF noise, crosstalk between signals, signal loss (voltage lose do to resistance) may degrade the signal and make the reads less stable and somewhat inaccurate. Theses possible effects could be minimized by using shielded conductors and or taking care running the data lines.

Ideally it would be advantages to send the signals in digital format. With digital small voltage level changes on the transition lines would be ignored do to the two state nature of reading digital. You could be confident that the reading you are receiving at the CPU is exactly the reading sent from each sensor.

If the sensors you require are available in the Dallas 1 wire system such as temp or pressure that is where I would be going. You could easily connect well over one hundred sensors using as little as one input wire plus a ground conductor. This may greatly simplify connecting the sensors by reducing the number of sensor wires. With the digital 1 wire system you can be confident that the values read will be accurate to the resolution of the sensors. All the sensors could be read, the information recorded or displayed every few seconds if you wished. Any alarms or notifications could be programmed into the system to alert you of readings that are of interest,according to any criteria that you have set up in your programming.

My experience with the 1 wire system is limited to a grain bin temperature monitoring system that I am using. We have well over one hundred sensors on each of two cables and it works very well. The readings are more consistent and faster then the analog system we have.

I have noticed 1 wire sensors are very economical to buy and would be easy to connect and work with on the sensor end of the system. On the other hand reading from a set of multiple sensors proved to be a bit much for my programming skills. There is a lot of very critical timing that has to be done to receive and identify each incoming reading. Fortunately all the require programming is available in open source code, and would require only a bit of modification to be adapted to your needs. With the addition of some additional hardware and the open source code I believe you could build a very robust, accurate and functionally powerful system.

If you wish to get a better handle on the Dallas one wire approach Noter has some interesting information posted here

Just another idea.

October 22, 2014
by BobaMosfet
BobaMosfet's Avatar

I recommend using 3 of these CD74HC4067

You might also need a (12 or 16 pin) shift register, as an easy way to control your index. Essentially, because you're looking at analog inputs, you can't use digital chips that require minimum levels of voltage to recognize high .v. low.

Using the above setup, you can use a single ADC, a shift register to control 9 index pins (3 on each mux/demux) to select which input you want signal from. This would allow you to control the entire thing with 2 pins. One for the ADC, and one for the shift-register (index).

Atleast that's my suggestion, and it would allow you up to 48 inputs.

BM

October 22, 2014
by BobaMosfet
BobaMosfet's Avatar

Be aware, that this is set up like branches of a tree (that I've described). As such, power coming down one signal line from one sensor, will (because there is nothing to prevent it), travel back "up" any other branch towards other sensors.

If the outputs on those sensors are high-impedance, you have nothing to worry about. If not, you will have to use a signal diode with the lowest possible knee, and then allow for that range/calc change in our input from that sensor.

BM

November 11, 2014
by escartiz
escartiz's Avatar

thanks for all the suggestions, I have been playing with all of them with mixed results, Using the CD74HC4067 has been simple and allows me to read lots of voltage inputs with a single atmega. using multiple nerdkits seem to be working somewhat fine but I keep getting crazy values all of the sudden, I blamed it on my test boards and loose wiring. I am going to solder some of the connections to make it more stable. I notice using longer wires to the sensors also trows different results due to the noise and/or resistance I guess or been the analog signal. I am wondering if there is a way to isolate grounds somehow and perhaps this will minimize it. Also looking and learning between digital and analog signals. Ill keep playing with this. thanks again

November 11, 2014
by BobaMosfet
BobaMosfet's Avatar

@escartiz:

Try using a very, very weak (like 100K-Ohm) pull-down resistor on the signal line you're having a problem with (or all of them), and see if that helps get rid of some of the noise.

BM

November 12, 2014
by sask55
sask55's Avatar

You likely have this incorporated into your system now. With analog voltage level based signals read by the ADC on the micros, it would be important to have signal averaging built into the software. longer read times that average larger number of individual reads would likely help reduce the effects of random noise from the transition lines.

Shielded cables to the sensors should help.

If you are intending on using multiple micros connected in a master/slave set up then, depending on the actual distances to the individual sensors, you may have better luck moving slave chips out to remote locations near groups of sensors. SPI signals, or other digital communication signals, between micros would be far more immune to interferences and noise then the analog signals from the sensors would be. This approach could possibly reduce the sheer volume of wires required to get the data from all sensors back to one micro to be recorded or displayed.

In my limited experience, using Dellas one wire digital (if available) would be far more robust and wiring the sensors is dead simple. Distances up to several hundred feet would be irrelevant. One two conductor cable can handle more then a hundred sensors that are all wired in parallel. I think for a long term practical and dependable setup it may be worth the effort to take a look at digital sensors if you can get them.

Darryl

November 12, 2014
by BobaMosfet
BobaMosfet's Avatar

You can also twist the unshielded wires, particularly if you have atleast 2 going to a sensor or destination.

BM

Post a Reply

Please log in to post a reply.

Did you know that the printf format string "%.3f" will show three digits after the decimal point? Learn more...