MCP23017 and the db18b20

Hi guys

Is it possible to read the DB18b20 or even the DHT22 sensor through the MCP23017 expander?

All the examples that I have seen online is to control LED's, which is simple enough. How do I get the data from one wire Digital Temperature Sensor?

Im trying to port from my Arduino to a ESP8266 and I have obviously run out of pins. They like hens teeth.

Any direction would be greatly appreciated.

Looking at the DHT22 library

// Now read the 40 bits sent by the sensor. Each bit is sent as a 50 // microsecond low pulse followed by a variable length high pulse. If the // high pulse is ~28 microseconds then it's a 0 and if it's ~70 microseconds // then it's a 1.

I doubt you can get that kinds of speeds through the I2C bus.

Reading a byte from the I2C bus requires addressing the device (8 bits) and reading the data (8 bits). So 16 bits at 400 kHz (2.5 microseconds per bit) gives about 40 microseconds for the transfer of one byte from the MCP to the microcontroller.

I don't know if you can squeeze the maximum speed that the MCP supports (1.7MHz) out of the microcontroller.

Does your micro support hardware SPI? Up to which speed? Maybe you can gain by using the SPI version MCP23S17 (max clock 10MHz)?

thanks for the insight sterretje

I had a feeling it was going to be timing issues. I have ordered the MCP23S17 chip, to try out. I will do a bit more research.

I think 1-wire to I2C (ot SPI?) converter exists. Or you can connect ATMega via I2C to the microcontroller and use it both as a pin expander and reader of 1 wire devices.