Post topics, source code that relate to the Arduino Platform

User avatar
By l0ur3nz0
#7377 This has been driving me crazy!

No mater what I do I can't get and answer from the ESP-03. This module works fine with TTL-USB (ugraded the firmware, posted to thingspeak, ...)

When I hook it to the serial1 on leonardo (1k/2k level converter, also tried 10k/20k and 4050...) I can't get an answer!

I'm lost. Any pointers would be great.

thx
User avatar
By l0ur3nz0
#7726
Alex_S wrote:Hi!

You need to do the following connections:
1. CH_PD and GPIO0 - to VCC 3.3V
2. GPIO15 - to GND.


Thanks but, I can communicate via usb-ttl with AT commands so the module (tested ESP-03 and ESP01) is working as supposed to.
Also, I'm using an external power supply (breadboard PSU) so I don't (should not) have power issues.

Further tests (with arduino nano v4) showed me that I can get an answer to AT commands if I upload a blank sketch to arduino (works as a bridge, tx-to-tx, rx-to-rx).

If I upload a tested code, such like (obviously modified to suit my data and baudrates):
Code: Select all#include<stdlib.h>
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);</p><p>
#define SSID "[YOUR_SSID]"
#define PASS "[YOUR_PASSWORD]"
#define IP "184.106.153.149" // thingspeak.com
String GET = "GET /update?key=[THINGSPEAK_KEY]&field1=";
SoftwareSerial monitor(10, 11); // RX, TX

void setup()
{
  monitor.begin(9600);
  Serial.begin(9600);
  sensors.begin();
  sendDebug("AT");
  delay(5000);
  if(Serial.find("OK")){
    monitor.println("RECEIVED: OK");
    connectWiFi();
  }
}

void loop(){
  sensors.requestTemperatures();
  float tempC = sensors.getTempCByIndex(0);
  tempC = DallasTemperature::toFahrenheit(tempC);
  char buffer[10];
  String tempF = dtostrf(tempC, 4, 1, buffer);
  updateTemp(tempF);
  delay(60000);
}

void updateTemp(String tenmpF){
  String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += IP;
  cmd += "\",80";
  sendDebug(cmd);
  delay(2000);
  if(Serial.find("Error")){
    monitor.print("RECEIVED: Error");
    return;
  }
  cmd = GET;
  cmd += tenmpF;
  cmd += "\r\n";
  Serial.print("AT+CIPSEND=");
  Serial.println(cmd.length());
  if(Serial.find(">")){
    monitor.print(">");
    monitor.print(cmd);
    Serial.print(cmd);
  }else{
    sendDebug("AT+CIPCLOSE");
  }
  if(Serial.find("OK")){
    monitor.println("RECEIVED: OK");
  }else{
    monitor.println("RECEIVED: Error");
  }
}
void sendDebug(String cmd){
  monitor.print("SEND: ");
  monitor.println(cmd);
  Serial.println(cmd);
}
 
boolean connectWiFi(){
  Serial.println("AT+CWMODE=1");
  delay(2000);
  String cmd="AT+CWJAP=\"";
  cmd+=SSID;
  cmd+="\",\"";
  cmd+=PASS;
  cmd+="\"";
  sendDebug(cmd);
  delay(5000);
  if(Serial.find("OK")){
    monitor.println("RECEIVED: OK");
    return true;
  }else{
    monitor.println("RECEIVED: Error");
    return false;
  }
}

(code from http://www.instructables.com/id/ESP8266-Wifi-Temperature-Logger/step3/Arduino-Setup-and-Sketch/)

I don't get any answer.

I think it is supposed for me to see the AT reply from the ESP on the IDE monitor. Also, in the softserial monitor I get the errors that show me that the arduino can't find the strings it is looking for to carry on.
If I change the code to send the commands without validation the thingspeak plot don't get updated...

As I have no experience with bidirectional serial comm I'm lost. Could this be a sync issue?
User avatar
By NEOVIN
#7782 I had issues as well with getting garbage data out and no response to at commands.
The solution i found was the ESP didn't like the recived 5v, for a quck test i made a simple divider with 2 10k resistors and that was it it responded at every speed i tested.


(Arduino Tx)------{10k}-------v-------{10k}-------(Ground)
(ESP Rx Pin)