Hi I have a version of the esp8266 with 1 analog pin, TX and RX pins. I'm looking to attach a temperature sensor (Grove - I2C High Accuracy Temperature Sensor - MCP9808), humidity, and a few others in addition to controlling a logic-level MOSFET for LED control.
What would I use for this? Would a multiplexer like the CD74HC4067 or the MCP23017 - i2c 16 Input/Output Port Expander work?
Basically, I need to both expand serial/digital input and still have at least 1 output control.
Well that is on the I2C bus and you can have up to 127 devices on that using no extra pins.
For suitable devices yes. The 4067 where you have analogue outputs on your sensor and the 23017 on the I2C bus when you want extra digital input / output.
If you do not need to use TX and RX for serial communications, you can use them as the I²C interface. They only become TX and RX if and when you program them to be that in your code.
Well, (analog) multiplexers are not appropriate to control outputs as when you switch to a different device, the one from which you switched away is now connected to nothing, so is no longer under control at all.
Stick to i2c devices if you can. The mcp23017 will control your MOSFET for example, but if you don't need 16 digital pins, there is mcp23008 or pcf8574. For humidity, sht21 or similar. If you need more analog inputs, consider ads1115.
I only need 3-5 sensor inputs. Will the mcp23008 or pcf8574 be able to do analog/digital input and control the MOSFET? Also, what's the difference between the 2, I can't really find much of comparison online? Thanks
Digital yes, analogue no.
mosfet control only needs a digital output.
Not much of a difference in terms of simple I/O but the former has more options like being able to generate an output when any on of a definable group of inputs change. And other such niceties,