measuring voltage programmatically on esp8266 esp-12 without using analog pin

I have found some articles on how to programmatically measure voltage on the analog pin. However, there is only one analog pin on the esp8266 esp-12 and I need it for something else. Is there a way to achieve this without the analog pin? For example, can I make a circuit on the digital pins that can do this?

There are a number of external ADC chips. Either SPI or I2C, with various performance characteristics, numbers of channels etc. E.g. MCP3002 which I used in this ESP8266 project: Esp8266 Arduino Telephone Caller ID system with anti-spam feature - Exhibition / Gallery - Arduino Forum

I am not sure an ADC is what I need. I actually need another analog pin or a different way to do this altogether. Also, I couldn't find anything in your link about this. It was a little too long and non specific.

I am not sure an ADC is what I need

An ADC is EXACTLY what you need. It looks like you need to learn a lot more before atempting this project, both for your own safety and that of your ESP.

justinoberle:
I am not sure an ADC is what I need. I actually need another analog pin or a different way to do this altogether. Also, I couldn't find anything in your link about this. It was a little too long and non specific.

The link contained an example of an ADC (analog to digital converter) being interfaced to an ESP8266.
You appear to require, based on what you said in your OP, an additional analog pin. That is what such an ADC chip will provide. Some maybe up to 8 or even more additional pins, depending on the type. If you want to make a circuit yourself, google for successive approximation ADC or similar. There may well also be other, simpler, solutions for your specific problem.

Post crossed with @MissDrew

@justinoberle,
Look at MCP3008, MCP3208, or similar for a multichannel analog to digital converter you can add to your system.

https://www.digikey.com/en/products/filter/data-acquisition-analog-to-digital-converters-adc/700?s=N4IgTCBcDaILYGMAOBmADGgHCAugXyA

https://www.digikey.com/en/products/detail/microchip-technology/MCP3208-CI-P/305928

There are plenty of other options as well
https://www.digikey.com/en/products/filter/data-acquisition-analog-to-digital-converters-adc/700?s=N4IgTCBcDaILYGMAOBmEBdAvkA

Ok thanks everyone. I will give this a whirl.

The reason there is only 1 Analog pin on an ESP is that in a way you only need 1. Normally speaking one uses analog pins for sensor of some kind that return a voltage between certain margin. These sensors require a positive input voltage. The idea is to turn the input voltage on, read the analog pin, turn it off, turn the next sensor on, read the analog pin and so on and so forth. If for some reason the sensors are not semiconductors themselves (most sensors are some kind of transistor or op-amps which consist of transistors) you can use a germanium diode to prevent reverse voltage.

For some measurements, there are tricks that can be applied.

google

use digital pin for voltage measurement

and see, for example

What are you trying to measure? The basic trick can be reworked perhaps.

a7

The end goal is to programmatically display battery life. It doesn't have to be exact but relatively close.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.