Accessing analog input on D1 mini through EspEasy

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
pisabe;;
Normal user
Posts: 21
Joined: 21 Apr 2021, 20:50

Accessing analog input on D1 mini through EspEasy

#1 Post by pisabe;; » 21 Apr 2021, 21:15

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.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Accessing analog input on D1 mini through EspEasy

#2 Post by TD-er » 21 Apr 2021, 22:48

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.

pisabe;;
Normal user
Posts: 21
Joined: 21 Apr 2021, 20:50

Re: Accessing analog input on D1 mini through EspEasy

#3 Post by pisabe;; » 22 Apr 2021, 00:22

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.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Accessing analog input on D1 mini through EspEasy

#4 Post by TD-er » 22 Apr 2021, 00:36

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.

pisabe;;
Normal user
Posts: 21
Joined: 21 Apr 2021, 20:50

Re: Accessing analog input on D1 mini through EspEasy

#5 Post by pisabe;; » 23 Apr 2021, 16:29

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.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Accessing analog input on D1 mini through EspEasy

#6 Post by TD-er » 23 Apr 2021, 16:31

You're welcome.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 17 guests