Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By trackerj
#22754
martinayotte wrote:If you wish to hook up external ADC, yes there are SPI ones such as MCP3008, but you can also use I2C ones such as MCP3021 which would be even more easier, and those ones are really small SOT-23.


I can confirm that MCP3421 is also a nice cheap I2C ADC, upto 18 Bit resolution.

For a general view and a simple driver implementation you can take a look at ESP8266 - MCP3421 ADC Article.

Example code is in LUA but is pretty trivial to translate basic ADC_Write and ADC_Read functions in Arduino IDE. If you have difficulties with I will be more than happy to help you.
User avatar
By Iisfaq
#22808
alonewolfx2 wrote:you need to disconnect wifi for stable adc reading and you can reconnect after reading. its chip related not arduino ide


Not according to the following on GitHub

https://github.com/esp8266/Arduino/issues/513

Your analog patch is the old way. In the development .json you receive the development version of the core, with a completely rewritten analog section and new Apu for correctly measure A0 or Vdd voltage.

It is solved also the wifi disconnection problem


Chris
User avatar
By PyB
#35221 Hi,

I'm having the same problem.

My ESP is configured as a SoftAP and I have 1 or 2 clients connected to it. The boards sends UDP packets every 1s with an analog value read from the ADC.

I'm using the Arduino version of the environnment with esp_iot_sdk_1.3.0_15_08_08.

When I comment the analogRead, everyting is working fine. When the analogRead is active, the Wi-Fi connection drops and the AP is not visible anymore as mentioned earlier in the thread.

Is it really such that we cannot do ADC & WiFi at the same time - is there any kind of workaround possible.
I cannot disconnect and reconnect as my client do not have an 'auto reconnect' feature...

Any help is appreciated.
Thks,
PyB
User avatar
By PyB
#35335 Quick update.

I was able to get the thing working, but still it is a bit weird.

What I did, is adding a huge delay - 10s - between setting the AP mode and doing the first analog read...

By doing that, I was able to get the thing up & running.

I have done tests with SDK 1.3.0, 1.4.0 and that does not change anything.

Is there any recommendation as to leave some 'time' for Wi-Fi to setup before anything else can be done ?

PyB