Question about MCP23017 and MCP23S17

I've been playing with an ESP-01 controlling a led matrix via bit banged SPI.
Now, I'd like to be able to read I2C sensors. As the ESP-01 only have 4 GPIOs available and I'm using 3 for SPI, I'm 1 pin short.
My question is if it would be possible to use a MCP23017 via I2C and use 3 of the MCP23017 pins to bitbang the connection to the led matrix ? I believe it should be possible, but not sure if it would work because it might not be fast enough. I don't care if the matrix update is slow, but probably SPI have some timings constraints.
On the other hand, would it be possible to use a MCP23S17 via SPI instead and bitbang I2C to the sensors ?

What kind of matrix?

What kind of sensors?

(also, why not use an ESP8266 board that breaks out all the pins? They're like $3-4 shipped from china, $6-8 shipped from US, and have USB serial adapter and all pins not needed for the flash broken out...)

Common 8x8 matrices based on max7219. Any kind of temperature/humidity/pressure/light I2C sensor.
I know about the alternatives. but I really like the ESP-01, it is the simplest and the smallest. Of course that when you add the size of the MCP23017 you end up with something that is larger than the Wemos D1 mini or the ones from But that's beside the point.
As the schematics of the ESP-01 are available I thought about doing a small variation of it, with just 2 more pins exposed, but I know that I would not be able to solder the 8266 chip by myself so I thought about what could be done to expand the ESP-01.
I'm not trying (thinking about it) to build the smallest or the cheapest, It's the same reason that I played with the attiny85 countless hours trying to use it to control a rgb led when most of the info I was finding said that the attiny85 could only produce pwm on 2 pins... Then someone here in the forum pointed out that DrAzzy's core supported AnalogWrite on 3 pins (thank YOU for that :slight_smile:
So, there is really no good reason, I just want to know if it can be done, the only reason I'm asking instead of trying to do it is because I'm not sure if the speed of the I2C bus is enough to produce an usable SPI connection out of the MCP2301.
I suspect that the slowest speed of the spi bus is 125 KHz, and the max speed of I2C could be 80 KHz (using Brzo I2C lib)... But I'm not sure, can SPI be made to run slower ?

You could bitbang the spi through the MCP23017. It'd be slow - I'm not sure how slow (not sure how fast the arduino esp8266 spi and I2C implementations are - SPI is faster though I think), but I do think it would work if you didn't care too much about the speed. That said, I'm pretty sure bitbang SPI via a port expander is about 50 times slower than doing so directly (as each transition requires iirc 3 bytes sent to port expander, and there are 16 transitions to sent a byte)

On the topic of tiny ESP8266 modules - have you seen the ESP-01M? I just got mine the other day, and they're so tiny, with all pins exposed. Trickier to solder to, but you can just solder to the row of contacts. I'm envisioning an IC glued upside down to the underside of the ESP-01M

Thank you for your opinion. The speed between the 8266 and the led matrix wont be (probably) a problem, I wont be doing animations, even if it takes 1 or 2 seconds for the image to reach the matrix it would be ok.

I have never heard about this module... ok, 2 on the ebay cart right now :slight_smile: thank you
But it looks that it wont be easy to find a socket to connect it.
This could help:
But the ideal would be some kind of right angle edge connector

Hummm, I think this one will be interesting too: ESP8285 ESP-M3

So far my favorite module (after the ESP-01) is this one from
Very small, breadboard friendly and with a good interface to connect the ftdi adapter.

Check out the WeMOS D1 or NodeMCU boards. A little bigger but MUCH easier to work with.

Check out the WeMOS D1 or NodeMCU boards. A little bigger but MUCH easier to work with.

With the right (not) FTDI adapter it doesn’t meter, I use this one
It uses the nodemcu reset method and doubles as a breadboard adapter to the ESP-01.

It matters if you care about being able to use the rest of the pins (11 digital + 1 analog, or if you change the flash mode you can free up 1-2 more digital pins).

Oh! Yes, now I see your meaning. I never had to do that but I knew that nodemcu expose de pins that the 8266 use to talk with the flash chip, I thought that it was silly as no one would be able to use them, but now it makes sense. I suppose that there is a fuse to select the flash mode.

I thought that you were saying that they were easier to use/program, I remember that ESP-01 was a pain to program without an adapter capable to enter programming mode by itself.

They're easy to program, have on-board regulator (so can be powered directly by USB), USB/TTL converter - all the goodies you expect from a development board. And of course all pins available.

I've also never used those extra flash pins; GPIO9 and 10 can be made available but it seems not too reliable a thing to do. I prefer to add a port expander (I always end up needing many more extra pins than just two :-))

I received a WeMOS D1 mini last month but haven't tried it yet.