Close

Hardware

A project log for ESP8266 I2C Extender

A PIC18F27J53 connected to an ESP8266 via i2c to provide extra I/O, including a possible 10 channels of 12-bit ADC

pucebaboonPuceBaboon 07/22/2016 at 15:380 Comments

The hardware for the prototyping stage of this project is basically a no-brainer. I have a few of the AI Thinker "yellow" development boards, which are an excellent way to get your ESP12's already soldered to a PCB with all of the pins broken out and debug LEDs already attached (plus a good number of other, useful parts).

The PIC is currently sitting on some strip-board with a voltage regulator and a few decoupling caps. I added a couple ofpull-up resistors for the i2c bus and we were in business.

The PIC (slave) side firmware was stolen from the previous (all PIC) project, with very few modifications.

The first step with the ESP (master) side was to grab Mike Causer's nice little i2cdetect library, which makes it nice and easy to see whether your i2c devices are actually visible to the master. Just fire it up and it'll interrogate the given address range and print out a nice little table of everything it can see on the bus. If your hardware doesn't pass this simple test, it's a 98% certainty that you've screwed up something pretty basic. In my case, I added a known good i2c device (a DS3231 board with a serial memory chip) on a different address to the PIC, so that I had something to compare with.

I2CDetect
Scanning address range 00-7f

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- 19 -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Yup, the DS3231 and memory are on the 0x57 and 0x68 addresses and my PIC shows up a bit further down the address range at 0x19. It's alive!

Discussions