Hi,
I have been working on a project to create a simple feeder for a farm, am using Arduino UNO with SIM800L, everything works fine, am sending SMS to GSM Module (SIM800L) and once the SMS is received the according to the SMS Text the relevant commands are executed, That's been said,
The Problem is without Software Serial how to make it work, I means once done, I wanna powerup the Arduino from a power source (power adapter and power up the SIM800L as well), but without Software Serial monitor it seems not Working,
Can't we connect Directly the Arduino UNO TX, RX pins with SIM800L (RX,TX pins) including 10K resistors..?
Please Advice
Hello, do yourself a favour and please read How to get the best out of this forum
➜ provide your code
➜ provide information about your module
do I assume correctly that this "without Software Serial monitor" refers to the IDE's builtin Serial monitor and that it has nothing to do with Software Serial ?
if the question is about getting rid of Software Serial to use Hardware Serial and pins 0 and 1, sure it's possible but your code needs to take that into account and if your module is not 5V compliant then you need to adapt voltage.
Thanks you very much, its great to know that it possible to be done,
and could you suggest a sample code or tutorial where i can get more details,
main thing i wanna do is, the Arduino should be powered and it should be able to handle the work without the help of a Computer hooked up all the time, please suggest.
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4
char replybuffer[255];
SoftwareSerial sim800l = SoftwareSerial(FONA_TX, FONA_RX);
Adafruit_FONA gsm = Adafruit_FONA(FONA_RST);
//uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);
void setup() {
Serial.begin(9600);
sim800l.begin(9600);
if (! gsm.begin(sim800l)) {
Serial.println(F("Couldn't find SIM800L!"));
while (1);
}
pinMode(8,OUTPUT);
pinMode(12,OUTPUT);
}
void sendSMS(){
char sendto[21] = "094XXXXXXXXXX";
char message[141] = "OK TASK DONE;
gsm.sendSMS(sendto, message);
delay(1000);
}
void readSMS(int smsn){
uint16_t smslen;
/*if (! gsm.getSMSSender(smsn, replybuffer, 250)) {
Serial.println("Failed!");
return;
}
Serial.print(F("FROM: "));
Serial.println(replybuffer);*/
//Serial.print(F("\n\rReading SMS #"));
//Serial.println(smsn);
if (!gsm.readSMS(smsn, replybuffer, 250, &smslen)) { // pass in buffer and max len!
Serial.println(F("Failed!"));
return;
}
//Serial.println(replybuffer);
//Serial.print("SMS NO : ");
//Serial.println(smsn);
//lets do an action here
String repBufStr = String(replybuffer);
if(repBufStr.equals("Light1 on")){
Serial.println("TURNING ON BLUE LED LIGHT SUCCESS");
digitalWrite(8,HIGH);
sim800l.println("AT+CMGD=1,4");//del all sms
}
else if(repBufStr.equals("Light1 off")){
Serial.println("TURNING OFF BLUE LED LIGHT SUCCESS");
digitalWrite(8,LOW);
sim800l.println("AT+CMGD=1,4");//del all sms
}
else if(repBufStr.equals("Light2 on")){
Serial.println("TURNING ON GREEN LED LIGHT SUCCESS");
digitalWrite(12,HIGH);
sim800l.println("AT+CMGD=1,4");//del all sms
}
else if(repBufStr.equals("Light2 off")){
Serial.println("TURNING OFF GREEN LED LIGHT SUCCESS");
digitalWrite(12,LOW);
sim800l.println("AT+CMGD=1,4");//del all sms
}
//end of action code here
}
void doAction(String smsText){
//Serial.println("DOING ACTION UPON SMS");
if(smsText=="Lights on"){
Serial.print("TURNING ON LIGHTS");
//sendSMS();
}
//Serial.println(smsText);
//Serial.println("end of action ......");
}
void loop() {
updateSerial();
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
sim800l.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(sim800l.available())
{
Serial.write(sim800l.read());//Forward what Software Serial received to Serial Port
readSMS(1);
}
}
I have found a code then i did some modifications to the existing code.! credits goes to original author who developed the code.!
Just use the hardware serial port for your module.
Your code offers an interface through the serial monitor - of course that needs to be removed if you are not connected to a computer.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.