Photon Maker Kit - DS18B20 - temperature sensing issues/questions

I also really struggled with this one for a long time before finding this thread.
I tried different resistors, capacitors and even different cables to no avail.

As a work around (I’m new to this type of stuff, so it isn’t perfect…)
I created a check in the form of an If statement then set it to ignore any value less than -50C. Have been testing it for a good 15-20minutes and so far so good.

Code for anyone else that needs it.
Please note - this code was originally from the book under file: p-10-thermometer-dallas.ino

    // This #include statement was automatically added by the Particle IDE.
#include "OneWire/OneWire.h"

// This #include statement was automatically added by the Particle IDE.
#include "spark-dallas-temperature/spark-dallas-temperature.h"

#include "OneWire/OneWire.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"

double tempC = 0.0;
double tempF = 0.0;
//New variable added to check the Temp before assigning a new value to tempC
double tempCheck = 0.0;

int tempSensorPin = D2;

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

void setup() {
    sensors.begin();
    Spark.variable("tempc", &tempC, DOUBLE);
    Spark.variable("tempf", &tempF, DOUBLE);
    //Added in a new tempCheck variable - not sure if this is needed, but followed for consistency
    Spark.variable("tempCheck", &tempF, DOUBLE);
}

void loop() {
  sensors.requestTemperatures();
  //This next line assigns the current temp to the 'Check variable'
  tempCheck = sensors.getTempCByIndex(0);
  //This statement checks to see if the temp is less than -50 deg C - I selected -50C as the sensor for me isn't going to get that cold
  //You can select a different minimum temp, I avoided setting it to -127 as I wasn't sure if there were rounding or decimal issues which I didn't bother checking for
  if ( tempCheck < -50 )
  {
      //The below statement leaves tempC as is if the sensor reports < -50C
      tempC = tempC;
      delay(1000);
  }
  else
  {
    tempC = tempCheck;
    tempF = tempC * 9.0 / 5.0 + 32.0;
  }
}

I hope this helps anyone else who can’t seem to fix the problem at the source.
If there is a better way to write a check statement - please let me know.

Cheers,