About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

ADC strange behaviour

1537 Views - Created 05/02/2017

05/02/2017

Posted by:
MhicAoidh

Users Avatar

OK, I'm using six ADC  channels on an ExpanderPi to measure four voltage levels via resistor dividers and two currents using ACS712 sensors.

Each channel works individually, both with a known source voltage and the real input.  I've checked all 8 channels on the ADC and all works fine.

However.  For some reason, they don't work together in certain combinations that use adjacent pins.  For example, inputs connected to:

pins 1, 3, 5, 7 or 2, 4, 6, 8 works

pins 1 & 2 doesn't work.

pins 2 & 3 works.

pins 2, 3 & 4 doesn't work.

When it fails, the symptoms are consistent.  For example, with an actual voltage of about 2.4V measured at the pin, pin X reports 0V, pinX+1 reports ~0.6V, and pinX+2 reports the correct value.  Disconnect X+2, or move it to X+3, and everything reads correctly.  

What on earth is going on?  Could this be an impedance issue? 

05/02/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

The problem could be that the ADC is set in the wrong mode.  The ADC used on the expander pi can be used as 8 single ended inputs or differential pairs with pins 1 and 2, 3 and 4, 5 and 6 and 7 and 8 making up the four differential inputs.  If the ADC has been set to be in differential mode then it would be trying to measure the difference between the input pins instead of measuring relative to ground which would explain the problem you are having.

Are you using our python library for reading from the ADC?  If so then you should be able to set the inputs to single ended mode by using read_adc_voltage(channel, 0).  The second parameter on the read_adc_voltage function sets the mode for the inputs with 0 being single ended and 1 being differential.  Setting the parameter to 0 should hopefully solve the problem.

AB Electronics UK Tech Support

06/02/2017

Posted by:
MhicAoidh

Users Avatar

Yes that would certainly explain it.  The version of the python(3) libraries I was using doesn't seem to support the set single/double-ended mode setting, so I downloaded the new version  and now it bombs out when it tries to setup the GPIO ports.  I get the following runtime error in file ABE_ExpanderPi.py, line 259, in set_pin_direction:

AttributeError: 'IO' object has no attribute 'address'

??

 

06/02/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Sorry about the bugs.  I have uploaded a new version of the library to github which should be working.  I tested the ADC inputs using the demo-adcread.py script and it appears to be reading the inputs correctly in single ended mode.

AB Electronics UK Tech Support

07/02/2017

Posted by:
MhicAoidh

Users Avatar

No, sorry, same error but in line 265 this time.  Am I doing something wrong?

07/02/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Sorry there was still a bug with the IO functions.  Can you try downloading the updated version

AB Electronics UK Tech Support

07/02/2017

Posted by:
MhicAoidh

Users Avatar

Yes!  It works, thank you. That's got to be the fastest tech support in history.

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.