henryhunt
Posts: 17
Joined: Sat Aug 27, 2016 11:31 am

Random values on unconnected MCP3008 channels, does chip need replacing?

Thu Aug 30, 2018 2:39 pm

I'm using only one of the 8 channels on the MCP3008 ADC chip, to read a wind direction sensor. I have noticed some odd behaviour on the other channels and just wanted to check if this is normal, or if the chip should be replaced because it could mean the channel I am using is also compromised.

After running the simpletest.py example from adafruit's own MCP3008 library, here are a few consecutive rows output when using the hardware SPI option:

| 40 | 617 | 15 | 2 | 3 | 2 | 2 | 2 |
| 28 | 605 | 14 | 2 | 2 | 2 | 2 | 1 |
| 26 | 602 | 14 | 3 | 2 | 2 | 2 | 1 |
| 28 | 596 | 14 | 2 | 2 | 2 | 2 | 1 |
| 28 | 592 | 14 | 2 | 2 | 2 | 2 | 1 |
| 28 | 593 | 14 | 2 | 2 | 2 | 2 | 1 |
| 28 | 595 | 14 | 2 | 3 | 2 | 2 | 1 |
| 29 | 588 | 14 | 2 | 2 | 2 | 2 | 2 |
| 40 | 579 | 14 | 3 | 3 | 2 | 2 | 2 |

The second channel is the only one connected to an input, but the others have random values. Also interesting is the fact that the last 5 channels with values consistently around 2 have their pins removed from the chip (done during an earlier project using the same chip). Is this something I should be worried about? Should I replace the chip? Should I be worried that the channel I am using is compromised too? Thanks.

User avatar
B.Goode
Posts: 9278
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Random values on unconnected MCP3008 channels, does chip need replacing?

Thu Aug 30, 2018 2:43 pm

Would you get more predictable results if you tied the unused inputs to a fixed logic High or Low reference point? Maybe you are simply picking up 'noise'? (Yes, tricky if you have delegged the chip... )

aBUGSworstnightmare
Posts: 1618
Joined: Tue Jun 30, 2015 1:35 pm

Re: Random values on unconnected MCP3008 channels, does chip need replacing?

Thu Aug 30, 2018 2:51 pm

An ADC with floating input will pick-up noise.

henryhunt
Posts: 17
Joined: Sat Aug 27, 2016 11:31 am

Re: Random values on unconnected MCP3008 channels, does chip need replacing?

Thu Aug 30, 2018 2:52 pm

B.Goode wrote:
Thu Aug 30, 2018 2:43 pm
Would you get more predictable results if you tied the unused inputs to a fixed logic High or Low reference point? Maybe you are simply picking up 'noise'? (Yes, tricky if you have delegged the chip... )
Would I do that by simply routing them to ground or 3.3V, or do they have to go to a GPIO pin in the RPi that is set to high or low?

Yes, noise is maybe most likely, because when I convert the ADC values from my sensor channel, they produce completely valid values. If it's just noise on the other pins then everything is fine, I was just worried that the channel I am using could be producing wrong values too as a result.

henryhunt
Posts: 17
Joined: Sat Aug 27, 2016 11:31 am

Re: Random values on unconnected MCP3008 channels, does chip need replacing?

Thu Aug 30, 2018 2:53 pm

aBUGSworstnightmare wrote:
Thu Aug 30, 2018 2:51 pm
An ADC with floating input will pick-up noise.
Ah, yes I have a feeling this is the reason and there is no actual problem. I just wasn't sure from the last time I used the chip whether the same thing happened. Thanks for confirming.

scotty101
Posts: 3803
Joined: Fri Jun 08, 2012 6:03 pm

Re: Random values on unconnected MCP3008 channels, does chip need replacing?

Thu Aug 30, 2018 4:03 pm

henryhunt wrote:
Thu Aug 30, 2018 2:52 pm
Would I do that by simply routing them to ground or 3.3V, or do they have to go to a GPIO pin in the RPi that is set to high or low?
Just tie the unused ADC channels to ground. No need to GPIO pins.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Return to “Interfacing (DSI, CSI, I2C, etc.)”