{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/2070","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/2070/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/2070/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/2070/events","html_url":"https://github.com/esp8266/Arduino/issues/2070","id":157486912,"number":2070,"title":"Fluctuating ADC with stabilized source","user":{"login":"supersjimmie","id":16191439,"avatar_url":"https://avatars.githubusercontent.com/u/16191439?v=3","gravatar_id":"","url":"https://api.github.com/users/supersjimmie","html_url":"https://github.com/supersjimmie","followers_url":"https://api.github.com/users/supersjimmie/followers","following_url":"https://api.github.com/users/supersjimmie/following{/other_user}","gists_url":"https://api.github.com/users/supersjimmie/gists{/gist_id}","starred_url":"https://api.github.com/users/supersjimmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/supersjimmie/subscriptions","organizations_url":"https://api.github.com/users/supersjimmie/orgs","repos_url":"https://api.github.com/users/supersjimmie/repos","events_url":"https://api.github.com/users/supersjimmie/events{/privacy}","received_events_url":"https://api.github.com/users/supersjimmie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/esp8266/Arduino/labels/type:%20troubleshooting","name":"type: troubleshooting","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":68,"created_at":"2016-05-30T11:44:00Z","updated_at":"2016-08-17T16:09:41Z","closed_at":null,"body":"I supply the ADC with a stable voltage, supplied by a separate LM1117 3.3V with 100uF capacitor a resistor voltage divider. The LM1117 will provide 3.3V regardless of the load of the ESP's own voltage regulator, the capacitor takes away any noise and the 2 resistors make a fixed voltage suitable to be read by the ADC.\r\n(GND for both the ESP and the LM1117 are connected)\r\n\r\nThen, based on this article, I tried to add more stability to the readings:\r\nhttps://www.quora.com/Why-is-a-little-delay-needed-after-analogRead-in-Arduino\r\nSo I do subsequent readings and only use the last one. I even do it 3 times instead of 2, and then only use the last one because that one is supposed to be stable.\r\n```\r\n#define ANALOGPIN A0;\r\n...\r\nanalog = analogRead(ANALOGPIN);\r\ndelay(1);\r\nanalog = analogRead(ANALOGPIN);\r\nanalog = analogRead(ANALOGPIN);\r\nSerial.print(F(\"Stablized Analog pin: \"));\r\nSerial.println(analog);\r\n```\r\nReadings are done and stored every minute.\r\n\r\nThe ADC reading has 2 fluctuations, a slow drift and spikes.\r\nThis show the ADC output:\r\n![analogRead fluctuations](http://i64.tinypic.com/333wfb4.jpg)\r\n\r\nThis has been tested with the mentioned 'external' 3.3V regulator and with the 3.3V output from the ESP itself.  I also tried with or without the subsequent readings.  I don't really mind the spikes because I can add some code to flatten those, but the \"long\" wave-like fluctuation makes it all useless.\r\n\r\n(I need this to read an MQ135 sensor.)\r\n\r\nUsing current core stable and Arduino IDE 1.6.9.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/34698122-fluctuating-adc-with-stabilized-source?utm_campaign=plugin&utm_content=tracker%2F14245935&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F14245935&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/240462279","html_url":"https://github.com/esp8266/Arduino/issues/2070#issuecomment-240462279","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/2070","id":240462279,"user":{"login":"supersjimmie","id":16191439,"avatar_url":"https://avatars.githubusercontent.com/u/16191439?v=3","gravatar_id":"","url":"https://api.github.com/users/supersjimmie","html_url":"https://github.com/supersjimmie","followers_url":"https://api.github.com/users/supersjimmie/followers","following_url":"https://api.github.com/users/supersjimmie/following{/other_user}","gists_url":"https://api.github.com/users/supersjimmie/gists{/gist_id}","starred_url":"https://api.github.com/users/supersjimmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/supersjimmie/subscriptions","organizations_url":"https://api.github.com/users/supersjimmie/orgs","repos_url":"https://api.github.com/users/supersjimmie/repos","events_url":"https://api.github.com/users/supersjimmie/events{/privacy}","received_events_url":"https://api.github.com/users/supersjimmie/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T16:09:41Z","updated_at":"2016-08-17T16:09:41Z","body":"In the code that I am using, there is nothing sending or receiving over wifi.\r\nSo unless there is something hidden built-in, there are no transmissions..."}}
{"actor":{"display_login":"supersjimmie"}}