Sensor data send to Sigfox (HEX)???

Hello,

I have big problem. I need Applications need to create with Arduino and TD1208 and temperature sensor. I have been now DS18B20 and do not know how to convert the appropriate type of mission and display the beckandu. Can someone please help me. I looked at examples of Akeru did not help me.

/* Akeru.h - sendSingleValues.ino
 * 
 * Copyleft Snootlab 2016
 * 
 * How to send a single analog value on the Sigfox network
 */

#include <Akeru.h>
#include <OneWire.h> 
#include <DallasTemperature.h>
// TD1208 Sigfox module IO definition
/*   Snootlab device | TX | RX
               Akeru | D4 | D5
               Akene | D5 | D4
            Breakout | your pick */
#define TX 2
#define RX 3
#define ONE_WIRE_BUS 7
OneWire oneWire(ONE_WIRE_BUS); 
DallasTemperature sensors(&oneWire);

// Sigfox instance management 
Akeru akeru(RX, TX);

int  TempInC;

void setup() 
{    
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  Serial.println("Starting...");
  
  // Check TD1208 communication
  if (!akeru.begin())
  {
    Serial.println("TD1208 KO");
    while(1);
  }
  
  //akeru.echoOn(); // uncomment this line to see AT commands
}

void loop() 
{
sensors.requestTemperatures();
sensors.getTempCByIndex(0);  
TempInC = sensors.getTempCByIndex(0);

float temperatureInCelsius = sensors.getTempCByIndex(0);

  //int sensorValue = analogRead(A0);
  
  // Trace on serial console
   Serial.print(temperatureInCelsius, 2);

  // convert to hexadecimal before sending
  String data = akeru.toHex(temperatureInCelsius); 
  
  // Send in the mighty internet!
  // akeru.sendPayload() returns 0 if message failed.
  if (akeru.sendPayload(data))
  {
    Serial.println("Message sent !");
  }

  // Wait for 10 minutes.
  // Note that delay(600000) will block the Arduino (bug in delay()?)
  for (int second = 0; second < 600; second++) 
  {
    delay(1000);
  }
}

just a wild idea: Try declare "String data" as a public variable

Please advise me how?
It's not as easy as everyone says ... I can not view the data in the backend float ever.

float-definiton is now global

/* Akeru.h - sendSingleValues.ino
 * 
 * Copyleft Snootlab 2016
 * 
 * How to send a single analog value on the Sigfox network
 */

#include <Akeru.h>
#include <OneWire.h> 
#include <DallasTemperature.h>
// TD1208 Sigfox module IO definition
/*   Snootlab device | TX | RX
               Akeru | D4 | D5
               Akene | D5 | D4
            Breakout | your pick */
#define TX 2
#define RX 3
#define ONE_WIRE_BUS 7

float temperatureInCelsius; // EDIT:  now decleared here

OneWire oneWire(ONE_WIRE_BUS); 
DallasTemperature sensors(&oneWire);

// Sigfox instance management 
Akeru akeru(RX, TX);

int  TempInC;

void setup() 
{    
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  Serial.println("Starting...");
  
  // Check TD1208 communication
  if (!akeru.begin())
  {
    Serial.println("TD1208 KO");
    while(1);
  }
  
  //akeru.echoOn(); // uncomment this line to see AT commands
}

void loop() 
{
sensors.requestTemperatures();
sensors.getTempCByIndex(0);  
TempInC = sensors.getTempCByIndex(0);

 temperatureInCelsius = sensors.getTempCByIndex(0); // EDIT:  instaed of here

  //int sensorValue = analogRead(A0);
  
  // Trace on serial console
   Serial.print(temperatureInCelsius, 2);

  // convert to hexadecimal before sending
  String data = akeru.toHex(temperatureInCelsius); 
  
  // Send in the mighty internet!
  // akeru.sendPayload() returns 0 if message failed.
  if (akeru.sendPayload(data))
  {
    Serial.println("Message sent !");
  }

  // Wait for 10 minutes.
  // Note that delay(600000) will block the Arduino (bug in delay()?)
  for (int second = 0; second < 600; second++) 
  {
    delay(1000);
  }
}

Thank You..but, In beckand shows some wrong hex. :confused:
Look

i do not know the 'akeru'...
The HEX-coverting ??

Try change "data = akeru.toHex(temperatureInCelsius);" to "data = String(temperatureInCelsius);"
or "data = String(temperatureInCelsius,HEX);

data is declared as a string and temperatureInCelsius is a float
..but I belive this typecasting is legal

Unfortunately I lists the wrong mission :frowning:

Print all sent info to serial, so you can see how it looks.
I guess you know the exact format the receiver wants.
...........
I'm sorry I cant guide you more.. I dont have the equipment to try this myself.

Hi, I solved it follows in beckand :o

It could be like this? But now I have the problem that when the device off and on again, so I sent an error value.

#include <Akeru.h>
#include <OneWire.h> 
#include <DallasTemperature.h>

#define TX 2
#define RX 3


const int pinCidlaDS = 7;
OneWire oneWireDS(pinCidlaDS);
DallasTemperature senzoryDS(&oneWireDS);
Akeru akeru(RX, TX);
float temperatureInCelsius; 

void setup() 
{
Serial.begin(9600);
senzoryDS.begin();

if (!akeru.begin())
{
    Serial.println("TD1208 KO");
    while(1);
  }
}

void loop() 
{
   senzoryDS.requestTemperatures();
  Serial.print("Teplota cidla DS18B20: ");
  Serial.print(senzoryDS.getTempCByIndex(0));
  Serial.println(" stupnu Celsia");
  
  temperatureInCelsius = senzoryDS.getTempCByIndex(0);

  String data = akeru.toHex(temperatureInCelsius); 
   if (akeru.sendPayload(data))
    {
    Serial.println("Message sent !");
  }
  for (int second = 0; second < 600; second++) 
  {
    delay(1000);
  }

}

After restart ARDUINO I´ts OK.

Nobody has any idea? ...After ARD on - send wrong data to beckand, after restart ARD maybe send 85 Celsia and third restart i´ts OK.