{"action":"created","issue":{"url":"https://api.github.com/repos/pgmmpk/beaglebone_pru_adc/issues/8","labels_url":"https://api.github.com/repos/pgmmpk/beaglebone_pru_adc/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/pgmmpk/beaglebone_pru_adc/issues/8/comments","events_url":"https://api.github.com/repos/pgmmpk/beaglebone_pru_adc/issues/8/events","html_url":"https://github.com/pgmmpk/beaglebone_pru_adc/issues/8","id":106344003,"number":8,"title":"Wrong readings and pins influenced by others","user":{"login":"miguel-ribeiro","id":6084480,"avatar_url":"https://avatars.githubusercontent.com/u/6084480?v=3","gravatar_id":"","url":"https://api.github.com/users/miguel-ribeiro","html_url":"https://github.com/miguel-ribeiro","followers_url":"https://api.github.com/users/miguel-ribeiro/followers","following_url":"https://api.github.com/users/miguel-ribeiro/following{/other_user}","gists_url":"https://api.github.com/users/miguel-ribeiro/gists{/gist_id}","starred_url":"https://api.github.com/users/miguel-ribeiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguel-ribeiro/subscriptions","organizations_url":"https://api.github.com/users/miguel-ribeiro/orgs","repos_url":"https://api.github.com/users/miguel-ribeiro/repos","events_url":"https://api.github.com/users/miguel-ribeiro/events{/privacy}","received_events_url":"https://api.github.com/users/miguel-ribeiro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-14T13:45:36Z","updated_at":"2015-09-14T17:02:13Z","closed_at":null,"body":"Hi, I've been doing some tests and some of the values seem to be influenced by other pins values.\r\nI used a 0.9V source obtained from a simple voltage divider from the 1.8V VDD_ADC and GNDA_ADC. (10 kΩ resistors were used).\r\n\r\n-When I connect the 0.9V to AIN3, and leave the rest disconnected, AIN3 reads 1.02 oscilating (Picture 1):\r\n            -Then if I connect 0.9V to AIN0, both AIN0 and AIN3 get 0.89V\r\n            -If I connect GNDA_ADC to AIN0: AIN0 reads 0 and AIN3 reads 0.75\r\n            -If I connect VDD_ADC to AIN0: AIN0 reads 0 and AIN3 reads 1.05 constant(like in the first case, but more constant)\r\n\r\nI tested with more pins always obtaining similar results, \r\nEXCEPT for pin AIN0, which when it's the only one connected, it reads the correct value of 0.9V.\r\n\r\nI tested all the pins with GNDA_ADC to make sure I was looking at the correct pin.\r\n\r\nWhen I do the same with Adafruit_BBIO for adc, the values are always constant regardless of the other inputs as shown in picture 2.\r\n\r\nI really need the high sampling rate of this library compared to the Adafruit_BBIO, where I'm only getting around 250Hz (seems low to me).\r\nCan you fix this error, or point me to another library that provides high sampling rates ? I need at least 3000Hz.\r\n\r\nI have tested using both the usb connection and the power suply and solely with usb connection.\r\n\r\nCode:\r\n##############################  pru_adc  ############################\r\nimport beaglebone_pru_adc as adc\r\nimport time\r\n\r\nconstant = 1.8 / 4095.0\r\ncapture = adc.Capture()             \t\t\t\t\t# Clamp voltage\r\ncapture.start()\r\nwhile(True):\r\n    v_list = [\"{0:.4f}\".format(item * constant) for item in capture.values]    #just creates a list with the values from the pins\r\n    del v_list[7]\r\n    print v_list\r\n    time.sleep(0.00001)\r\ncapture.stop()\r\ncapture.wait()\r\ncapture.close()\r\n\r\n##############################  Adafruit_BBIO  ############################\r\n#!/usr/bin/python\r\nimport time\r\nimport Adafruit_BBIO.ADC as ADC\r\n\r\nconstant = 1.8 / 4095.0\r\nnumsamples = 4000\r\n\r\npins = [\"AIN0\", \"AIN1\", \"AIN2\", \"AIN3\", \"AIN4\", \"AIN5\", \"AIN6\"]\r\nADC.setup()\r\nwhile(True):\r\n    valList = [\"{0:.4f}\".format(ADC.read(pin) * 1.8) for pin in pins]         #just creates a list with the values from the pins\r\n    print valList\r\n\r\n        \r\nPictures:\r\n1\r\n![1](https://cloud.githubusercontent.com/assets/6084480/9851031/93491de4-5aee-11e5-8d46-04ba29ae2bef.jpg)\r\n\r\n2\r\n![2](https://cloud.githubusercontent.com/assets/6084480/9851250/9679d4d0-5aef-11e5-8c0c-31617055c812.jpg)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pgmmpk/beaglebone_pru_adc/issues/comments/140144878","html_url":"https://github.com/pgmmpk/beaglebone_pru_adc/issues/8#issuecomment-140144878","issue_url":"https://api.github.com/repos/pgmmpk/beaglebone_pru_adc/issues/8","id":140144878,"user":{"login":"pgmmpk","id":569458,"avatar_url":"https://avatars.githubusercontent.com/u/569458?v=3","gravatar_id":"","url":"https://api.github.com/users/pgmmpk","html_url":"https://github.com/pgmmpk","followers_url":"https://api.github.com/users/pgmmpk/followers","following_url":"https://api.github.com/users/pgmmpk/following{/other_user}","gists_url":"https://api.github.com/users/pgmmpk/gists{/gist_id}","starred_url":"https://api.github.com/users/pgmmpk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgmmpk/subscriptions","organizations_url":"https://api.github.com/users/pgmmpk/orgs","repos_url":"https://api.github.com/users/pgmmpk/repos","events_url":"https://api.github.com/users/pgmmpk/events{/privacy}","received_events_url":"https://api.github.com/users/pgmmpk/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T17:02:13Z","updated_at":"2015-09-14T17:02:13Z","body":"Thanks for checking 200 Ohm divider.\n\nDoes the following correctly summarizes the observations?\n\n1. When using 100k+100k divider, AIN3 reading as returned by pru_adc\ndepends on AIN0 and varies between 0.75 and 1.0. While Adafruit library\ndoes not show this interference.\n\n2. When using 0.2k+0.2k divider, AIN3 reading is stable and pru_adc returns\nsame (or very similar) results as Adafruit.\n\nI will need to analyze (again) what Adafruit is doing differently.\n\nAdditionally, I may need to return to my prior experiment that showed that\n10k can not pull ADC input all the way down or up - and check if the same\neffect is seen with Adafruit. Just to have an extra bit of information.\n\n\nOn Mon, Sep 14, 2015 at 12:47 PM, miguel-ribeiro <notifications@github.com>\nwrote:\n\n> The value read y the multimeter is also 0.9 equal do adafruit one.\n>\n> I tried with 200 Ohm and the 0.9V value is correct (and so it is with 100K\n> except for AIN4 which is influenced by AIN3).\n>\n> But at this stage of the project it's no longer possible to change the\n> resistors.\n>\n> Do you know what could possibly be causing this ? and how does adafruit\n> manages to compensate the final value ?\n>\n> Thank you for the attention\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/pgmmpk/beaglebone_pru_adc/issues/8#issuecomment-140141455>\n> .\n>\n"}}