ESP8266

i just wanna know Can I 'Send data, like a button press on an APP saying 'GO', which is read by the arduino Mega, via ESP8266, and send it to a particular PWM pin, say pin #2 on MEGA, to be read by other hardware connected to that particular PWM pin (#2)'

Yes. This is technically feasible

Sorry this is off -topic, but I have found the simplest way to communicate from Android to Mega or Arduino is using bluetooth and MIT App Inventor 2.

ESP8266 can work stand alone. Can switch on and off devices. I have seen it here. might as well help. http://thinkingparts.blogspot.com/2015/02/home-automation-lan-based-stand-alone.html

electricalhobbyist:
ESP8266 can work stand alone. Can switch on and off devices. I have seen it here. might as well help. http://thinkingparts.blogspot.com/2015/02/home-automation-lan-based-stand-alone.html

If you want it standalone, take a look also here:

It still looks more stable using ESP8266 Module as WIFI only module and run the Main Application on a separate MCU, but for small apps it's quite stable already :slight_smile:

Here are some useful tutorials for ESP8266 and Arduino:

ESP8266 temperature and humidity sensor

ESP8266 relay switch

ESP8266 water leak (rain, soil moisture) sensor

ESP8266 air pressure and weather forecast sensor

ESP8266 real time clock display

ESP8266 LED dimmer

ESP8266 touch screen thermostat

It uses EasyIoT server (windows or Raspberry) with nice Web interface. It also supports SMS control, native app (comming soon), data logging and automation functions.

see attached pics for this pins and serial monitor screenshots.

i just got the ESP8266 module from here:

http://www.ebay.com/itm/ESP8266-Serial-WIFI-Wireless-Transceiver-Module-Send-Receive-LWIP-AP-STA-arduino-/181583935325?pt=LH_DefaultDomain_3&hash=item2a473ef75d

I wired it up:
RX to arduino's pin 3
TX to arduino's pin 2
VCC + CH_PD to 3.3v input (not related to arduino)
GND (black) to ground

Using the following arduino code:


#include <SoftwareSerial.h>

SoftwareSerial mySerial(2,3);

void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
}

void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}

The wifi red led is working, and I'm trying to send commands to it using the serial monitor (it is set to 9600 baud and carriage return mode).
When I send the command, I can see the WIFI's blue light flickering (I'm sending AT+GMR to display its firmware version) - seems that it is getting the transmission, but the serial monitor displays strange characters and not the expected result (happens for any AT command I send).

I want to test it with AT commands before I code an arduino app for it.

What am I missing here?

serial.JPG

wiring.JPG

Hey Guys

I'm not sure if any of your have seen this new thread

http://forum.arduino.cc/index.php?topic=311117.new#new

This is compiling code straight onto the ESP8266 using the Arduino IDE.

You can get an installer exe from the guys website, which puts the files in the Windows Programs (x86) folder, or the technically better approach for Arduino 1.6.x (which is now the current release of the Arduino SW) is to copy the files into use hardware folder in the normal Arduino folder e.g. where the libraries folder is

So I've forked the repo and built a version for 1.6.x

https://github.com/rogerclarkmelbourne/arduinesp

Note. Looking at the current code it seems to be based on some older version of the Arduino, I'm not even sure its Arduino 1.0 as the Hardware Serial class is not derived from the Stream class as it is in Arduino 1.0

However it does work !

Edit

Someone just told me about another Arduino to ESP8266 build

i looked at the example here:

it is working, but i found a very strange thing happening - the Wifi module responds ok only if its VCC/GND pins connected to 5v and GND of the USB to UART adapter.

if i try a different power source (batteries/other power outlet) i get strange output text from it.

i compared the voltages/amp of the USB and my other sources and made sure they are the same and still - with USB as power sources output of WIFI in serial monitor is ok while with other it isn't.

why is that?

second issue i'm now having is not being able to upload code it even though using it from the serial monitor with AT commands works fine.

this is the output i'm getting when trying to upload this (empty) sketch:


void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
}


output:

Sketch uses 26,726 bytes (13%) of program storage space. Maximum is 200,000 bytes.
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm cmd: wrong direction/command: 0x00 0x08, expected 0x01 0x08
warning: espcomm_sync failed
error: espcomm_open failed

Wow, I have to say these chips seems pretty impressive.
Just bought four of the ESP-12's, Should make a nice little sensor network.

I started reading about these modules after seeing a kick-starter project using them, so many possibilities.

Roger, your core for the IDE seems popular, good work. Will have to try it once the boards arrive.

Guys

My version does work, "out of the box" on 1.6.1

However I have been discussing things with the main developer at esp8266.com ( Ivan in St Petersburg ), and apparently the version of the Xtensa compiler I'm using, in the repo, has some issues due to the way it was compiled.

If you have issues with mine, there is another and potentially better repo that does the same thing, by a Canadian guy call Sampreet Mistry, which uses the compiler binaries compiled by Ivan.

