Good afternoon,
I am graduated student of Electronic engeenering and also a beekeeper. I took „GSM beehive scale” as a theme for my final exam. Looking on Net I have found some Arduino project and took some changes. I am using A6 GSM module and HX711 only (in original project it is used aditional DS18B20, DH11 sensors). I have connected it as in project:
HX711 Arduino
CLK A3
DOUT A4
A6 GSM Arduino
Rx D1 Tx
Tx D0 Rx
RST D7
Always when GSM is connected to Arduino, it is used D0(Rx) and D1(Tx) for connection with
Arduino. Here it is used D2 and D3. Is it correct?
Finally, how this program works? When I connect weight and start Serial monitor,
I got only:
wait= 1
wait= 2
wait= 3
maza in main is -345.6
and I do not receive any SMS.
is it possible to change program: to answer me when I send Arduino some string, for example:
weigh.
Please I need help.
Thanks
Here is a code I am using>
/////////////////////////////////////////////////////////////////////////////////////////////
#include "HX711.h"
#include <LowPower.h>
// Include the GSM library
#include <GSM.h>
//Initialize instances of the classes you're going to use. You're going to need both the GSM and GSMSMS class.
GSM gsmAccess;
GSM_SMS sms;
// PIN Number
#define PINNUMBER ""
// Array to hold the number to send sms
char numtel[20]= "xxxxxxxxxx";
float maza;
// ************** hx711
// HX711.DOUT - pin #A4
// HX711.PD_SCK - pin #A3
HX711 scale(A4, A3); // parameter "gain" is ommited; the default value 128 is used by the library
void setuphx711() {
// Start up the library
// zero factor from SparkFun_HX711_Calibration by sarahalmutlaq
//long zero_factor = scale.read_average(); //Get a baseline reading
long zero_factor = 8510214;
scale.set_scale(2280.f); // this value is obtained by calibrating the scale with known weights; see the README of the library for details
//scale.tare(); // reset the scale to 0
scale.set_offset(zero_factor); //Zero out the scale using a previously known zero_factor for a permanent weight on the scale
}
void readhx711(){
maza= scale.get_units(10), 1;
scale.power_down(); // put the ADC in sleep mode
delay(1000);
}
//Main Code
int wait=1;
void setup(void) {
// start serial port
Serial.begin(9600);
setuphx711();
}
void loop(void) {
Serial.print("wait =");
Serial.println(wait);
if(wait>=3){
scale.power_up();
delay(500);
readhx711();
Serial.print("maza in main is ");
Serial.println(maza);
delay(500);
// ************** GSM
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected)
{
if (gsmAccess.begin(PINNUMBER) == GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
delay(500);
// send the message
sms.beginSMS(numtel);
sms.print("zigizei");
sms.print(maza);
sms.print("grammaria ");
sms.endSMS();
Serial.println("\nto minima stalthike!\n");
wait=1;
}
delay(1000);//delay
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
wait++;
delay(500);
}