-->
Page 1 of 1

how to wire an ESP-07 w/ FT232RL (?)

PostPosted: Fri Jun 12, 2015 6:04 am
by boneskull
This is what I have rigged up, as per the instructions here:

IMG_0295.jpg


To summarize as best I can:

  1. 3.3V (FT232RL) to VCC (ESP-07)
  2. Pullup to CH_PD
  3. GND to GND
  4. Pulldown to GPIO15
  5. TX to RX
  6. RX to TX
  7. RTS to REST w/ pullup
  8. DTR to GPIO0
  9. .01μF between 3.3V and GND

All resistors are 10kΩ. The slide switch changes between DTR and a pullup to GPIO0. Uploading works fine with the switch set to DTR. But I have a handful of questions:

  1. Is there any easier way to do this?
  2. Why 10kΩ resistors? Would 4.7kΩ suffice?
  3. After uploading, do I have to reset manually?
  4. I attempted wiring DTR to GPIO0 w/ a pullup, as per the diagram on GitHub. This didn't seem to do what I thought it would, which was boot the program I uploaded. I think perhaps the title of the diagram is misleading, because I can only upload if wired this way. Hence, the switch. Is it even possible to wire this thing so it will run code and enable uploading at once?
  5. I see very few of my "Serial.println()" calls when viewing the port, either in the Arduino IDE or CoolTerm. Is this a bug, or have I wired something incorrectly?
  6. From what I understand, the module will reset when REST falls from HIGH to LOW. Can this be triggered via the FT232RL? I could wire a momentary switch, but right now I'm just yanking the wire out to reset.
  7. Does a reset actually work after uploading my firmware, or do I need to power cycle the thing?
  8. What CPU frequency and flash size should I be using for an ESP-07?

Finally, below is the code I uploaded ("Zoltar.h" contains my SSID and password). Read a DHT22, connect to wifi, publish some crap to an MQTT broker. Again, I see maybe "Connecting to WiFi" and a few dots, but then everything grinds to a halt. Anything weird here?

Code: Select all#include <Zoltar.h>
#include <ESP8266WiFi.h>      //ESP library from http://github.com/esp8266/Arduino
#include <MQTT.h>
#include <PubSubClient.h>      // MQTT library from http://github.com/Imroy/pubsubclient
#include <DHT.h>      // DHT library from http://github.com/adafruit/DHT-sensor-library

#define DHTPIN 14     // what pin we're connected to
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE, 15);

const char *ssid =   BRIDE_OF_ZOLTAR_SSID;      // cannot be longer than 32 characters!
const char *pass =   BRIDE_OF_ZOLTAR_PASSWORD;      //
long previousMillis = 0;      // Timer loop from http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
long interval = 5000;        //
IPAddress server(10, 0, 0, 5);    // Update these with values suitable for your network.
PubSubClient client(server);

void connectToAP() {
  Serial.println("Connecting to WiFi");
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print('.');
    delay(500);
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: " + WiFi.localIP());
}

void connectToBroker() {
  Serial.println("Connecting to MQTT server");
  while (!client.connect("thermostat")) {
    Serial.print('.');
    delay(500);
  }
  Serial.println("");
  Serial.println("MQTT connected");
};

void setup() {

  // Setup console
  Serial.begin(115200, SERIAL_8N1);
  connectToAP();
  connectToBroker();
  dht.begin();
}

void loop() {
  client.loop();
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis > interval) {
    if (WiFi.status() != WL_CONNECTED) {
      Serial.println("Lost WiFi connection");
      connectToAP();
    }
    if (!client.connected()) {
      Serial.println("Lost MQTT connection");
      connectToBroker();
    }
    // Reading temperature or humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
    float h = dht.readHumidity();
    // Read temperature as Celsius
    //float t = dht.readTemperature();
    // Read temperature as Fahrenheit
    float f = dht.readTemperature(true);
    float c = dht.readTemperature();
    // Check if any reads failed and exit early (to try again).
    if (isnan(h) || isnan(f)) {
      Serial.println("Failed to read from DHT sensor!");
      previousMillis = currentMillis;
      return;
    }

    Serial.print("DHT sensor read F ");
    Serial.println(f);
    Serial.print("DHT sensor read H ");
    Serial.println(h);

    client.publish("digs/home/temperature", "{\"fahrenheit\": " + String(f) + ", \"celsius\": " + String(c) + "}");
    client.publish("digs/home/humidity", "{\"humidity\": " + String(h) + "}");
    previousMillis = currentMillis;
  }
}


