using this core:
https://github.com/sandeepmistry/esp8266-Arduino
I have also used the parent to that distribution with the Board Manager in the 1.6.5r2 from Arduino.cc
Available:
I’m publishing my efforts on my project blog: http://www.hackster.io/rayburne/esp8266 … rduino-ide
Previous attempts to use “AT” commands and a separate Arduino to parse is a P-I-T-A. Big capitals… BIG pain.
Users using LUA have reported SRAM leaks and issues… I did not even go there as there are too many gyrations to jump through.
However, the Arduino flavor core seems to manage the ESP8266 well. Using a clean, stable power supply is key. Other things to note:
Do NOT take GPIO0 directly to Gnd to activate program mode! Rather,
power-off,
pull-down GPIO0 using a 330 Ohm resistor,
power-on,
program*,
power-off,
remove the GPIO0 from the pull-down and connect as sketch requires (or leave floating.)
The 330 Ohm resistor will prevent any damage to the uC should the pin be driven accidently to a HIGH state.
* ONLY use a 3.3V serial-USB module. Never use a 5V serial converter.
Use a quality electrolytic as close to the ESP8266 board as practical… I’m using 100uF
Do use 1.8K Ohm resistors to 3.3V as I2C pull-ups
The code is not complete, but the attached ZIP contains the Arduino sketch to:
- Init the OLED on I2C**
Scan the local WiFi area
Match SSID to “home” SSID
If home SSID found,
Connect,
Attempt login
DHCP
Display IP address
** Note:
My OLED states 0x78 on the back side of the display. In AVR it tests at 0x78. For the ESP8266, it only works at default address 0x3C
You have been warned.
Unzip the archive into a single directory… the project is a multi-tab sketch.
The includes are part of the ESP8266 core files:
- #include “ESP8266WiFi.h”
#include <Wire.h>
See Credits_Notes.h for OLED connections to the ESP8266 module.
Ray
So, maybe Chinese people been confused by I2C addressing …
In such case, there is maybe a discrepancy between Maple Wire and Arduino Wire librairies, the shifting by 1 in addressing is to leave place for the R/W bit.
We should narrow it down, otherwise, people will always faced that with any I2C devices.
The I2C code is bit banged, and is relatively easy to read ( the code), but i nave next to zero knowledge on I2C, so perhaps someone with more I2C knowledge could take a look ?
In such case, there is maybe a discrepancy between Maple Wire and Arduino Wire librairies, the shifting by 1 in addressing is to leave place for the R/W bit.
We should narrow it down, otherwise, people will always faced that with any I2C devices.[/quote]
Just a reminder, I am discussing the ESP8266 uC, not the STM32F1xx. Likely there is a discrepancy with the Wire library for the ‘8266. My bet is that the Nano is working correctly as it corresponds to the manufacturer’s silkscreen.
Ray
So, it is maybe related the OLED lib mentioned above.
The I2C address is 7bits, it is shifted by 1 and added (ORed) with R/W state. Some libraries take that in account, some others don’t …
So, the bug is somewhere in this discrepancy …
U8glib works too without defining any address.
Just a reminder, I am discussing the ESP8266 uC, not the STM32F1xx
I’ve looked at my ESP8266 Sketch_Buffet, and I don’t see any discrepancy there either. The MCP23017 is really at 0x20 (not shifted to 0x40) and the 24C64 EEPROM is at 0x50 (not shifted to 0xA0). So, the discrepancy must be really into that specific library.
Libraries that don’t rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work:
arduinoWebSockets – WebSocket Server and Client compatible with esp8266 (RFC6455)
aREST REST API handler library.
Blynk – easy IoT framework for Makers (check out the Kickstarter page).
DallasTemperature
DHT11 – Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: DHT dht(DHTPIN, DHTTYPE, 15);
NeoPixelBus – Arduino NeoPixel library compatible with esp8266.
PubSubClient MQTT library by @Imroy.
RTC – Arduino Library for Ds1307 & Ds3231 compatible with esp8266.
Souliss, Smart Home – Framework for Smart Home based on Arduino, Android and openHAB.
Of course, the appropriate break-out board must be used to secure access to the necessary uC pins!

In addition to the below common modules, Adafruit is now in the game with Huzzah.

Ray



