ESP8266 I2c

There seems to be chatter going around about how the ESP8266 does not have I2c.  So much so that there are implementations of bit-banged I2c out there..  here for example and this one is good for those with ESP-01 boards which only have 2 pins available – but beware that GPIO-0 is also used in hold-low mode on powerup for flashing the chips – and also the developer of this driver states that works needs to be done. I noted that it is NOT done under interrupts.

If you want to see the official line on i2c it is that it IS supported – here it is in the SDK documentation.  – available in both WORD and PDF versions…  granted this is early documentation 0.9.1– there is later (around December 0.9.4) but as far as I am AWARE you have to sign an NDA to get the newer information – I may be wrong.. you could check with Espressif themselves.

According to the documentation you have full I2c master control (it would have been nice had it specified which pins to use!)

It would be nice if someone would submit a really trivial I2c example using the above, stating which pins needs to do what.

What I don’t understand is – when ESPRESSIF distribute the various SDKs there’s a directory in there called document that is always empty – you would think they’d take the opportunity to include the documents in there!!

Of interest if you have the pins available there is also a dual UART (ie 2 lots of serial lines) and PWM control of some of the pins.

7 thoughts on “ESP8266 I2c

  1. Peter,
    Thanks for a great blog…you inspired me to start one as well…with a bent on doing these type of activities with kids. I got a lot to learn. What I tend to be good at is doing some prep work so kids can do electronic activities without the heavy technical overhead. Over the years this has gotten these kids to pursue electronics and engineering because they enter into it at least a clue. Just starting but see

    I instaled the Unofficial Development Kit for Espressif ESP8266 as you blogged about before, got it working with the example projects…but in trying to import and compile the esp_MQTT project, I just can’t get it to import and compile. I tried an emty project and imported the files…but no luck. Any direction you could provide would be helpful.


  2. Peter

    There are i2c examples in the espressif examples folder. If you search the documentation you will find the SDA and SCK defines in the i2c.h files.

  3. So my question there would be – if he’s forked off nodemcu – is he going to update it every time the original is updated??? Also I2c – there are examples in the ECLIPSE environment – it all looks pretty simple, normal i2c to me. I guess what I should do is get an i2c memory chip and have a go at reading and writing… I still have my doubts about Lua – I mean I love it and everything and it seems to work – but as your requirements get more complex – I can’t help thinking just writing the lot in C is a better bet. Right now I’m using Mingh’s MQTT as the base for my code – at the weekend I hope to actually end up with some useful modules at last – simple temperature/relay stuff but with added timers (now I’ve figured out how the timers work). I’ll blog what I come up with. Still on my travels now which makes practical work a little difficult 🙂

  4. Peter,

    Great blog, thanks for all the info. I followed the link to the esp8266 site and in order to see the SDK docs attached to the first post, one has to be registered on the site. Problem is that I get denied when trying to register saying a valid e-mail address is needed. I’ve tried multiple addresses of mine, including Gmail, to no avail. Did you run into this when registering on that site? Any pointer you can provide?



Leave a Reply to CJ Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s