thanks.

Chris

Re: how to wire an ESP-07 w/ FT232RL (?)

PostPosted: Sat Jun 13, 2015 5:23 am
by GerryKeely
Hi
I'll try an answer some of your questions
1.Is there any easier way to do this? - no if you want to use an auto programming cycle using DTR/RTS.
2.Why 10kΩ resistors? Would 4.7kΩ suffice? - I have an Olimex board and this uses 2k resistors so I beleieve 4.7K would be ok.

3.After uploading, do I have to reset manually? - You shouldn't have too, the DTR/RTS should reset the board(assuming you are using the esptool which comes with the Arduino ESP package.
4.I attempted wiring DTR to GPIO0 w/ a pullup, as per the diagram on GitHub. This didn't seem to do what I thought it would, which was boot the program I uploaded. I think perhaps the title of the diagram is misleading, because I can only upload if wired this way. Hence, the switch. Is it even possible to wire this thing so it will run code and enable uploading at once? - I would suggest using the pullup on GPI00.
5.I see very few of my "Serial.println()" calls when viewing the port, either in the Arduino IDE or CoolTerm. Is this a bug, or have I wired something incorrectly?-- The Arduino serial monitor will pull the RTS/DTR lines low putting the ESP board into programming mode.I don't use Coolterm but if this has the option to toggle the RTS/DTR lines try toggling the RTS line. This should cause a reset.
6.From what I understand, the module will reset when REST falls from HIGH to LOW. Can this be triggered via the FT232RL? I could wire a momentary switch, but right now I'm just yanking the wire out to reset. - Module resets when REST is brought from high to low and back high again.
7.Does a reset actually work after uploading my firmware, or do I need to power cycle the thing?- If using the esptool with the Arduino IDE it should do.
8.What CPU frequency and flash size should I be using for an ESP-07?- Not too sure but I think 80MHz and 256K.


Gerry

Re: how to wire an ESP-07 w/ FT232RL (?)

PostPosted: Sat Jun 20, 2015 11:30 am
by boneskull
Gerry, thanks for the reply. With your hints I have it working better.

I made the following adjustments:

- DTR -> GPIO0 w/ a pullup
- RTS -> REST w/ a pullup

This works for uploading, but if I want to see my output from Serial, I disconnect DTR and RTS (the pullups remain).

Esp8266 failing to read programme memory after power down.

PostPosted: Sun Jun 21, 2015 2:18 am
by satyasankar09
HI Gerry,

I programmed arduino sketch direct to ESP8266, then my code works fine, but when i remove usb to power off the board, and then power it up again and inserting USB, my code is not working. It seems like Esp8266 failing to read program memory. or is there anything i am missing when i am powering up the board.


waiting for your reply. hope could help me out.
Thanks


GerryKeely wrote:Hi
I'll try an answer some of your questions
1.Is there any easier way to do this? - no if you want to use an auto programming cycle using DTR/RTS.
2.Why 10kΩ resistors? Would 4.7kΩ suffice? - I have an Olimex board and this uses 2k resistors so I beleieve 4.7K would be ok.

3.After uploading, do I have to reset manually? - You shouldn't have too, the DTR/RTS should reset the board(assuming you are using the esptool which comes with the Arduino ESP package.
4.I attempted wiring DTR to GPIO0 w/ a pullup, as per the diagram on GitHub. This didn't seem to do what I thought it would, which was boot the program I uploaded. I think perhaps the title of the diagram is misleading, because I can only upload if wired this way. Hence, the switch. Is it even possible to wire this thing so it will run code and enable uploading at once? - I would suggest using the pullup on GPI00.
5.I see very few of my "Serial.println()" calls when viewing the port, either in the Arduino IDE or CoolTerm. Is this a bug, or have I wired something incorrectly?-- The Arduino serial monitor will pull the RTS/DTR lines low putting the ESP board into programming mode.I don't use Coolterm but if this has the option to toggle the RTS/DTR lines try toggling the RTS line. This should cause a reset.
6.From what I understand, the module will reset when REST falls from HIGH to LOW. Can this be triggered via the FT232RL? I could wire a momentary switch, but right now I'm just yanking the wire out to reset. - Module resets when REST is brought from high to low and back high again.
7.Does a reset actually work after uploading my firmware, or do I need to power cycle the thing?- If using the esptool with the Arduino IDE it should do.
8.What CPU frequency and flash size should I be using for an ESP-07?- Not too sure but I think 80MHz and 256K.


Gerry