Connection Problem on New Esp8266 Librarry


#1

Hi guys, i am trying this new lib and i can’t connect my arduino mega + esp8266 to Cayenne dashboard. It is not giving error but it is not working. I am using offical code and lib:

#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>

char ssid[] = “********”;
char wifiPassword[] = “****”;

char username[] = “";
char password[] = "
";
char clientID[] = "
******”;

#define EspSerial Serial1

ESP8266 wifi(&EspSerial);

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

EspSerial.begin(115200);
delay(10);

Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}

void loop()
{
Cayenne.loop();
}

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
Cayenne.virtualWrite(0, millis());
// Some examples of other functions you can use to send data.
Cayenne.celsiusWrite(1, 22.0);
Cayenne.luxWrite(2, 700);
Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“Channel %u, value %s”, request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}


#2

Do you see any messages in your Arduino IDE serial monitor?


#3

I can’t see anything on Arduino IDE serial Motor.


#4

add this to your code and see the error in serial monitor.

 #define CAYENNE_DEBUG

#5

I can’t see anything its maybe about my Esp 8266. Before i compile blink code to Esp8266 and after i tried to update Esp8266 but I couldn’t .


#6

did you try this?


#7

Yes, i tried. I can’t see anything.


#8

so can you post for us to know what the error is.


#9

It is not giving error but i will look one more ime.


#10

Nope i can’t see anything.


#11

change the baud rate on serial monitor to 9600


#12

#13

What ESP module are you using?

How are you powering your ESP, note that it is a 3.3V device and not 5 like the Mega. If you connect it to 5V, it will get really hot and might let out the magic smoke?

How are you connecting it to your Mega? Are the RX and TX pins reversed?

Did you ensure your ESP pins are configured correctly for run mode, and the EN pin is high?

Can you confirm what version of the AT command set is flashed to your ESP?

Cheers,

Craig


#14

I am using this one: https://www.direnc.net/esp8266-serial-wifi-modul

I am powering with 3.3V on Mega

My pinout is like this but i am just using esp8266:

http://maker.robotistan.com/wp-content/uploads/2016/03/ESP8266-bağlantı-şeması.jpg

What is EN pin?

I can’t confirm sir.

What is your advice?


#15

EN is CH_PD or just chip enable. Already done per your schematic.

You also need to pull up GPIO0 so you boot from the flash and not into the
bootloader. Needs a reset after that.

Try that and give us a screen grab of your serial monitor and get back to
us.

If it is not working, you will probably need to load the AT program into
your ESP flash.

Cheers,

Craif


#16

Also note that your Mega TX is driving 5V into a 3.3V input. Most ESPs can
deal with that, but I’m not sure about those. You can put a small value
resistor in line to help drop the voltage.

Cheers,

Craig

EN is CH_PD or just chip enable. Already done per your schematic.

You also need to pull up GPIO0 so you boot from the flash and not into the
bootloader. Needs a reset after that.

Try that and give us a screen grab of your serial monitor and get back to
us.

If it is not working, you will probably need to load the AT program into
your ESP flash.

Cheers,

Craif


#17

Can you tell me more clear this chapter: You also need to pull up GPIO0 so you boot from the flash and not into the bootloader. My English is ver bad. Also i am trying to update this Esp8266 withy this program but i can’t:


#18

Whatever state your GPIO0 is on power up is the mode you are in.

Flashing mode is Low. Run mode is High.

You are trying to flash right now, so you want Low.

You cannot flash through your Mega unless you write a program to redirect
the mega serial to your ESP board.

Best is to get a 3.3V USB to ttl serial adapter and connect directly to
your ESP.

Cheers,

Craig


#19

I am trying this post for flashing i dpn’t have ttl serial adapter right now. İ am trying with arduino uno but it’s not working too.


#20

Is your ESP GPIO0 tied to GND?

In your serial monitor, can you read the text when the ESP powers up?

If not, change the serial monitor baud rate until you do.

Use that baud rate to flash.

Cheers,

Craig