I2C port Extender for read value of many sensor, MCP23017

I need to create a weather station, but the I2C port of the MCU are not enough, I tried with MCP23017 but I think it is impossible with MCP23017, read data for example of a DHT11, it is correct? There is another cheap way to expand the number of I2C port?

I need to create a weather station, but the I2C port of the MCU are not enough, I tried with MCP23017 but I think it is impossible with MCP23017, read data for example of a DHT11, it is correct? There is another cheap way to expand the number of I2C port?

The I2C + Gnd is a bus, all devices get connected to in parallel, with 4.7K pullup resistors at the end of the string to create a high level for a 1. The devices connected have Open Drain transistors to pull the bus low to make a 0. If the wiring is longish, you could use 3.3K resistors. What ultimately gets you is the capacitance of the wiring, it acts as filter to smooth out the high to low, and low to high transitions.

DHT11 is not an I2C device. Per its manual, https://media.digikey.com/pdf/Data%20Sheets/Adafruit%20PDFs/DHT11_ProdManual.pdf

https://cdn-learn.adafruit.com/downloads/pdf/dht.pdf

it should support 20 meters with just a pullup on the data signal:

7、Serial communication instructions (single-wire bi-directional) ◎Single bus Description DHT11 uses a simplified single-bus communication. Single bus that only one data line, the system of data exchange, control by a single bus to complete. Device (master or slave) through an open-drain or tri-state port connected to the data line to allow the device does not send data to release the bus, while other devices use the bus; single bus usually require an external one about 5.1kΩ pull-up resistor, so that when the bus is idle, its status is high. Because they are the master-slave structure, and only when the host calls the slave, the slave can answer, the host access devices must strictly follow the single-bus sequence, if the chaotic sequence, the device will not respond to the host

What have you tried so far, and at what distance?

To clear up the confusion.

The MCP23017 (23S17) does not extend the I2C ports. The I2C bus (SCL and SDA) is shared between all devices on the same line (up to 128). The devices are identified via there unique address.

With the MCP23017 you can extend the digital pins of your Arduino. You will get 16 digital I/O pins for the two Analog pins designated for I2C communication (SCL,SDA).

An Example:

Arduino     BMP180        RainSensor
-- A4 -------- SDA --------- SDA ------->
-- A5 -------- SCL  --------- SCL ------->

The master (Arduino) can request data from every slave device via their unique (!) address.

giova90:
There is another cheap way to expand the number of I2C port?

Why do you need to expand the number of I2C ports? I think you do not. The idea of I2C is to connect many devices to the same I2C port. Each device has a different address on the “bus”.

If you need to connect several identical sensors, some types of sensor allow each sensor to be set to a different address, up to a limit of 2, 4 or even 8. If you need more than that many identical sensors, then there are ways to achieve that. But I do not think you need many identical sensors on a weather station.

Also, DHT11 is not an I2C device and must be connected to other Arduino pins. But you can replace DHT11 with SHT21, SHT31, HTU21, BME280 (which also includes barometer). These sensors are I2C compatible.

Can I connect 2 or more sensor in the same I2C port of the module ESP8266, and next to create a MQTT connection between ESP8266 and Arduino?

Can I connect 2 or more sensor in the same I2C port of the module ESP8266

You can, in theory, connect up to 127 devices in parallel to an I2C port, so 2 should be no problem if the 2 devices have different I2C addresses.

I2C with Arduino (also applies to ESP8266).

With the ESP it's a bit better than the Arduino, as you can define as many I2C buses as you have pairs of pins available. That way you can connect up to five sensors with the same I2C address to a single ESP8266 controller.

To do MQTT to an Arduino you'll have to offer the Arduino some form of Internet connection as well.

giova90: Can I connect 2 or more sensor in the same I2C port

Didn't you believe the answer you got here:

pylon: I2C is a bus

@giova90, please do not cross-post. Threads merged.

If you are still unclear what the I2C (or any other BUS) does, look at this well explained article of Nick Gammon

http://www.gammon.com.au/i2c

it helped me when I started is a good starting point. In future projects (especially bigger ones with additional ICs) bus systems will become more prominent.