frejus
Sim900a : http://store.iteadstudio.com/index.php?main_page=product_info&products_id=522 and Arduino Nano - When I connect to SIM900A from the USB port all AT commands work just fine, including GPRS; - When I connect the Arduino nano to the USB port, with the below program, I do obtain as a result the exact string I type on Serial Monitor. Just fine. /* Simple Serial ECHO script : Written by ScottC 03/07/2012 */ /* Use a variable called byteRead to temporarily store the data coming from the computer */ byte byteRead; void setup() { // Turn the Serial Protocol ON Serial.begin(57600); } void loop() { /* check if data has been sent from the computer: */ if (Serial.available()) { /* read the most recent byte */ byteRead = Serial.read(); /*ECHO the value that was read, back to the serial port. */ Serial.write(byteRead); } } Now here is my problem : The program below should answer on Serial Monitor each time I type an AT command. But the only answer I receive is a few special characters, as if the baud speed is wrong. But speed is correct (57600) My TX and RX serial connection on the Arduino Nano are 4 and 5 Just can't do it by myslf, althoug I tried hard ! #include SoftwareSerial GPRS(4, 5); unsigned char buffer[64]; // buffer array for data receive over serial port int count=0; // counter for buffer array void setup() { GPRS.begin(57600); Serial.begin(57600); } void loop() { if (GPRS.available()) { while(GPRS.available()) { buffer[count++]=GPRS.read(); if(count == 64)break; } Serial.write(buffer,count); clearBufferArray(); count = 0; } if (Serial.available()) GPRS.write(Serial.read()); } void clearBufferArray() { for (int i=0; i { buffer=NULL; } }
Sinamics
Hi Frejus. As i understand, you want to send AT commands from Arduino NANO to Sim900 using Serial monitor, Your code seems a litttle to complex just for that task, you should try someting simple as this: #include SoftwareSerial mySerial(4, 5); void setup() { mySerial.begin(57600); // the GPRS baud rate Serial.begin(57600); // the GPRS baud rate } void loop() { if (mySerial.available()) Serial.write(mySerial.read()); if (Serial.available()) mySerial.write(Serial.read()); } This should be enough to get you going. It will read byte by byte from your consol(Serial) and write those commads out at pin 4 & 5. (mySerial) I got this info from THIS link. I have not testet the above code, but it should be very close to what you need.
frejus
Thanks mate. It is actually the Arduino Nano and not Uno. I tried your code but same. As per the thread you directed me to, I read the whole thing and they say it may be an auto-baud parameter on, that I may change by doing AT+ITR= .... whatever I have tried sending AT+ITR=57600 from the Serial Monitor but same bad results....
Sinamics
For me it looks like the Nano board are using port 1 & 2 not 4&5
frejus
Indeed, but SoftwareSerial mySerial ( 4 , 5 ) does refer to D4 and D5.
Sinamics
yep. You could try to remove the software serial libary and just use Hardware serial at pin 1 & 2 EDIT#1 That wont work either, as the mySerial is dependent on softwareserial.. I can fire up my dronecell and test this code..
frejus
Yep, done that, amending the code too : #include SoftwareSerial mySerial(0,1); void setup() { mySerial.begin(57600); // the GPRS baud rate Serial.begin(57600); // the GPRS baud rate } void loop() { if (mySerial.available()) Serial.write(mySerial.read()); if (Serial.available()) mySerial.write(Serial.read()); } Same problem. Different caracters though, but still bad ones :-) I am doomed... Thx God I am stubborn like an old mule :-)
Sinamics
Hi again.. hehe.. I brought down my old Sim900 ( not dronecell ) to my workshop... I had to try this.. And it worked. I was using this simple code with Arduino 2560. void setup() { Serial.begin(57600); Serial1.begin(57600); } void loop() { if (Serial1.available()) { int inByte = Serial1.read(); Serial.write(inByte); } } No more or less. Im not using SoftwareSerial, rather Hardware serial. This should work for you also, just connect sim900 to original TX/RX EDIT #1 I notice that your board does`t have second hardware serial and therefore the above code wont compile with (Serial 1 ) on Nano. You have to use this code, I tested it and its working. #include SoftwareSerial mySerial(10, 11); // SoftwareSerial RX, TX void setup() { mySerial.begin(57600); Serial.begin(57600); } void loop() { if (mySerial.available()) { int inByte = mySerial.read(); Serial.write(inByte); } if (Serial.available()) { int inByte = Serial.read(); mySerial.write(inByte); } } Connect sim900 tx/rx to pin 10 & 11 port. IMPORTANT! You have to share same ground between sim900 and Nano, If not the serial monitor will only trough out garbage. They wont talk with each other of not.
frejus
Have tried but same thing. Which sim900 are you using please ? Could you post a link or a pic ? Also, i guess your line 1 should be #include <SoftwareSerial.h> and not just #include Thx again for your help
Sinamics
Good morning. Yes, the first line should be #include <SoftwareSerial.h> This is exacly same board as i was testing with.
frejus
Look at what it tells me when I click on your link LOL. http://www.ebay.com/itm/Error?item=261032737732&errid=17 OK, great, thx, will try to find the same SIM900 on the French market.
Sinamics
The link works for me.. Yep, i think you will find these shields everywhere.
frejus
Oh yes I know it works for you :-) This is only to show you the country specificities, the same which forced me to flash this SIM900 with a special firmware :-) Thx again !
Sinamics
hehe I did`t thought france had such rules. I hope you will find another sim900 and get this working.
frejus
Here is my schematics, we never know ​http://drone-university.com/public/nano.png
Sinamics
Nice site you have Frejus. Your connections seems correct. When i look at the schematic for Nano, it seems like the pin 10 & 11 are routed to D7 & D8 Try to set pin 7 & 8 instead. SoftwareSerial mySerial(7, 8); Do you get any symbols in serial monitor if you short connect the Pin 7 & 8 or 10 & 11?
frejus
7 & 8 return the same special caracters. Sorry what do you mean by short connect ?
Sinamics
If you just connect the serial port together, it should give you some info in the serial monitor. Just to verify that you using correct pins.
frejus
No, I am not getting anything in the Serial Monitor when shorting 10 and 11. I reprogrammed for 7 and 8, same. And reprogrammed for 0 and 1, same. Oh dear... I am going out for a coffee. Really appreciated your help mate ! Thx
Sinamics
hehe.. I know on of my friends have a Nano board. I will get this and test later today. This issue got really annoying and i will find a solution..