-->
Page 1 of 3

I2C Scanner - different behavior compared UNO to ESP

PostPosted: Thu Apr 09, 2015 3:18 pm
by erniberni
Hi,
very often I use the i2c scanner, which can be found on the Arduino Playground.
I only added

void setup()
{
Wire.pins(0, 2);
Wire.begin();

The response of the scanner is that i2c devices are found on each scanned adress, which is understandable not correct. I have connected light sensor with adresses 0x10 and 0x11. When I analyse the signals with a logic analyser I found correct ACK only for this adresses. I looked at the library code, but I couldn't find any differences between ESP and Arduino. Here is the picture I took with the logic analyser
Image
You see that adress 0x10 sends ACK while the others don't (NAK).
Reading the sensor is also working as expected
Image

Anybody here who can analyse the i2c library?

Regards
Reinhard

Re: I2C Scanner - different behavior compared UNO to ESP

PostPosted: Fri Apr 10, 2015 2:21 am
by uhrheber
That's funny, just yesterday evening I was trying the I²C scanner, and ran into the same problem.
But as it was late, I wasn't in the mood to fire up my logic analyzer.
So thank you for your investigation.
I did use only the scanner, but didn't try to actually communicate with the I²C device (an Oled display, in my case), so it's good to know that the communication itself works.

A working I²C example sketch for ESP8266 Arduino would be nice.
I'm burning to use the 128x64 Oled as a WiFi weather display.

Re: I2C Scanner - different behavior compared UNO to ESP

PostPosted: Sat Apr 11, 2015 1:24 pm
by Mikejstb
As far as working examples of I2C displays there is a working ESP-Arduino I2C display example here -
http://www.esp8266.com/viewtopic.php?f=29&t=2289

I modified that example a bit and added in code from the mqtt pub/sub examples and made a mqtt message board.

I used a Sainsmart 4x20 I2C LCD display, and my program looks for a mqtt message with topic
"home/msgBoard".
The payload published to show on the message board is comma-delimited, what's between the comma's goes to either line 2,3, and or 4 of the display.
So for example to watch my furnace I have a mqtt message like this:
topic: home/msgBoard
payload: "Furnace,Temp = 95, Time = 12:00"

I get the weather (from NOAA and a nearby airport and from the DarkSky api) format it up in Node Red and shoot it out to my little message board every 30 minutes. I can also request it to send me the weather info any time by sending another mqtt message (topic: getWeather).
I find having Node Red do all the fancy listening and formatting and sending works very well, lets me keep the little displays and sensors fairly simple.

Here's the weather -
IMG_2167.JPG

and
IMG_2166.JPG

So - both using I2C LCD displays and mqtt is working fine in the ESP-Arduino world.

As you can see I need to fix my program to deal with lines longer than 20 chars...
Here's my example:
mqttMessageCenterExample.zip


I didn't use the 128x96 I2C displays because I made a similar project to this one using nodemcu Lua and I find that my old eyes have too hard a time with those little displays.
Maybe I'm wrong to assume, but I would think that those displays would work as well as the one I used here.

Here's the comparison of the two displays -
IMG_2171.JPG


And as far as the original topic of this post - I too see every I2C address as present with the i2C scanner, but nevertheless I2C displays do work fine.

Now if only I could get the I2C TSL2561 luminosity sensor to work...

Re: I2C Scanner - different behavior compared UNO to ESP

PostPosted: Sun Apr 12, 2015 12:15 pm
by ian
Mike, this looks great :)
It was high on my list & you beat me to it. Shucks... ;)
I, too am challenged by tiny OLED displays, much as I like them.
I spent some time today trying to get an I2C OLED running & failed :(

Cheers

Ian