Adding ADC channels to an ESP8266

One of the drawbacks of the ESP8266 is that it only has one ADC port.
In case you need more ADC ports, you could add an I2C ADC converter like the PCF8591 or the ADS1115, but there is a cheaper way that is easier to program as well.
You could use an analog multiplexer like the HCT4051, that can switch 8 ADC channels individually to the ADC input of your ESP8266.
Does this method have drawbacks? yes, you need 3 I/O pins to control the HCT4051 and the ESP8266 does not have an abundance of pins to begin with.
The circuit looks like this:

I have chosen GPIO12-14 to control the multiplex chip. If all control lines are LOW, the A0 line is patched through to the ADC of the ESP8266. If all control lines are HIGH, then the A7 line is patched through to the ADC channel of the ESP8266, the table below, shows the state of the I/O pins need to be in to read every individual analog channel

      S0      S1      S2
      GPIO14  GPIO13  GPIO12
A0     0       0       0
A1 0 0 1
A2 0 1 0
A3 0 1 1
A4 1 0 0
A5 1 0 1
A6 1 1 0
A7 1 1 1

Advertisement

ESP8266-01 Neopixel module


In Chinese webstores a “ESP-01S RGB LED Controller Module for Arduino IDE WS2812 Light Ring Smart Electronic DIY” module is sold for less than a dollarĀ  (if you buy it without the ESP8266-01). The module contains everything that is needed to have an ESP8266-01S control a Neopixel strip

The module uses GPIO2 as output for the Neopixel(s). Suitable Software can be found here. Make sure you use the new ESP8266-01S with this module. The ESP8266-01S has the necessary pull up resistors already available. If you use the standard ESP8266-01 you need to attach the required pullups yourself.