Yes, that’s fine.
Just post it with triple backticks at the beginning and end so that it displays correctly.
Triple backticks look like this:
```
Pete.
Yes, that’s fine.
Just post it with triple backticks at the beginning and end so that it displays correctly.
Triple backticks look like this:
```
Pete.
My materials atm are :
#include <SoftwareSerial.h>
#include "HX711.h"
#include <SparkFun_SHTC3.h>
SoftwareSerial gprsSerial(2,3);
#include <String.h>
#define DIGITALOUT 5 //HX711 DT
#define CLOCK 6 //HX711 CKL
SHTC3 mySHTC3;
HX711 scale;
float SCALE = -20160.96; //Set to 'false' on your first try, then enter your calibration factor
long OFFSET = 62037; //Set to 'false' if you dont know your offset / zero factor.
void setup() {
gprsSerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
while(Serial == false){};
Wire.begin();
scale.begin(DIGITALOUT, CLOCK);
scale.set_scale(-20160.96);
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor / OFFSET: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor / OFFSET: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
if(OFFSET){
scale.set_offset(OFFSET); //set offset
} else {
scale.tare(); //Else reset scale to zero
}
delay(1000);
}
void loop()
{
float RH,T,weight;
delay(1000);
RH = mySHTC3.toPercent();
T= mySHTC3.toDegC();
Serial.print("Weight: ");
Serial.print(scale.get_units(5), 1);
weight=(scale.get_units(5), 1);
Serial.print(" kg");
Serial.println();
Serial.print("Temperature = ");
Serial.print(T);
Serial.println(" °C");
Serial.print("Humidity = ");
Serial.print(RH);
Serial.println(" %");
delay(1000);
if (gprsSerial.available())
Serial.write(gprsSerial.read());
gprsSerial.println("AT");
delay(1000);
gprsSerial.println("AT+CPIN?");
delay(1000);
gprsSerial.println("AT+CREG?");
delay(1000);
gprsSerial.println("AT+CGATT?");
delay(1000);
gprsSerial.println("AT+CIPSHUT");
delay(1000);
gprsSerial.println("AT+CIPSTATUS");
delay(2000);
gprsSerial.println("AT+CIPMUX=0");
delay(2000);
ShowSerialData();
gprsSerial.println("AT+CSTT=\"gint.b-online.gr\"");//start task and setting the APN,
delay(1000);
ShowSerialData();
gprsSerial.println("AT+CIICR");//bring up wireless connection
delay(3000);
ShowSerialData();
gprsSerial.println("AT+CIFSR");//get local IP adress
delay(2000);
ShowSerialData();
gprsSerial.println("AT+CIPSPRT=0");
delay(3000);
ShowSerialData();
gprsSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\"");//start up the connection
delay(6000);
ShowSerialData();
gprsSerial.println("AT+CIPSEND");//begin send data to remote server
delay(4000);
ShowSerialData();
String str="GET https://api.thingspeak.com/update?api_key=Y92RLSQQQO5FIZON&field1=" + String(T) +"&field2="+String(RH) +"&field3="+String(weight);
Serial.println(str);
gprsSerial.println(str);//begin send data to remote server
delay(4000);
ShowSerialData();
gprsSerial.println((char)26);//sending
delay(5000);//waitting for reply, important! the time is base on the condition of internet
gprsSerial.println();
ShowSerialData();
gprsSerial.println("AT+CIPSHUT");//close the connection
delay(100);
ShowSerialData();
delay(5000);
}
void ShowSerialData()
{
while(gprsSerial.available()!=0)
Serial.write(gprsSerial.read());
delay(5000);
}
You don’t appear to be initialising your SHTC3 in your void setup.
I’m also surprised that you aren’t using a GSM library to take all the hard work out of the GSM communications.
Pete.
Isnt the wire.begin initializing the i2c comm? well that code is actually a 3 codes combination just for testing, i might add if i find any good example.
Maybe i should call mySHTC3.begin(); too u mean?
Compare this sketch to the one that you previously used which was working.
Pete.
Hmm ok will try that. Thanks a lot once more
Hi Mr Pete, i have made my code work afterall, but what library would u recomend me to use for that gsm to make it easier as u said?
TinyGSM
Pete.
Will give it a try if its easier than the one im using, but isnt library consume more butes from my memory?
It’s called TinyGSM for a reason!
Pete.
Hahaha true.
Dear Peter i would pleased if you could help once more with my project or anyone is welcomed to. For my gsm sim808 i was thinking to use a global sim so i wont have any problems with signal. My question is how to make the module connect to gprs to the operator with the strongest signal? I know it connects automatically to network but how to register to gprs and set the apn?
You don’t need to worry about that, your SIM provider takes care of it, and they will give you the necessary credentials to use with the SIM.
Many communications companies don’t really cater for IoT users very well, and some even block the Blynk communication protocol.
Personally, I use this company and find them to be excellent:
https://www.thingsmobile.com/private/thingsmobile
but I’m sure there are many other suitable providers.
Pete.
Thank you a lot Mr Peter you have been very helpfull.