Topic: Missing character in temp display if >199F

Hi Everyone,

I am working on an engine temperature monitor using ESP8266-12E node mcu, three DS18B20 sensors on a One Wire interface, and RemoteXY to my iphone.

When any temp sensor goes over 199 degrees F the last character is occasionally missing... for example the display reads 199 then exactly at 200 the display reads "20" not "200". At 201F then it reads "201" and so on with an occasional lost last character.

I have confirmed via serial monitor that the esp8266 is in fact reading the correct temperature. Is it possible that the dtostrf is losing the last digit when converting to a string?

The behavior is the same whether I build this gadget with an ESP/wifi or Arduino Nano and a dsd-tech ble transceiver or only one temp sensor or three.

Thanks for your help!

   -- Corey Mugaas 2021
   uses esp8266 nodemcu wifi, temp sensor DS18B20, & displays temp on RemoteXY iOS app

//        RemoteXY include library          //

// RemoteXY select connection mode and include library
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "Engine Monitor"

// RemoteXY configuration, olive green background
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,0,0,7,0,31,0,13,103,0,
  101,114,97,116,117,114,101,0 };
// this structure defines all the variables and events of your control interface
struct {

    // output variables
char temp_1[7];  // string UTF8 end zero 

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop)

//           END RemoteXY include          //


// Setup a oneWire instance to communicate with any oneWire devices on pin 7
#define ONE_WIRE_BUS D2

// Pass oneWire reference to Dallas Temperature
OneWire oneWire (ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// Assign sensor name to individual sensor address

DeviceAddress Temp_1 = { 0x28, 0xFF, 0xD2, 0xFB, 0xAE, 0x20, 0x04, 0xD2 };

void setup()

  RemoteXY_Init ();
  // TODO you setup code
// start sensors


  // set sensor resolution to 10 bit
  sensors.setResolution(Temp_1, 9);

void loop()

  RemoteXY_Handler ();
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay()
// request temp data from temp senders

float TempRawData = sensors.getTempF(Temp_1);



// prep data for RemoteXY
// convert the temperature value into a string
// and place it immediately in the field text_1 patterns RemoteXY

  dtostrf(TempRawData, 0, 0, RemoteXY.temp_1);


2 (edited by Gunner 2021-10-02 22:49:55)

Re: Missing character in temp display if >199F

corey.mugaas wrote:

  dtostrf(TempRawData, 0, 0, RemoteXY.temp_1);

Have you tried adjusting the string length and possibly buffer?

dtostrf(floatvar, StringLengthIncDecimalPoint, numVarsAfterDecimal, charbuf);


floatvar =    float variable
StringLengthIncDecimalPoint = This is the length of the string that will be created
numVarsAfterDecimal = The number of digits after the deimal point to print
charbuf = the array to store the results

Also, is the display element large enough to accommodate all the digits?

"And voila, which is French for.......'and then I found out.'"


Re: Missing character in temp display if >199F

PS, it is much better to properly format your code when posting here... use the <> icon in the editor.

"And voila, which is French for.......'and then I found out.'"