Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ROng1
Novice
1,964 Views

How to HTTP GET and POST using 3G shield with Intel Galileo Gen 2

Hello, I am trying to GET the value/s from the web using SIM5218E 3G shield with Intel GalGen2 and send it thru SMS. Do you have any documents or info regarding this matter? This is my only problem for it to work (I think, for now ).

Thank you in advance.

0 Kudos
9 Replies
FTinetti
Honored Contributor I
74 Views

Hi geonyt,

I don't have any 3G shield to replicate what you are trying to get. However, AT commands usually follow a fairly simple request-repy text protocol (I've used it in the ESP8266 wifi module, e.g. ). I',m assuming from a previous thread ( ) you have the 3G shield "Up&Running".

Maybe if you post your current code someone would be able to help.

BR,

Fernando.

ROng1
Novice
74 Views

Hi @FGT,

Yes. AT command works from my previous post. But, I'm working on HTTP GET which is not on the sample manual. I've tried replicating the arduino HTTP GET but no luck. Maybe I don't know when to use Serial and Serial1 for Intel Galileo.

FTinetti
Honored Contributor I
74 Views

geonyt wrote:

Hi @FGT,

Yes. AT command works from my previous post. But, I'm working on HTTP GET which is not on the sample manual. I've tried replicating the arduino HTTP GET but no luck. Maybe I don't know when to use Serial and Serial1 for Intel Galileo.

I see... please send the code you are currently trying to get it working... were you able to run the example in the document pointed out by Sergio in the other thread (http://www.intel.com/content/www/us/en/support/boards-and-kits/000020775.html )? More specifically, did you manage to use GPRS/IP setting?

Fernando.

ROng1
Novice
74 Views

Hello FGT, these are the raw codes that I am working and of course changing the asterisks fields with my data. I added Serial1.begin(115200); under setup and changing all Serial to Serial1 and no luck unlike from the GPRS example.

RAW Codes from https://www.cooking-hacks.com/documentation/tutorials/3g-gps-shield-arduino-raspberry-pi-tutorial# step15 3G/GPRS shield over Arduino and Raspberry Pi Section 15 HTTP and HTTPS Arduino

//Change here your data

const char pin_number[] = "****";

const char apn[] = "*********";

const char user_name[] = "*********";

const char password[] = "*********";

char url[ ]="test.libelium.com";

int port= 80;

char request[ ]="GET /test-get-post.php?a=1&b=2 HTTP/1.1\r\nHost: test.libelium.com\r\nContent-Length: 0\r\n\r\n";

int8_t answer;

int onModulePin = 2, aux;

int data_size = 0;

int end_file = 0;

char aux_str[50];

char data[400];

int http_x;

int http_status; // 0: end, 1 waiting data with header, 2 waiting data without header, 3 timeout waiting data, 4 unknow response

int x = 0;

long previous;

void setup(){

pinMode(onModulePin, OUTPUT);

Serial.begin(115200);

Serial.println("Starting...");

power_on();

delay(3000);

//sets the PIN code

sprintf(aux_str, "AT+CPIN=%s", pin_number);

sendATcommand(aux_str, "OK", 2000);

delay(3000);

while( (sendATcommand("AT+CREG?", "+CREG: 0,1", 500) ||

sendATcommand("AT+CREG?", "+CREG: 0,5", 500)) == 0 );

// sets APN, user name and password

sprintf(aux_str, "AT+CGSOCKCONT=1,\"IP\",\"%s\"", apn);

sendATcommand(aux_str, "OK", 2000);

sprintf(aux_str, "AT+CSOCKAUTH=1,1,\"%s\",\"%s\"", user_name, password);

sendATcommand(aux_str, "OK", 2000);

}

void loop(){

// request the url

previous = millis();

sprintf(aux_str, "AT+CHTTPACT=\"%s\",%d", url, port);

answer = sendATcommand(aux_str, "+CHTTPACT: REQUEST", 60000);

// Sends the request

Serial.println(request);

// Sends

Serial.write(0x1A);

http_status = 1;

while ((http_status == 1) || (http_status == 2))

{

answer = sendATcommand("", "+CHTTPACT: ", 60000);

if (answer == 0)

{

if (http_status == 1)

{

ht...

FTinetti
Honored Contributor I
74 Views

The contents and code at

geonyt wrote:

...

RAW Codes from https://www.cooking-hacks.com/documentation/tutorials/3g-gps-shield-arduino-raspberry-pi-tutorial%23... 3G/GPRS shield over Arduino and Raspberry Pi Section 15 HTTP and HTTPS Arduino...

seem to be interesting and useful, but right now I think they only add "noise". Please refer to my previous question:

did you manage to use GPRS/IP setting?

Just in case: use the code at section 22 of http://www.intel.com/content/www/us/en/support/boards-and-kits/000020775.html Shield Testing Report for Intel® Galileo Board, Intel® Galileo Gen 2... specifically about GPSR/IP setting and send the result, so maybe we'll be able to figure out the steps to follow and maybe using the code at https://www.cooking-hacks.com/documentation/tutorials/3g-gps-shield-arduino-raspberry-pi-tutorial# step15 3G/GPRS shield over Arduino and Raspberry Pi.

HTH,

Fernando.

idata
Community Manager
74 Views

Hello geonyt,

 

 

Do you have any updates about this? I agree with Fernando's last reply. Have you tried his suggestion? Let us know if you still need help and we'll try to assist you.

 

 

Pedro M.
ROng1
Novice
74 Views

Hello, I was able to make it work using section 22 and some modifications. Now, I'm working on sending SMS to multiple recipients. I think this is another thread.

Thank you for the help FGT and Intel Corp.

FTinetti
Honored Contributor I
74 Views

geonyt wrote:

Hello, I was able to make it work using section 22 and some modifications. Now, I'm working on sending SMS to multiple recipients. I think this is another thread.

Thank you for the help FGT and Intel Corp.

Great, and you are welcome,

Fernando.

idata
Community Manager
74 Views

Hi geonyt,

That's great to know. Thanks for the keeping us informed.

If you have further questions please don't hesitate to ask in the community. We are here to help.

Have a nice day.

Regards,

 

Diego V.
Reply