Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Programming Questions / Re: POST HTTP with AT Commands on: April 22, 2013, 03:31:02 am
To test your website or PHP code type the following in the address bar and see if it updates your SQL DB.

Code:
http://yoursitename.com/gettempdatatime.php?UNIT=x2&DATE=2012/8/9&TIME=9:8:01&TI=21.6&TO=25.26
2  Using Arduino / Programming Questions / Re: POST HTTP with AT Commands on: April 22, 2013, 03:24:13 am
Hi abhi111

All the Arduino code needed to post data is on the previous message at « Reply #5 on: 2013-01-05, 16:40:37 »


Below is my PHP code
Code:
<?
require("dbcon.php");


$sql = 'INSERT into `TempInfo`  (`UNIT_NAME`, `DATE`, `TIME`, `TEMP_IN`, `TEMP_OUT` )
        
        
        VALUES (\''.$_GET['UNIT'].'\',\''.$_GET['DATE'].'\',\''.$_GET['TIME'].'\',\''.$_GET['TI'].'\',\''.$_GET['TO'].'\',\')';

echo $sql;
$result = mysql_query($sql);
?>

I hope this helps
Good luck

Regards

Luan
3  Using Arduino / Programming Questions / Re: POST HTTP with AT Commands on: January 05, 2013, 09:40:37 am
Hi

As requested here is the code on the Arduino
I chanced the code from a Pachube example.

It still needs to be cleaned up and tested a few times.
 

Have a great day

:-)

Code:
void Send2Pachube()
{
  mySerial.println("AT+CGATT?");   //Attach or Detach from GPRS Service (Result  1 = Attach , 2 = Detached )
  delay(300);
  ShowSerialData();
 
  //mySerial.println("AT+CIPMUX=0");
  //delay(300);
  //ShowSerialData();
 
  //mySerial.println("AT+CIPMODE=0");
  //delay(300);
  //ShowSerialData();
 
  mySerial.println("AT+CIPSHUT=0");  //Close TCP Connection
  delay(300);
  ShowSerialData();
 
 
  //mySerial.println("AT+CSTT=\"internet\"");//start task and setting the APN,
  //delay(1000);
  //ShowSerialData();
 
  mySerial.println("AT+SAPBR=3,1,\"APN\",\"internet\"");//setting the APN, the second need you fill in your local apn server
  delay(1000);
  ShowSerialData();
 
  //mySerial.println("AT+CIICR");//bring up wireless connection
  //delay(300);
  //ShowSerialData();
 
  //mySerial.println("AT+CIFSR");//get local IP adress
  //delay(2000);
  //ShowSerialData();
 
  mySerial.println("AT+CIPSPRT=0");
  delay(3000);
  ShowSerialData();
 
  mySerial.println("AT+CIPSTART=\"TCP\",\"www.mysite.com\",\"80\"");//start up the connection

  delay(2000);
  ShowSerialData();
  Serial.println();
  mySerial.println("AT+CIPSEND");//begin send data to remote server
  delay(4500);
  ShowSerialData();
 


  mySerial.print("PUT /test/gettempdatatime.php?");//here is the feed you apply from pachube
  delay(500);
  ShowSerialData();
 
  mySerial.print("TI=");   //DATA feed name
  mySerial.print(GetAVG_TempOnOnePin( A0 ));   //DATA to send
  delay(10);
  ShowSerialData();
 
  mySerial.print("&TO=");   //DATA feed name
  mySerial.print(GetAVG_TempOnOnePin( A1 ));   //DATA to send
  delay(10);
  ShowSerialData();
 
  mySerial.print("&TR=");   //DATA feed name
  mySerial.print(GetAVG_TempOnOnePin( A2 ));   //DATA to send
  delay(10);
  ShowSerialData();
 
  mySerial.print(" HTTP/1.1\r\n");
  delay(500);
  ShowSerialData();
 
  mySerial.print("Host: www.mysite.com\r\n");
  delay(500);
  ShowSerialData();
 

  //mySerial.print("Connection: keep-alive");  //working
  mySerial.print("Connection: close");         //working as well
  mySerial.print("\r\n");
  mySerial.print("\r\n");
  //mySerial.println();
  delay(500);
  ShowSerialData();


  //mySerial.println((char)26);//sending
  mySerial.print(0x1A,BYTE);
  delay(500);//waitting for reply, important! the time is base on the condition of internet
  mySerial.println();
  ShowSerialData();
 
  mySerial.println("AT+CIPCLOSE");//close the connection
  delay(100);
  ShowSerialData();
 
  mySerial.println("AT+CIPSHUT=0");
  delay(100);
  ShowSerialData();
 
}
4  Using Arduino / Programming Questions / Re: POST HTTP with AT Commands on: August 02, 2012, 07:22:18 am
Hi All

We got it workig:

