Counter IR sensor with arduino to collect data to

I am newbie to and I want to connect the arduino to ethernet and send the data from sensor to thinger bucket.
I have arduino UNO Rev3, ethernet shield and the IR sensor E18-D80NK. Currently the combination of arduino + sd card reader + RTC1307 + IR sensor work perfect for me but I want to change it to send all data to thinger database.
My currently code is as follow:

#include “SD.h” // SD card libray
#include “Wire.h” // I2C
#include “Time.h” // Time Manipulation
#include “DS1307RTC.h” // DS1307 RTC

char timedatebuf[65]; // Time and Date string buffer
int year4digit; // 4 digit year

//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 10;

//the time when the sensor outputs a low impulse
long unsigned int lowIn;

//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 100;

boolean lockLow = true;
boolean takeLowTime;

int pirPin = A0; //the digital pin connected to the PIR sensor’s output
int ledPin = 13;

void setup(){
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(pirPin, LOW);

//give the sensor some time to calibrate
Serial.print(“calibrating sensor “);
for(int i = 0; i < calibrationTime; i++){
Serial.println(" done");
Serial.println(“SENSOR ACTIVE”);

Serial.print(“Initializing SD card…”);
pinMode(10, OUTPUT);

if (!SD.begin(10)) { // check if card is installed
Serial.println(“No SD Card present in module”);
Serial.println(“SD Card Ready”);


void loop(){
tmElements_t tm;
if(digitalRead(pirPin) == HIGH){
digitalWrite(ledPin, HIGH); //the led visualizes the sensors output pin state
//makes sure we wait for a transition to LOW before any further output is made:
lockLow = false;
Serial.print(“motion detected at “);
Serial.println(” sec”);

     if ( {  // Get Time/Date from RTC1307
  year4digit = tm.Year + 1970;  // 4 digit year variable
  // Format Time & Date string in timedatebuf
  sprintf(timedatebuf, "Time: %02d:%02d:%02d   Date:  %02d/%02d/%02d   ---->przejscie!!!",tm.Hour, tm.Minute, tm.Second, tm.Day, tm.Month, year4digit);
  File dataFile ="intruder.txt", FILE_WRITE);  // Open or Create file 

  if (dataFile) {  // Check if file exist on SD Card
     dataFile.close();  // Close file
  else {
    Serial.println("error opening intruder.txt"); // if file not on SD Card

     takeLowTime = true;

 if(digitalRead(pirPin) == LOW){      
   digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state

    lowIn = millis();          //save the time of the transition from high to LOW
    takeLowTime = false;       //make sure this is only done at the start of a LOW phase
   //if the sensor is low for more than the given pause,
   //we assume that no more motion is going to happen
   if(!lockLow && millis() - lowIn > pause){ 
       //makes sure this block of code is only executed again after
       //a new motion sequence has been detected
       lockLow = true;                       
       Serial.print("motion ended at ");      //output
       Serial.print((millis() - pause)/100);
       Serial.println(" sec");


and now I want to send the sensor data to thinger. I don’t know how to do this. On the google there are several examples but only with temperature sensors.
I understand that there is no need to add RTC module because when the data is send to thinger there is time stamp, am I right?

Welcome to the forum @Fala_Technicy

I didn’t read the code, due it is not posted in the right way, I’m going to assume that everything is working ok with your process.

You have two ways to upload the data from the device to thinger platform, one is by interrogatin from the cloud the device, and another is the device that uploads the data to the cloud (at an appropriate rate).

You need to define a “thing” that includes your variable (or variables), and then setup a bucket to interrogate or to listen when the device writes on it.

Check the documentation about this

To define the “thing” you can check the example sketch, that is the simplest way to define an output variable to upload to the platform.

Hope this helps