0

changed the firmware on SIM900B

try to send get request http://dummy.restapiexample.com/api/v1/employee/1 AT+HTTPACTION=0returned +HTTPACTION:0,200,98

but, when I try to read (AT+HTTPREAD or AT+HTTPREAD=0,98)the response data I got broken response

expected result:

+HTTPREAD:98
{"id":"1","employee_name":"Shibani","employee_salary":"999","employee_age":"0","profile_image":""}

and actual results:

+HTTPREAD:98
{"id":"1","employee_name":"Shibani","employee_salary":"999","empe_"0"olme"

+HTTPREAD:98
{"id":"1","employee_name":"Shibani","employee_salary":"999","empe_"0"fea"}

+HTTPREAD:98
{"id":"1","employee_name":"Shibani","employee_salary":"999""pea:,piig"

+HTTPREAD:98
{"id":"1","employee_name":"Shibani","employee_salary":"999",moeg""reae}

my Arduino code looks like that

void setup() {
  Serial.begin(9600);
  mySerial.begin(57600);
  delay(5000);
  mySerial.println("AT");
  Serial.println("End of the setup");
}

void loop() {
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
4
  • 1
    Edit the question : post your arduino code. Looks like a string overflow might be happening.
    – tavis
    Commented Nov 24, 2019 at 21:54
  • 1
    Maybe you're doing that silly "wait 5 seconds and assume there's a reply" thing I see all over the place. Or maybe you're using SoftwareSerial at 115200 baud... No one can know - unless you share your code...
    – Majenko
    Commented Nov 24, 2019 at 21:58
  • @Majenko, thanks, I've changed the baud to 9600 and it started work fine
    – JVic
    Commented Nov 24, 2019 at 22:22
  • @Majenko After doing mySerial.println("AT+HTTPACTION=0"); mySerial.println("AT+HTTPREAD"); delay(1000); //how do i get response without waiting a specific time.
    – b.john
    Commented Jun 16, 2022 at 6:23

1 Answer 1

2

Apparently you were running software serial at too high of a baud rate (57600) and bringing it down to 9600 fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.