Here is the AT comands + output:

Code:
AT+SAPBR=3,1,"APN","internet"
OK

AT+CIFSR
41.15.5.196

AT+CIPSPRT=0
OK

AT+CIPSTART="TCP","www.Mysite.com","80"
OK

CONNEC

AT+CIPSEND
PUT /test/gettempdata.php?TI=19.12&TO=21.75&TR=32.63 HTTP/1.1
Host: www.Mysite.com
Connection: keep-alive


AT+CIPCLOSE
AT+CIPSHUT=0

CLOSE OK


Thank you  smiley
5  Using Arduino / Programming Questions / Re: POST HTTP with AT Commands on: August 02, 2012, 04:23:38 am
Hi Wolfgang

Thank you for the reply.

Do any one of you know where I can find an example on the server side to accept POSTs with PHP, similar than Cosm.
I want to store the data on my own site, Cosm only keeps data for 3 months.

Thank you

In advanced

ttfn

Luan
6  Using Arduino / Programming Questions / POST HTTP with AT Commands on: August 01, 2012, 03:07:55 pm
Hi All

Hope you are doing well

I am trying to post an HTTP URL with data to a website.
I tested it first on Cosm and it works on Cosm, but I want to emulate an entry in the address bar of IE.

If I type the following http://www.mysite.com/test/gettempdata.php?TI=12.1&TO=22.2&TR=33.3 in to the address bar of internet explorer it updates the MySQL DB and shows the DATA on the page.

How do I do the same with AT commands?
I am not sure if there need to be extra ""

I am using a SIM900 with Software Serial witch has a 64 Byte buffer.

I have tried the following:
Code:
AT+SAPBR=3,1,"APN","internet"
OK

AT+CIFSR
41.18.131.13

AT+CIPSPRT=0
OK

AT+CIPSTART="TCP","http:/www.mysite.com","80"
OK

CONNECT OK

AT+CIPSEND
http:/www.mysite.com/test/gettempdata.php?TI=25.5&TO=20.9&TR=16.7
SEND OK

AT+CIPCLOSE
AT+CIPSHUT=0

CLOSE OK
and

Code:
AT+CSQ
AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"

+CSQ: 12,0
AT+SAPBR=3,1,"APN","internet"
OK

AT+HTTPPARA="URL","http:/www.mysite.com/test/gettempdata.php?TI=25.5&TO=20.9&TR=16.7"
OK

AT+HTTPACTION=0
OK

+HTTPACTION:0,603,0
AT+HTTPREAD
OK

When I use HTTPPARA I do not get  response, if I use HTTPPARA with www.google.com I get a response when I run HTTPREAD

Any help would be appreciated.
Please let me know if I need to post the code as well.

Thank you in advanced

Regards

Luan
7  Using Arduino / Programming Questions / Re: SIM20 On Mega2560 on: August 01, 2012, 02:42:09 am
Hi All

See attached the new diagram with level shifting with transistors, works out cheaper than ICs.

Have a nice day

TTFN

:-)
8  Using Arduino / Programming Questions / Re: New SD card not working on: February 24, 2012, 03:05:49 am
Hi Nick

I am using 3V3 see logschemv1.png.

I will try other cards,
But what bothers me as per my first post the first 2 transcend cards I got works with no problems and the second batch of 16 transcend that looks the same does not work. It is supposed to come out of the same factory  smiley-cry.

It does write to the SD but with errors and it does not read the confic file the first time every time.
I can not use it if it it unreliable.
The errors on the new cards:
Quote
error: volume.init failed
SD error: 4,74
error: open failed
SD error: F,FC
error: close failed
SD error: F,FC
error: volume.init failed
SD error: 4,74
error: volume.init failed
SD error: 4,74

With the new Lib I don't have any problems on the old  2 transcend  and the the Legend works fine.

So let me try a different make.

Thanx

Luan
9  Using Arduino / Programming Questions / Re: New SD card not working on: February 24, 2012, 01:07:51 am
Hi All

In the code I check if the SD Card is inserted before it reads or writes data.
So if the SD card is reinserted it needs to load the new config.

Every time before I read or write to the SD Card I run IniSD()

Please let me know what the correct way is to to open the root multiple times with out errors?
I do it every time because the card can be removed and reinserted.

The rest of the code is in the previous post

Thank you

Regards


