Hello,
I´m searching for a way to send data every minute to a server. The place where the Arduino is going to be will be far away from any wifi, so I thought about using an SIM Card.
I tried to use the SIM800L module to simply send the temperature of a sensor to thingspeak server but I failed. And also I read that its not possible to send data this fast with this module.
Can you recommend any way?
Thank you!
Floduino:
far away
As in a galaxy far, far away?
No one can answer your question without more details. How far is "far away"? How much data? What is at the "remote place"?
What is the data? How many bytes at a time? How many bytes per second?
Its from an electrical meter chip (ADE9000). I want to send 3 Phase current, voltage, watts, pf. I want to use multiple ADE9000 on one Arduino. I thought about sending it every 2 - 4 seconds.
Sorry, I don't know what that means.
And the distance?
To what are you sending?
What Arduino board are you using?
I edited it. I want to use multiple ADE9000 chips on one Arduino DUE. (or Zero).
It´s really remote up to hundreds of km. I send the values to a server.
Paul_B
December 29, 2021, 11:19pm
7
So it doesn't have cellular phone access?
Its one option but the module I tried to use is just trash I think (or I am to stupid to use it). Do you know any module which would fit my needs?
I think that you need to tell us exactly which module of which you speak. A link to a data sheet or where you got it would help.
I don't think that you answered the question about how much data (in bytes) and how fast (bytes per second) the data have to be transmitted.
If you post the code that you tried, maybe someone can help you to get it to work better. Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Why is it so important that the data rate be fast, if you're only sending data once per minute?
Do you have cell phone access?
If not, a satellite modem is about the only option. Easy to use, Arduino compatible.
Hey, sorry for the delay.
So I tried to use the module called SIM800L. I used an external GSM Antenna on it. Not this cheap one.
Actually I don´t know exactly how much data it´s going to be in the end. I think I have to ask this question again if I can clarify this.
Thanks for the link with the satellite module!
How about 4G (LTE) Modules? Are there some which are working easily and reliable?
Code:
#include <SoftwareSerial.h>
#include <DHT.h>
SoftwareSerial debug(7, 8); // RX, TX
#define DHTPIN A0
#define Messintervall 15 // in Sekunden
DHT dht(DHTPIN, DHT11);
float humidity;
float temperature;
String myReadString() // Eine Zeile über serielle Schnittstelle einlesen
{
unsigned long startTime = millis();
char c = 0;
String message = "";
while (c != '\n' && (millis() - startTime <= 1000))
{
yield();
if (Serial.available()) {
c = Serial.read();
message += c;
}
}
return message;
}
void setup()
{
Serial.begin(115200); // SIM800L Kommunikation
dht.begin();
delay(500);
debug.begin(115200); // PC Kommunikation
debug.println("");
debug.println("Start");
delay(5000); // Zeit um SIM800L hochzufahren
Serial.println("AT"); // Kommunikation mit SIM800L prüfen
delay(1000);
char inser;
while (Serial.available()) // antwort einlesen
{
inser = Serial.read();
debug.write(inser);
if (inser == 'O')
{
inser = Serial.read();
if (inser == 'K') goto weiter; // ist "OK" entchalten?
}
}
debug.println("OK fon SIM800L Fehlt");
debug.println("Gehe schlafem Z.z...");
delay(2000);
weiter:
while (Serial.available()) debug.write(Serial.read()); //inputbuffer leern
humidity = dht.readHumidity();
temperature = dht.readTemperature();
debug.println(humidity);
debug.println(temperature);
int i = 0;
String dataIn;
delay(20000); // Zeit für SIM800L um sich im GPRS netz anzumelden
boolean Status = false;
int TimeoutZaeler = 0;
do
{
TimeoutZaeler++;
delay(10000);
Serial.println("AT+CGATT?"); // bei Mobilen Internet GPRS eingebucht?
delay(100);
while (Serial.available())
{
dataIn = myReadString();
if (dataIn.indexOf("CGATT: 1") >= 0) Status = true;
debug.println(dataIn);
}
if (TimeoutZaeler > 10)
{
delay(2000);
}
} while (!Status); // Versuche 10 mal in GPRS netz anzumelden
Serial.println("AT+SAPBR=1,1");
delay(100);
while (Serial.available())
{
dataIn = myReadString();
debug.print(dataIn);
}
Serial.println("AT+HTTPINIT"); // Aktiviere HTTP-Kommunikation
delay(100);
while (Serial.available())
{
dataIn = myReadString();
debug.print(dataIn);
}
String url = "https://api.thingspeak.com/update?api_key=TFJGWTU8FZCJUO84&field1=" + String(temperature, 1) + "&field2=" + String(humidity, 0);
Serial.println("AT+HTTPPARA=\"URL\",\"" + url + "\""); // Sende HTTP Anfrage
delay(100);
while (Serial.available())
{
dataIn = myReadString();
debug.print(dataIn);
}
Serial.println("AT+HTTPACTION=0");
delay(1000);
while (Serial.available())
{
dataIn = myReadString();
debug.print(dataIn);
}
delay(200); // Warten auf Serverantwort
Serial.println("AT+HTTPREAD=0,20");
while (Serial.available())
{
debug.write(Serial.read());
}
delay(2000);
while (Serial.available())
{
debug.write(Serial.read());
}
Serial.println("AT+HTTPTERM"); // Beende HTTP-Verbindung
delay(1000);
while (Serial.available())
{
dataIn = myReadString();
debug.print(dataIn);
}
Serial.println("AT+SAPBR=0,1");
delay(2000);
while (Serial.available())
{
debug.write(Serial.read());
}
delay(2000);
}
void loop() {
yield();
}
I want to have it every second...
As an update: I´m using a sim800l module. Power source is important to be constant and 2A