However I'm not sure whether Sampreets version works on 1.6.1. Though it appears to be ok on 1.6.3

There is some strange issue with paths to gcc helper dll's which cause issues with Ivan's version of the compiler

I've been trying to track down precisely what's going on with this, for the last 3 days, with no luck, except 1.6.3 doesn't seem to have this issue- so it could be a path environment bug in the IDE.

I know this thread was about arduinesp.com, but unless the OP has updated his version from the master copy at GitHub - esp8266/Arduino: ESP8266 core for Arduino I'd recommend you either download Ivan's specially modified version of the IDE from GitHub or use my version of it, or probably even better use sampreets version.

But getting back to the point.

Yes. The are amazing devices, I have several versions including the one you mentioned

Paulware:
I added a UDP example: GitHub - Paulware/ESP8266: All things related to ESP8266 low cost device. It is written for the mega since the ESP8166 needs commands over a fast serial port.

Basic theory of UDP operation:
ESP8266 logs onto your local network (it will need SSID and password)
Android device also logs on to local network and sends out a UDP broadcast (to 192.168.0.255 for example). The message is "findkey" where key is a unique name of the device (i.e. garageDoor).

All other ESP8266 on the local network will receive this message but only the unit with the matching key will respond. This matching unit will respond: "CTS" (clear to send) to the android device.

When the android device receives this message it now also has the ip address of the device. All further commands will be point to point from the android device to the specific ip address of the specific ESP8266 unit with the matching key.

The unit can now process and respond to commands, like "open" or "readTemp".

In the ESP8266UDP directory is also a udpServer.py file which can be used to simulate and android device (if you don't yet have one - The Kyocera Event can be purchased at Best Buy for $40) to command the ESP8266.

Also, in this directory is an Android project written in .java/Eclipse which demonstrates basic connectivity. You can use this project as a skeleton to create your own Android App.

Hi Paul,

this looks a nice way to start the communication, but it won't work out of a LAN. Is there a way to start a communication from outside a LAN?

Dario.

An ESP8266 can be put into access point mode. Other wifi devices can connect to it!

It seems to have support for direct Wifi too, but the API might not be up to date with all the chip features yet.

I got an ESP8266 module and after upgrading its firmware with the arduino IDE (burn bootloader) I connected it successfully to an arduino uno 3 using the following sketch:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);

void setup() {
// put your setup code here, to run once:
mySerial.begin(115200);
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}

I am able to send AT commands from serial successfully through the arduino to the module and get the output.

When I try to do the same with an arduino nano, connecting it to pins D2 and D3 with the same sketch, it doesn't work. I am using the same power for the wifi module (external from the arduino's) and just move the 2 RX,TX pins from the uno to the nano.

When I try to send any command, the serial light in the nano blinks but not the ESP's one. It's like there is a communication problem between them.

I tried to upload the sketch to the nano with different speeds (9600 and 19200) and still the same behavior. If I power off/power on the ESP while the arduino serial monitor is open, I get funny looking characters and a short blue led blink and that's it.

Any ideas?

How are you powering the ESP8266?

using a Voltage Regulator board connected to 12v power source (the output of the regulator is 3.5v). i don't think this is related to power since i am not changing the power source at all - only the (RX,TX) pins from the uno to the nano - the other wires are not changed, and it is working well when connected to the uno.

Are you using some sort of voltage level translators between the Nano and the ESP8266 for the TX line from the Nano ?

e.g. resistor divider network?

Also. You could try disconnecting the esp8266 and connect the software serial pins together and do a loopback test, to prove you don't have a software problem

Hi All, just looking into this grand little beast as part of my ongoing wireless doodling !!

I see you are all discussing these boards, do they all do different things ? (the ESP-08, ESP-03 numbers I mean)

Is THIS any good to get me started ?

I just want to connect to my Wifi and run a '328 as a server

I see chat about downloading code onto the processor and run them standalone, is that right ?

Regards Bob

Might as well go with one that exposes more pins of the ESP8266 IC like ESP-12.
There are even newer ones out that expose the SPI connection too (somewhere, only seen pictures).

Here is one with an adapter board for example: http://www.ebay.co.uk/itm/ESP8266-Esp-12-Remote-Serial-Port-WIFI-Transceiver-Wireless-Module-IO-adapter-/131499974902?pt=LH_DefaultDomain_3&hash=item1e9e0260f6

An Arduino can talk to it via Serial using AT commands, and yes, you can replace the firmware with your own, and use it by itself. There has been an Arduino core ported to it (so you can use digitalRead/digitalWrite/...).

The ESP8266 will probably make a better server by itself (https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino / GitHub - israellot/esp-ginx: HTTP server for the ESP8266) than a 328 with 2K of ram. A 328 could be used to add lots of IO to the ESP.

Cheers Pyro - is the ESP8266 run on an AVRthen ?

@mcnobby

Use this

https://github.com/sandeepmistry/esp8266-Arduino/

it works the same as Arduino_STM32 ie its just hardware files