Using DHT11 + HC-SR04 Ultrasonic sensor and ESP8266 as Wifi


#21

No you dont need to do anything with the ESP, just download the code and look the LED states of the ESP module, if the blue LED flashes means that is trying to connect with your local wifi network, with this configuration I was not able to check the ESP configuration usind the serial monitor of arduino IDE, thats why I had to check my router statistics to make sure the ESP had successfully connected to my router and received an IP address… Once I know the IP of the ESP module I was able to ping it.


#22

I understood @cassio.lucass.
I did the same as you said, checking my router and in fact my ESP is not connecting to my router.
Do you what can I do?


#23

It seems to me that your in AP mode as you mentioned you can see it listed on your computer as a hotspot. Is this a esp8266 shield? Are there dip switches?


#24

Yes, maybe, I dont see a reason that it wont work, if everything is exactly
like I did you should get it working… can you send pictures of your ESP
module, how it is connected to your arduino… ?


#25

The devices I am using are:

I took of the sensors because I am trying to first get conexion with Cayenne.

The ESP and Arduino are conected in this way:

The others pins if ESP are desconnected.

Without the sensors the code became:

//#define CAYENNE_DEBUG // Uncomment to show debug messages
//#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
//#include CayenneESP8266Shield.h

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = “*";
// Your network name and password.
char ssid[] = "
”;
char password[] = “******”;

// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);

void setup()
{
EspSerial.begin(9600);
delay(10);
Cayenne.begin(token, wifi, ssid, password);
}

void loop()
{
Cayenne.run();

}


#26

Hi Barbara, I will test it here and will let you know the results.


#27

Thanks!


#28

Barbara, your code didnt work here, please find below a working code for you and also the library which you need to copy to Cayenne folder (rename the .log file into .h)

Codigo.txt (586 Bytes)

CayenneESP8266Shield.log (1.1 KB)

For your information, if you want to use my complete code from the beginning of this post it will also request the Adafruit_Sensor.h file, just google it and download from Gift-hub.


#30

Maybe there was a problem during upload of the CayenneESP8266Shield.log file on the previous post, I have uploaded again, please try.


#31

Hello Cassio,
Sorry for bother you.
I really need to make the project work, It’s for College.
I don’t understand why it does not work. Did you make some change on you
router to get the ESP connected?
I am able to connect the arduino on Cayenne trough the USB conection, but
using the wifi shield that does not work.


#32

Hello Barbara I really don’t know,I didn’t need to make any more change to
make it work… Didn’t need any adjustment on the router.


#33

I see.
Which ESP firmware you used?


#34

Cassio, you are a Brazilian, right?
May I have your contact so we can talk in Portuguese?


#35

Is your esp firmware flashed for AT commands? Open serial monitor and try entering AT command and see if you get a response.


#36

No I can’t read anything on serial monitor, I don’t know if is because of
firmware or the way it is electrically connected.


#37

Do you see garbage characters or nothing at all?


#38

Garbage. But I didn’t worry about it as it connected and worked normally.


#39

That usually just means you have the wrong baudrate set for the serial monitor. Set it to whatever you have specified or just go down through one at a time and one of them will give you characters that actually mean something.


#40

Yes, my esp firmware is flashed for AT commands. I get “OK” when I type AT on the serial monitor.
I’m thinking that the problem can be with my firmware version. Do you know if those libraries work fine with any version?
The other problem I can think is with the electral power, because I am using the usb port of my computer. Does it make any sense?


#41

Understood. Thanks for the information I didn’t spend time on it because it
was working…