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)'
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
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.
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.
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
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
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:
}
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
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?
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:
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.
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
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).
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/...).