Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By pablov
#63270 Hello everyone!

I'm stuck on how to make an arduino nano communicate with a module Esp8266-01.
I have been able to load code from arduino ide and update the AT firmware.

A few days ago, I was working on a Robotdyn module for Wifi D1 & R2 Image.

The tests of sending the data from an analog sensor to the mysql database through wifi were positive. But when I needed more similar pins I could not go any further.

Now the solution I have in my hands is a nano v3 I / O & Wireless Shield Imagethat has a socket for Esp8266-01.

I have seen examples of wiring and I have no problem following them. Now that there is no wiring I do not know how to use it.

My notion of the topic is to use the arduino nano and to send the data to Esp8266 but I do not know if the wifi module only works with AT commands or I program it. Well, there is my problem

If anyone could guide on the subject would be very grateful I have a few months in the world of Arduino and sensors.

Greetings!
User avatar
By ftinetti
#64262 Hi pablov,

I have a few Robotdyn module for Wifi D1 & R2 and I'm not able to make it work... how did you?

I've installed http://arduino.esp8266.com/stable/packa ... index.json and tried to use the examples, but they did not work, how did you make it work?

TIA,

Fernando.
User avatar
By Lovro
#64280 I have the same problem. Arduino Nano V3, I/O shield and ESP8266 are connected, and all "right" LEDs are ON. How to use it all together? I have tried a couple of examples, but They don't work.
Here they are:

When I try to use AT commands in Serial monitor after uploading following code, nothing happens.
Code: Select all#include <SoftwareSerial.h>
SoftwareSerial softSerial(8, 9); // RX, TX

void setup()
{
  uint32_t baud = 9600;
  Serial.begin(baud);
  softSerial.begin(baud);
  Serial.print("SETUP!! @");
  Serial.println(baud);
}

void loop()
{
    while(softSerial.available() > 0)
    {
      char a = softSerial.read();
      if(a == '\0')
        continue;
      if(a != '\r' && a != '\n' && (a < 32))
        continue;
      Serial.print(a);
    }
   
    while(Serial.available() > 0)
    {
      char a = Serial.read();
      Serial.write(a);
      softSerial.write(a);
    }
}


Next code can't be uploaded on Arduino Nano, but it perfectly works on NodeMCU 12E.
Code: Select all/*
    Program za postavljanje jednostavnog HTTP servera.
    Server kontrolira pin 5 ovisno o HTTP zahtjevu
      http://server_ip/relayon uključuje relej,
      http://server_ip/relayoff isljučuje relej,
    server_ip je ip adresa ESP8266 modula, koja će se ispisati u
    Serial monitoru kada se spoji na bežičnu mrežu
*/

#include <ESP8266WiFi.h>
// u ovu varijablu će se upisati HTML stranica koja će se prikazati kada se u preglednik upiše ip adresa ESP8266 modula
String page;
//wifi ssid
const char* ssid = "**********";
//wifi password
const char* password = "**********";
// pin na koji se spaja relej
int relejPin = 5;
// Kreiranje servera
WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  delay(10);

  // definicija pina za relej
  pinMode(relejPin, OUTPUT);
  digitalWrite(relejPin, LOW);

  // spajanje na wifi
  Serial.println();
  Serial.println();
  Serial.print("Spajam se na: ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  // čekanje dok se modul spoji na wifi
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Spojen na: ");
  Serial.println(ssid);

  // pokretanje servera
  server.begin();
  Serial.println("Server pokrenut");

  // Ispis ip adrese modula
  Serial.println(WiFi.localIP());
}

void loop() {
  // provjera da li se netko spojio na server
  WiFiClient client = server.available();
  delay(10);
 
  // izrada HTML stranice
  page = "<!DOCTYPE html><html><head><title>NodeMCU ESP3266 web server</title></head><body background=000><h2 align='center'>NodeMCU ESP3266 web server</h2><hr><table align='center' width='100%' border='0' cellspacing='5' cellpadding='5'><tbody><tr><td align='center'><a href='/relayon'>Uključi svjetlo</a></td><td align='center'><a href='/relayoff'>Isključi LED</a></td></tr><tr>      <td width='50%'><img src='http://nodemcu.com/images/thumbnail/zms.jpg_1200x1200.jpg'  width='90%' /></td>      <td width='50%'><iframe src='http://lovrosverko.eu' width='95%' height='300'></iframe></td></tr></tbody></table>";

 // prikaz HTML stranice
  client.print(page);
  if (!client) {
    return;
  }

  // Čekanje da klijent pošalje neki podatak
  Serial.println("new client");
  while (!client.available()) {
    delay(1);
  }

  // Čitanje prve linije zahtjeva
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();

  // provjera zahtjeva
int val;
  if (req.indexOf("/relayon") != -1) {
    val = 1;
    digitalWrite(relejPin, HIGH);
  }
  else if (req.indexOf("/relayoff") != -1) {
    val = 0;
    digitalWrite(relejPin, LOW);
  }
  else {
    Serial.println("invalid request");
    client.stop();
    return;
  }

  client.stop();
  // Priprema odgovora na zahtjev
  String s = "\nGPIO is now ";
  s += (val) ? "high" : "low";
  s += "</body></html>\n";

  // Prikaz odgovora
  client.print(s);
  delay(1);
  Serial.println("Zahtjev obrađen.");

}



Any ideas? All help is welcome!
User avatar
By ftinetti
#64299 Hi lovro,

I do not have the Arduino Nano shield, but I think it should work with an actual ESP8266 module and AT commands.

I do have the RobotDyn wifi D2 R2 32M flash, and I do not have any trouble to load the code from the Arduino IDE, but the card is not able to become in AP mode nor to connect to my home WiFi... I think the problem is about loading the ESP8266EX (the one in the RobotDyn card) as you have problems for loading the code in Arduino Nano...

I've asked RobotDyn and they did not reply/give any instrucion/schematic data/tutorial.

Fernando.