Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

iterfacing sim908 with arduino

Status
Not open for further replies.
Guyz im trying to interface sim908 with arduino uno the problem is when i send AT to sim908 the output should be OK but when i check the output with serial available and check it on serial monitor the serial monitor shows a series of AT and OK AT and OK continuously and the code doesnot get out of the loop of serial available what might be the problem please guide me i tried a lot but could not figure it out


This is the code for reference

#include <SoftwareSerial.h>
int ledPin = 13; // select the pin for the LED
void setup()
{
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
delay(1500);
Serial.println("AT");
delay(1500);
}
void loop()
{
while (Serial.available())
{
char inChar = (char)Serial.read();
Serial.write(inChar);
}



And this is the output:
AT
AT
OK
AT
OK
OK
AT
OK
OK
OK
AT
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
AT
OK
OK
OK
OK
 
Last edited:
Try dropping your serial speed to 9600
There should be an extra bracket at the end . You must have it there or it would not compile
Its repeating setup each time as part of the loop
It adds an extra OK each time

All of these should tell you something . You have but to look!
For your info on my ATMega328P without anything connected it shows AT only once and then outputs anything put into the send line
 
Last edited:
You are reading the output wrong.... The "AT" is sent to the 908 only once... The 908 will only reply with "OK"..
This can mean only one thing.... The setup function is being called again and again... This is being rebooted... Maybe the compiler has compiled with the missing brace at the end and the processor is having a stack underflow....
 
Status
Not open for further replies.

Latest threads

Back
Top