AT Commands doesnt work

Installation of Arduino Uno R3 plus ESP01S wifi shield.

Trying to start webserver on wifishield with AT Commands from Setup function.

Doing this manually by typing in the serial monitor i get response, but not with "auto" commands.

In the end the arduino will be part of my home automation. Like controlling the Rollo. I need the webserver to communicate with my android phone. Communication by calling IP etc...

The following Code should Work, because "AT" returns "OK". But no answer. And this is my main Problem. When i know how to communicate in a correct way with the Shield, i can do the rest.

#include <AltSoftSerial.h>
// Arduino pin 08 for RX
// Arduino Pin 09 for TX
 
AltSoftSerial espSerial;
 
void setup(){
      int check = 1;
      Serial.begin(9600);
      Serial.println("Start");
      espSerial.begin(9600); 
     
      // Check connection
      if (check==1){
        Serial.println("Check connection"); 
        espSerial.print("AT");
        check = wait4result( "OK", 6000); // wait for esp to return "OK" or timeout after 1s if it doesn't appear.
      } 

int wait4result(char *s, unsigned short timeout) {
      unsigned long tm=millis();
      //print Return from ESP 
      while( millis() - tm <= timeout ) {
        if (espSerial.find(s)) { // match result
          Serial.println(s);
          return 1;
        }
      }
      // send timeout msg to console.
      Serial.print(F("TimedOutWaitingFor: "));
      Serial.println(s);
      return 0;
}

The Loop function is still empty. First i need to get the Basics running.

i connected the components like so in chapter "Setting up a local Server": How to Show Arduino Sensor Data on a Web Page - Circuit Basics but used the pins 8 and 9, because 0 and 1 only work with munally communication and Bare Minimum Sketch . And the library works with 8 and 9 i read somewhere.

ProgrammingSoftware: Arduino IDE
Tool-> Board -> Arduino Uno

this is not an arduino installation issue ➜ post moved to a more suitable location.

Do yourself a favour and please read How to get the best out of this forum

--

we miss plenty of information about your circuit, components etc...

Thanks for moving. I added all need Information. Should be good now.

Have you tried println() instead of just print?

Find has its own timeout at 1s if you don’t set it.

If you just started with this project and have not much code written yet for the arduino you should consider to replace your arduino by a ESP32-microcontroller which is able to do everything:

  • measuring temperatures
  • switching relays
  • creating PWM-signals
  • Real Time Clock
  • driving steppermotors / servos
  • etc. etc.

you would write the program for all and everything with the arduino-IDE just the same way as for the arduino
plus all the WiFi-WLAN-stuff including retrieving the internet-time right after connecting to your local WLAN.

The ESP32 has much more RAM and much more flash than an Ardiuno Uno
One difference to note: Voltage-Level is 3,3V So 5V-sensors require a voltage-level-shifter

best regards Stefan

@J-M-L I didnt know that will try it this weekend. Thanks alot!

@StefanL38 jup i know. But i'm an idiot and bought those esp01s for 12 bucks and now i force myself to use them. At least find out how to.
But one question: Is the esp 32 like esp8266 but more powerfull?
I guess in the end i will use them anyway. But first i want to find out how the esp01s work. Maybe someone has a solution or same problem.

qoogling is always worth 5 minutes
https://www.google.de/search?as_q=Arduino+ESP-01+library
found this

which has a code-example

https://www.google.de/search?q=Github+Arduino+ESP-01+library

Yes.

best regards Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.