I am developing a remote data system for household wind turbines for the Balkans. As a part of our pilot project we will be putting up weather stations that are powered by solar panels. We are using an Arduino Uno and a SM5100B shield to transmit all of our sensor data. The collection of data we have down, but transmitting it to our server is proving more difficult, which has PHP and MySQL installed. I would like to take our data and pass in to our MySQL server, probably through php. Initially I had come up with the idea of using the php parameter parse function which I thought was very straightforward and simple. You call up http://site.com/datSend.php?UTC=XXX&wMin=XXX&wMax=XXX and the php script would parse the values and insert into our database,. The nice part is that this method takes the load off the arduino immediately and puts it on the server.
The problem is that I have no idea how to connect to the site. I’ve tried the following but I get errors
AT+CGATT?
AT+CGDCONT=1,"IP","epc.tmobile.com"
AT+CGACT=1,1
AT+SDATACONF=1,"TCP","www.kosovowind.com/database/datSend.php?UTC=RightNow&LocID=1&wMin=1&wAvg=2&wMax=3",80 //Error Here
AT+SDATASTART=1,1
AT+SDATASTATUS=1
I am using Terminal v1.9 for testing before I get into writing the code. I am a Mechanical Engineering student so coding isn’t my forte but I do have a Computer Science student working with me.
I must be doing something wrong but I get 404 errors everytime I try to request any of my pages, this might because I am using Win7 Telnet and I can’t figure out how to add lines to the command. Also I’ve tried Putty but it crashes after I enter the third line.
EDIT: Nevermind I was being stupid and figured telnet out.
After I figure out telnet how do you suggest formatting that with AT commands?
Any suggestions?
Update:
So after a little more research I found that I should be sending this command:
AT+SSTRSEND=1,"GET /database/datSend.php HTTP/1.0\r\nHost: www.kosovowind.com:80\r\n\r\n"
```This gives "+CME ERROR: 4". The following doesn't give an error it doesn't seem to work either.
I am still looking for help regarding this topic. I have not been able to make any more progress on this. If anyone has info on people that have made web browsers with an Arduino using a GSM modulue/AT+ commands that could be a good base.
Use the Motorola C168i as suggested in the library (eBay). I’ve tried newer Tracfones but finding a data cable that would work is near impossible, find phones that use the headphone/mic jack for Tx/Rx/Grnd
Use the phone.SendEmail() command to send by values to an email address
Parse the email using Outlook VBA, I plan on switching to a server side script to make it automatic
Insert the parsed values into MySQL using ODBC (Outlook) or PHP (Server Side)
So far this method has been 100% reliable, I can even charge the phone with the 5V output on the Arduino, This really simplifies power connections. I’m having a little trouble receiving info back from the phone which I hope to fix soon. It’s great and I suggest you look into using actual phones.
Cost:
Phone: $2.00 + $8 Shipping
Audio Plug: $3
Monthly Plan: $10 - 1000 Text Messages via AT&T goPhone (new SIM card was free!)
I did finally get this damn thing working. I guess that your problem is that when using the at+sstrsend command, the scape character is ignored i.e. \r\n does not work. Therefore you have to use the at+sdatatsend command instead.
I leave you the code that worked for me here:
cell.println("AT+SDATATSEND=1,116");
Serial.println("AT+SDATATSEND=1,116: "); //Be careful with the size...
EsperamosOK("> "); //This function waits until the string is returned by the module.
cell.print("GET /save_data.php?user=test&temps="+String(tempc)+"×=20121228170000 HTTP/1.1\r\n"); // SIZE: 69
delay(100); //This is just a precaution, it may be unnecessary
cell.print("Host: glownt.net78.net\r\n"); // SIZE: 24
delay(100);
cell.print("User-Agent: Arduino\r\n\r\n"); // SIZE: 23
delay(100);
cell.write(26); //Ctrl+z ends the input
Serial.println("Sent!");
if (EsperamosOK("STCPD")==0)
Serial.println("Something received!");