Go Down

Topic: Wifi module and remote server (Read 2161 times) previous topic - next topic

ignas

Hello guys,
I got stuck in one project, i got wifi module: http://www.ebay.com/itm/Uart-WiFi-Module-Starter-Package-Kits-Arduino-Compatible-/270941705511?pt=LH_DefaultDomain_0&hash=item3f15625527
I configured it and so on, my mission is to send some values to a remote server's php file, and php file needs to put those values to Mysql. My question is, should i use wifi.h library ? I used this code: http://arduino.cc/en/Tutorial/WiFiWebClient
and always what i am getting in my serial is - "Attempting to connect to SSID".. My idea is to pass values in address, like
http://example.com/arduino.php?temp=$value_from_arduino , php script is no problem for me. Thank you guys in advance.

SurferTim

Here is a topic that has both my Arduino client code and the php code for an Apache/mySQL server.
http://arduino.cc/forum/index.php/topic,124289.0.html
It is for the ethernet shield, but after the connection, it should be about the same.

PaulS

Quote
My question is, should i use wifi.h library ?

Use it for what? If you want to talk to the WiFi shield, you need some kind of library. The one that goes with your hardware is always best.

Quote
and always what i am getting in my serial is - "Attempting to connect to SSID".

Then, why are you worried about what needs to happen after you successfully connect to the wireless router? Connecting to the wireless router is essential if you are going to do anything with the network.


ignas

Okay, how can i connect to wireless router ?  seems like SurferTim's example is not connecting to router.

SurferTim

My code will not work without connecting to the wireless AP first. Mine is designed for the ethernet shield, which has no security settings.

You obviously have a wireless setting incorrect. Check the SSID, the security type, and passphrase if needed.

ignas

My wifi module is configured with other programme, it has SSID and WPA keys, your programme is not working for me, because you are using ethernet, and i am on my Wifi module.. can't find any example which suits me

SurferTim


.. can't find any example which suits me

I couldn't either, so I wrote my own using code others had posted here, combining/modifying them to my needs. The transport doesn't matter, only the protocol. Once the connection to the wireless radio is established, it is all the same.

Have you tried just a simple sketch to test connecting to your wireless system?

ignas

i just used example skecth: http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_186&products_id=1007
it prints Hello world in my http://192.168.1.158:8090/
i am thinking, that i could just print http request, but don't know how to write it, maybe it would work, don't know, i am bad in those wifi wireless and other networks. i am thinking smth like:
serial.println ("GET /suvis.wu.lt/arduino.php?temperatura=22 HTTP/1.1"); or
wlan.write ("GET /suvis.wu.lt/arduino.php?temperatura=22 HTTP/1.1");
Just need to write good http request, that maybe would work

SurferTim

Does that sketch WiFiWebClient respond with "connected to wifi"? Or doesn't it ever get that far? If it doesn't, you should check the SSID and security settings for your wireless network in your sketch.




ignas

nah it doesn't respond, that sketch is not for my hardware.. it is for arduino wifi webshield, mine is another one, from china.

ignas

okay, i got it working, my wifi module can work as a server and as a client, in my settings i putted wifi module to Client, gave them servers IP address, after that in my Arduino i wrote:
Code: [Select]

Serial.println("GET /temp.php?temp=656 HTTP/1.0");
Serial.println("Host: example.com");
Serial.println("");

Vuolia

Go Up