Hi all
Im having difficulty with a project im working on. Idea is to get a TXT alert when the fuel gets low on home heating system.
1st off I did get it to run once but its stopped after I tried something different with the code.
Im using USBasp to program the chip
Connections from the 85 to the sim800l are
Sim VVC to 5v supply
Sim GND to GND
TX to pin 2
RX to pin 3
85 pin 3 to 5v
85 pin 8 to GND
85 pin 4 is switched to GND
Here is the code that as worked once
#include <SoftwareSerial.h>
/* This code works with Sim800L and a push button
* Press the button to send a simple SMS/Text to a specified phone number
* Refer to www.SurtrTech.com for more details
*/
#include <SoftwareSerial.h>
SoftwareSerial sim800l(2, 3); // RX,TX for Arduino and for the module it's TXD RXD, they should be inverted
#define button1 4 //Button pin, on the other pin it's wired with GND
bool button_State; //Button state
void setup()
{
delay(40000);
pinMode(button1, INPUT_PULLUP); //The button is always on HIGH level, when pressed it goes LOW
sim800l.begin(9600); //Module baude rate, this is on max, it depends on the version
Serial.begin(9600);
delay(1000);
}
void loop()
{
button_State = digitalRead(button1); //We are constantly reading the button State
if (button_State == LOW) { //And if it's pressed
Serial.println("Button pressed"); //Shows this message on the serial monitor
delay(200); //Small delay to avoid detecting the button press many times
SendSMS(); //And this function is called
}
if (sim800l.available()){ //Displays on the serial monitor if there's a communication from the module
Serial.write(sim800l.read());
}
}
void SendSMS()
{
Serial.println("Sending SMS..."); //Show this message on serial monitor
sim800l.print("AT+CMGF=1\r"); //Set the module to SMS mode
delay(100);
sim800l.print("AT+CMGS=\"+447811168509\"\r"); //Your phone number don't forget to include your country code, example +212123456789" //sim800l.print("AT+CMGS=\"+*********\"\r"); //Your phone number don't forget to include your country code, example +212123456789" IDS
delay(500);
sim800l.print("Summer House Low on Fuel"); // sim800l.print("SIM800l is working"); //This is the text to send to the phone number, don't make it too long or you have to modify the SoftwareSerial buffer
delay(500);
sim800l.print((char)26);// (required according to the datasheet)
delay(500);
sim800l.println();
Serial.println("Text Sent.");
delay(43200000); //delay(500);
}
Any help much appreciated