hello guys do you know how to code load cell and gsm sim 900a without using softwareserial library but only altsoftserial. if the weight is below 0.5 kg the gsm will send to the receiver that the weight is below 0.5 kg
This should be good basis for your project. But I don't understand that without using AT COMMANDS..
How you want talk to GSM module, if it only accept AT commands that are sent over UART (software emulated)?
//SEND SMS IF VALUE < 0.5 KG
//Author: Martin Chlebovec (martinius96)
//Web: https://arduino.php5.sk?lang=en
//SIM900A + HX711
//Support: https://paypal.me/chlebovec
#include <AltSoftSerial.h>
#include "HX711.h"
#define DOUT 3
#define CLK 2
HX711 scale;
float calibration_factor = -50.10; //CALIBRATION FACTOR
unsigned long zero_factor = -90709; //ZERO FACTOR
unsigned long time_app = 0;
AltSoftSerial SIM900A;
const int mybaud = 9600;
void setup()
{
scale.begin(DOUT, CLK);
scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
scale.set_offset(zero_factor); //Zero out the scale using a previously known zero_factor
SIM900A.begin(9600); // the baud rate of GSM Module
Serial.begin(9600); // the baud rate of Serial Monitor (Arduino)
Serial.println ("SIM900A Ready");
}
void loop()
{
float value = scale.get_units(10); //average of 10 measurements --> GRAMS
if ((value < 500) && (millis() - time_app >= 300000 || time_app == 0 )) {
time_app = millis();
SendMessage();
}
if (SIM900A.available() > 0)
Serial.write(SIM900A.read());
}
void SendMessage() {
Serial.println ("Sending Message");
SIM900A.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000);
Serial.println ("Set SMS Number");
SIM900A.println("AT+CMGS=\"+000111222333 \"\r"); //Mobile phone number to send message
delay(1000);
Serial.println ("Set SMS Content");
SIM900A.println("Good morning, how are you doing?");// Messsage content
delay(100);
Serial.println ("Finish");
SIM900A.println((char)26);// ASCII code of CTRL+Z
}