I recently started doing networking with the Arduino, and I'm finding it rather difficult. I have the ESP8266 chip connected to an Arduino Uno board. The chip is supplied with 3.3 V (not from the arduino board), and I start by connecting it to the TX and RX ports so that I can change the baud rate to 9600 via the terminal. Everything works great this far. I change the terminal from 115200 to 9600 and send an AT command which returns OK. I can list networks and even connect to one, via the terminal.
However, when trying to run my code, the problems arise. I move the TX and RX to pins 6 and 7 before running the code, just to clarify. Here it is:
// WiFiEsp - Version: 2.2.1
#include <WiFiEsp.h>
#include <WiFiEspClient.h>
#include <WiFiEspServer.h>
#include <WiFiEspUdp.h>
// WireData - Version: Latest
#include <WireData.h>
#include <SoftwareSerial.h>
#include <Wire.h>
SoftwareSerial Serial1(6, 7);
char ssid[] = "my_SSID";
char pass[] = "my_password";
int status = WL_IDLE_STATUS;
void printWifiStatus() {
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
}
void setup() {
Serial.begin(115200);
Serial1.begin(9600);
delay(1000);
WiFi.init(&Serial1);
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while (true);
}
while (status != WL_CONNECTED) {
Serial.print("Attemting to connect to SSID: ");
Serial.print(ssid);
status = WiFi.begin(ssid, pass);
}
Serial.println("You're connected to the network");
printWifiStatus();
}
void loop() {}
I'm pretty sure those are correct. Pin 7 is connected to RXD and pin 6 is connected to TXD. I tried swapping just to be sure, but that didn't change anything.
The chip was included with the book that contains my posted code, so it would be strange if the AT version or SDK version would stop this from working.
PelleS:
The chip was included with the book that contains my posted code, so it would be strange if the AT version or SDK version would stop this from working.
I asked because I have a new WiFiEspAT library for SDK 3 (AT 1.7.x)
I think I have more or less the same problem as PelleS.
I searched all over the web, particulary on this forum to find an answer to my simple question : How do I establish SIMPLE communication between Uno and ESP ? e.g. send an AT command and receive the answer from the ESP. My final goal is to send data over WiFi collected by the Uno (or even Nano) to another arduino or smartphone.
I use an arduino Uno because I can't find instructions anywhere about Nano+ESP, and connect it to an 8 pin ESP-01 (8266EX) The RX-TX goes through a 3.3 /5 converter board, 3.3V and ground, I take from the Arduino board. It might be necessary to add a seperate 3.3V power supply, but because I'm not using the Wifi (yet) I know that the 3.3V output delivers enough power (for now). The current that I measured for the ESP + converter boards is about 12mA, so shouldn't be a problem for the Uno.
Here's how I connect the boards :
ESP---Arduino ESP---Arduino
I do see the blue LED on the ESP board blink every +/- 500mS. If I swap RX and TX : NO blinking blue LED.
Who knows (where I can find) a SIMPLE solution for this (very basic) problem ?
After I master this, I'll try to get the WiFi working... and then Blynk, and then merge all this with my data collecting Nano... But I wanna go step by step ! So please no complete setups for webservers, etc (yet ! )
PaulVdB:
I think I have more or less the same problem as PelleS.
I searched all over the web, particulary on this forum to find an answer to my simple question : How do I establish SIMPLE communication between Uno and ESP ? e.g. send an AT command and receive the answer from the ESP. My final goal is to send data over WiFi collected by the Uno (or even Nano) to another arduino or smartphone.
I use an arduino Uno because I can't find instructions anywhere about Nano+ESP, and connect it to an 8 pin ESP-01 (8266EX) The RX-TX goes through a 3.3 /5 converter board, 3.3V and ground, I take from the Arduino board. It might be necessary to add a seperate 3.3V power supply, but because I'm not using the Wifi (yet) I know that the 3.3V output delivers enough power (for now). The current that I measured for the ESP + converter boards is about 12mA, so shouldn't be a problem for the Uno.
Here's how I connect the boards :
ESP---Arduino ESP---Arduino
I should get
OK
-----
OK
-----
etc...
well ... I get this :
(10 spaces)
-----
(10 spaces)
-----
etc.
I do see the blue LED on the ESP board blink every +/- 500mS. If I swap RX and TX : NO blinking blue LED.
Who knows (where I can find) a SIMPLE solution for this (very basic) problem ?
After I master this, I'll try to get the WiFi working... and then Blynk, and then merge all this with my data collecting Nano... But I wanna go step by step ! :) So please no complete setups for webservers, etc (yet ! :) )
Thanks in advance !
Juraj:
you must send the command at current baud rate
Thanks Juraj,
Is there a way to find out what the "current baudrate" is ?
Or is it just trial and error ?
What baudrate is standard on new ESP's ?
Anyhow... thanks for your interest !
PaulVdB:
Thanks Juraj,
Is there a way to find out what the "current baudrate" is ?
Or is it just trial and error ?
What baudrate is standard on new ESP's ?
Anyhow... thanks for your interest !
on new AT firmware versions default is 115200 baud.
Juraj:
on new AT firmware versions default is 115200 baud.
Thanks again Juray !
I've read about this, but there's lots of confusion, so I thought that 9600 always works.
Now next thing I read :
Software Serial is not reliable or even not supporting 115200...
Maybe I have to hook it up to e.g. a Mega on one of it's "hardware" serials... ?
But again... tanx for the info !
PaulVdB:
Thanks again Juray !
I've read about this, but there's lots of confusion, so I thought that 9600 always works.
Now next thing I read :
Software Serial is not reliable or even not supporting 115200...
Maybe I have to hook it up to e.g. a Mega on one of it's "hardware" serials... ?
But again... tanx for the info !
SoftwareSerial has problems to receive at 115200. but you can send the command at 115200