Code:
//_______________WriteData Begin________________________
void WriteData()
{
  if( (digitalRead(SDCDPin) == LOW) )
  {
      delay(10);
      Serial.println("Writing DATA");
      //__________Log data begin___________________

      MakeFileName();
      IniSD();
      delay(10);
      OpenFileAppend(bufferF);
      file.print(strM);
      file.print("\n");
      if (!file.close())
      {
         error("close failed");
         play_rtttl("No SD:d=8,o=7,b=200:a,f,a,f,a,f,a,f,a,f,a,f");
      }
      //__________Log data End___________________ 
  }

//_______________WriteData End________________________

void IniSD()
{
  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  // breadboards.  use SPI_FULL_SPEED for better performance.
  //if (!card.init(SPI_FULL_SPEED)) error("card.init failed");
  if (!card.init(SPI_HALF_SPEED)) error("card.init failed");  //2012/02/23 Changed to Half to avoid errors

  // initialize a FAT volume
  if (!volume.init(&card)) error("volume.init failed");

  // open the root directory
  //if (!root.openRoot(&volume))  error("openRoot failed");  //Removed error usning new LIB
  if (!root.openRoot(&volume)) ;
}

10  Using Arduino / Programming Questions / Re: New SD card not working on: February 23, 2012, 03:13:09 pm
As requested

Here is my code, I removed most of the bits that does not involve SD Cards.

If I put in line 1698 I get "error: openRoot failed" every time it writes to BTIME.TXT

Ho do I check to see if the root is open or not and only open if it is not already open?
In the old lib I changed the lib to not report a error if root is open but I did not want to mess with the new lib.

I am now using sdfatlib20111205

Thank you

Regards


Luan


11  Using Arduino / Programming Questions / Re: New SD card not working on: February 23, 2012, 01:55:47 pm
Hi Again

I also get the following error when writing to a file:
error: volume.init failed
SD error: 4,74

What does 4,74 mean?

Thanx
12  Using Arduino / Programming Questions / Re: New SD card not working on: February 23, 2012, 01:23:13 pm
Yes CrossRoads, I am also stumped.

That is why I am asking you guys to help because I tried many things.
I also formatted it with the PC as normal FAT and FAT32 with no joy.

I have a 1GB Legend SD Card and a 32MB SanDisk  it works fine.

So I think there is a problem with the batch of 16 SD Cards I got.
The problem is how do I swap them around because it seems to work fine on the PC.

Any one else there with any ideas or suggestions?

Do I need to post my Code?

Thanx so far

Regards

Luan
13  Using Arduino / Programming Questions / Re: New SD card not working on: February 23, 2012, 11:34:58 am
Hi

I tried SPI_FULL and SPI_HALF Speed.

I am Using the Adafruit Data logging shield for Arduino - v1.0 (http://www.adafruit.com/products/243)

The SD Cards Look the same in front but on the back the made in China is printed and on the other card the made in
China is stamped, but that should not make a difference.
The first two card I bought is working fine and the other 16 I bought a few months later is giving errors.

It seams to still write the data but it is giving errors.

I tried the SDFormatter in Quick and full format.

Thankx for helping so far.


14  Using Arduino / Programming Questions / Re: New SD card not working on: February 23, 2012, 11:18:39 am
Hi,

Yes, it works fine in PC and Camera.

So what else can I try?

Thank you
15  Using Arduino / Programming Questions / New SD card not working on: February 23, 2012, 10:20:45 am
Hi All

I have 2 Trancend 2GB SD cards that works just fine. Then I bought 16 new SD cards that looks the same but they are giving errors the whole time. I downloaded the latest SD Lib (sdfatlib20111205) and that did not help aswell. Please see SD_Bottom for differences, The Left one is working.

Before I Ran SDFormatter:
With the new SD Lib I am getting the following error :error: “ open failed
SD error: F,0
error: close failed”

After I ran SDFormatter: I now get the following error:
error: volume.init failed
SD error: F,0

The info on the working SD:
Quote
SdFat version: 20111205

type any character to start

init time: 474 ms

Card type: SD2

Manufacturer ID: 0X3
OEM ID: SD
Product: SD02G
Version: 8.0
Serial number: 3800818433
Manufacturing date: 5/2010

cardSize: 3862528 (512 byte blocks)
flashEraseSize: 32 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0X6,135,3862393
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT16
blocksPerCluster: 64
clusterCount: 60342
freeClusters: 60342
fatStartBlock: 136
fatCount: 2
blocksPerFat: 236
rootDirStart: 608
dataStartBlock: 640

The Info on the SD that is not working:
Quote
init time: 380 ms

Card type: SD2

Manufacturer ID: 0X3
OEM ID: SD
Product: SD02G
Version: 8.0
Serial number: 2780704448
Manufacturing date: 10/2011

cardSize: 3862528 (512 byte blocks)
flashEraseSize: 32 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0X6,135,3858489
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT16
blocksPerCluster: 64
clusterCount: 60280
freeClusters: 60123
fatStartBlock: 143
fatCount: 2
blocksPerFat: 236
rootDirStart: 615
dataStartBlock: 647
Data area is not aligned on flash erase boundaries!

Please help and let me know what I can do.

Thank you

Regards

Luan
Pages: [1] 2 3 ... 5