I am trying to set up an RF link using 2 SIM20 modules that I had in a drawer.
I can use them in the default transparent mode, but I want to set up a network ID etc, which is done by putting the devices into command mode, and writing to them with AT commands.
I remember before that I cant just send SIM.println("AT+SRDDATAR=?"); for example ( I am using NewSoftSerial ) as it is ignored
I played around with \n and \r and I can sort of get it working with the sketch below, but instead of returning the baud rate response, it returns either 33 or 161 or 67 in a random way each time I reset, (It should be a number from 0 to 7 ) followed by the "sent message" every 2 secs.
If I omit the SIM.print("\r\n"); before the AT command line, nothing is printed.
I have done a search on AT commands, and it looks like most times the serialPrintln is enough?
I dont want to send commands to change either unit if I cant get responses to keep an eye on whats happening, any ideas?
I have attached the AT commands manual for these units.
#include <NewSoftSerial.h>
#define RXPIN 14//
#define TXPIN 15 //
int AC2DPin = 17;
int serIn;
#define SIMBAUD 9600
NewSoftSerial SIM(RXPIN, TXPIN);
void setup()
{
Serial.begin(9600);
pinMode(AC2DPin, OUTPUT);
SIM.begin(SIMBAUD);
digitalWrite(AC2DPin, LOW); //command mode
delay(120);
SIM.print("\r\n");
SIM.println("AT+SRDUART=?");
if (SIM.available() > 0) { // get incoming byte:
Serial.println(" something available ");
serIn = SIM.read () ;
Serial.println(serIn );
}
digitalWrite(AC2DPin, HIGH); // data mode
}
void loop()
{
SIM.print("hellohello");
Serial.println(" sent message ");
delay ( 2000 );
}
SIM20_AT_Command_Manual_V1.04.pdf (396 KB)