Page 1 of 2

Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Tue Feb 02, 2016 10:57 pm
by hadialloha
Hi Cytron Technical Team,

I'm currently doing my final year project using WiFi to control some outputs. But I have this problem where the WiFi can't connect to the server. It can be connected to my network router SSID. I can see it said connected on the Serial Monitor. When I searched the IP address on Google Chrome, the "opps this webpage is not available" thing came out. And after awhile, when I looked at the Serial Monitor again, it said failed to connect to server. I'd really appreciate for a quick respond because I'm already behind my schedule by a few weeks. Thanks in advance! :D

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Wed Feb 03, 2016 8:44 am
by bengchet
Hi,

First you need to understand which setup you need for ESPWiFi shield, server or client.
If configured as server, you can send request to this shield to obtain information or do something else. Like you open your browser and type IP address, in fact you are sending request to the shield.
If configured as client, you are making shield as client to access other servers to obtain information.
Please do understand the concepts of web servers and web clients first so that you know which one is suitable for your current application.

If you are using example sketch CytronWiFiDemo, it consists of functions which make the shield act as both server and client. Understanding which role suits your application, you can make some adjustments to your program. To disable server role, just comment serverTest(). To disable client role, comment clientTest().

hadialloha WROTE:when I looked at the Serial Monitor again, it said failed to connect to server.

It was taking the role as client and trying to connect to Adafruit server and obtain some information but apparently it failed. So of course when you searched IP address on Google Chrome, it won't work because it was not server at that time.

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Wed Feb 03, 2016 12:00 pm
by hadialloha
Hi bengchet,

I already used the the SimpleWebServerWiFi example. This time around it connected to the wifi just fine and it can be seen its IP Address at the Serial Monitor. I have put an LED on pin 13 just like the program describe. But when try to run the IP Address to turn on the LED ( http://192.168.0.148/H) on Google Chrome, again the "this webpage is not available" came out.

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Wed Feb 03, 2016 2:37 pm
by bengchet
Hi,

For your case, if you cannot access the shield from Google Chrome, most likely the PC that you used doesn't connect to the WiFi same as the WiFi used by the shield. This sketch only allows access to shield within the same network. Of course, this is just hypothesis. Might have some other reasons. You can attach the photo showing the result from serial monitor.

Thank you.

Problem Solved!

PostPosted: Thu Feb 04, 2016 12:01 am
by hadialloha
Thank you so much bengchet. I just realize I didn't use the same WiFi on my laptop as the shield. But where do I make the changes in the programming to make it able to turn on the outputs without using the same WiFi. Because that's the whole point of my project. Do you have any arduino sketch for it?

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Thu Feb 04, 2016 1:42 am
by bengchet
Hi,

Glad to hear that. However also sorry to say that we don't have any example sketch for your application.

In fact, your application requires more than just example sketch to complete. Here I just give your a tip and it is better for you to dig it out on your own.

Use cloud service for your application. Cloud server is basically a public server for users to make application like yours. The concept is like: your Arduino + WiFi shield send (push) information about LED status or whatever device attached to Arduino, the information is stored in cloud server. Then you can use your phone, PC or devices which support WiFi connection, to access this server to obtain (pull) these information. You can also do another way round, like your PC push the data and Arduino pull the data. In this case, these 2 devices don't need to be connected to same WiFi. Generally it requires you to make an account (usually free one) to reserve a place for storing these informations, and also security to obtain these info.

ThingSpeak is a good start for you. There are plenty of tutorials explaining how to use this service. Time to explore the world of IoT :lol:

Have fun learning.

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Sat Apr 09, 2016 3:20 pm
by shack
Hi,

Regarding your Cytron Wifi shield, i can not find any code to connect your shield. when i try codes of the arduino Wifi shield it does not work as expected. So, is there any tutorial of your shield coding to sync to Thingspeak?

what i mean is, how to program using Cytron Wifi Library for ThingSpeak?

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Mon Apr 11, 2016 6:47 pm
by bengchet
Hi,

You can download and extract this library to My Documents->Arduino->Libraries. If you have old CytronWiFiShield library, save it as backup and move it to other place so these 2 libraries won't crash.

Additionally, you will need to install extra plugin. Open Arduino IDE, go to Sketch -> Include Library -> Manage Libraries. Look for 'ThingSpeak' Library by MathWork. Install it. After that you can restart Arduino IDE and compile example sketch named 'WiFiThingSpeak' under CytronWiFiShield. This example sketch might help you to kickstart your ThingSpeak application.

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Thu Jul 06, 2017 8:01 pm
by lingez
My serial monitor shows Failed to connect to server. Both my shield and laptop are connected to the same network. I want the arduino to act as the server. Please help. Every step I followed exactly as were instructed in the tutorial.

Re: Cytron ESP8266 WiFi Shield Failed to Connect to Server

PostPosted: Fri Jul 07, 2017 8:07 am
by bengchet
Hi,

The problem you have faced is that your shield is trying to connect to external server as client, and it requires Internet. If you are using CytronWiFiDemo sketch, you can try remove the line wifi.config(ip) in the sketch.

If you are focusing making server on Arduino, you can simply use SimpleWebServerWiFi example sketch to get started.