Page 1 of 1

Accessing analog input on D1 mini through EspEasy

Posted: 21 Apr 2021, 21:15
by pisabe;;
Here is a newbie question.

I flashed a D1 mini using a ready-made config from the Esp_Easy community (ESP_Easy_mega_20200913_test_ESP8266_4M1M_VCC.bin) . I was then able to successfully implement a few different tasks (monitoring contact inputs, triggering relays).

I am currently trying to get acquainted with the analog input, in view of implementing a voltmeter of my own. I defined a new task in Esp_Easy based on the "Analog input - internal" device. When I enable that task using only the default values in the task definition, my understanding is that the task should be reporting values ranging from 0 to 1023 on pin A0 of the D1. However, the value reported by the task remains stubbornly fixed at 65535, regardless of whether I connect A0 with: 1) nothing; 2) the GND pin; or 3) the 3.3V pin.

Why I am getting that particular value and what is missing in order to read changing values?

Many thanks in advance.

Re: Accessing analog input on D1 mini through EspEasy

Posted: 21 Apr 2021, 22:48
by TD-er
When you want to use the analog input on pin A0, you should NOT use the "VCC" build.
With the "VCC" builds you measure the voltage on the 3V3 pin, so you can essentially measure the power supply (useful for battery powered ESPs)

When measuring an external voltage, you should use the builds without "VCC" in the name.
Most boards include 2 resistors to extend the range to 3.3V (some 3.6V)
The ESP itself has a range of 0...1V
So you may want to add some resistors if you want to measure higher voltages. Just keep in mind you need to have the same GND level on the voltage you want to measure and the ESP.

Re: Accessing analog input on D1 mini through EspEasy

Posted: 22 Apr 2021, 00:22
by pisabe;;
Thanks a lot for the tip!
Can I simply overwrite the VCC version by flashing a different one over it, e.g. "ESP_Easy_mega_20200913_normal_esp8266_4M1M.bin"?
Many thanks again.

Re: Accessing analog input on D1 mini through EspEasy

Posted: 22 Apr 2021, 00:36
by TD-er
Yep you can.
Just as long as you keep the same flash layout (4M1M means 4M flash, with 1M file system) you can move between builds without a lot of issues.

Re: Accessing analog input on D1 mini through EspEasy

Posted: 23 Apr 2021, 16:29
by pisabe;;
OK, problem resolved! I was able to reflash my D1 mini with the "normal" image and my analog input is now working fine. Many thanks.

Re: Accessing analog input on D1 mini through EspEasy

Posted: 23 Apr 2021, 16:31
by TD-er
You're welcome.