Code works on Arduino UNO, but not Sparkfun Thing Developer

Hi,

Obviously, rather new to all this, could really use your help!

Below code works on the Arduino UNO, but the readings come back ~30 degrees higher when I run the same code on the Thing Developer with the same wiring. I’ve limited to two sensors. Am using the 5V pin on the Thing Dev as power source.

Any ideas why it doesn’t give me accurate readings on the Thing? What could cause the difference running the exact same code on the Arduino UNO and Thing Dev, same wiring, same IDE?

Some things I’ve tried:

  • With other code, I get the right readings, but it doesn’t use the DallasTemperature Library (is that it? - how do I solve?? - got the latest update)

  • When I run below code with one sensor (either one), the temp comes back correct

Thanks!

/* YourDuino.com Example: Multiple DS18B20 Temperature Sensors

DS18B20 Pinout (Left to Right, pins down, flat side toward you)

  • Left = Ground

  • Center = Signal (Pin 10): (with 3.3K to 4.7K resistor to +5 or 3.3 )

  • Right = +5 or +3.3 V

terry@yourduino.com */

/-----( Import needed libraries )-----/

// Get 1-wire Library here: http://www.pjrc.com/teensy/td_libs_OneWire.html

#include <OneWire.h>

//Get DallasTemperature Library here: http://milesburton.com/Main_Page?title= … ol_Library

#include <DallasTemperature.h>

/-----( Declare Constants and Pin Numbers )-----/

// Data wire is plugged into port 5 on the Arduino (can be changed)

#define ONE_WIRE_BUS 5 // NOTE: No “;” on #define

/-----( Declare objects )-----/

// Setup a oneWire instance to communicate with any OneWire devices

// (not just Maxim/Dallas temperature ICs)

OneWire oneWire(ONE_WIRE_BUS);

// Pass address of our oneWire instance to Dallas Temperature.

DallasTemperature sensors(&oneWire);

/-----( Declare Variables )-----/

// Assign the addresses of your 1-Wire temp sensors.

// See the tutorial on how to obtain these addresses:

// http://arduino-info.wikispaces.com/Bric … individual

// WP 1

DeviceAddress Probe01 = { 0x28, 0xFF, 0xE0, 0x1E, 0x90, 0x15, 0x03, 0x66 }; // “4”

DeviceAddress Probe02 = { 0x28, 0xFF, 0x72, 0x5D, 0x90, 0x15, 0x01, 0x86 }; // “5”

// DeviceAddress Probe03 = { 0x28, 0x9A, 0x80, 0x40, 0x04, 0x00, 0x00, 0xD5 }; // “4” Again for test

// DeviceAddress Probe04 = { 0x28, 0x10, 0xA4, 0x57, 0x04, 0x00, 0x00, 0xA9 };

float sensortemp[4];

int i = 0;

void setup() /****** SETUP: RUNS ONCE ******/

{

Serial.begin(9600);

//------- Initialize the Temperature measurement library--------------

sensors.begin();

// set the resolution to 10 bit (Can be 9 to 12 bits … lower is faster)

sensors.setResolution(Probe01, 10);

delay(1000);

sensors.setResolution(Probe02, 10);

// sensors.setResolution(Probe03, 10);

// sensors.setResolution(Probe04, 10);

}//–(end setup )—

void loop() /****** LOOP: RUNS CONSTANTLY ******/

{

sensors.requestTemperatures(); // Send the command to get temperatures

Serial.print("1: ");

i = 1;

displayTemperature(Probe01);

Serial.print("sensortemp1 = ");

Serial.println(sensortemp[1]);

delay(1000);

Serial.print("2: ");

i = 2;

displayTemperature(Probe02);

Serial.print("sensortemp2 = ");

Serial.println(sensortemp[2]);

delay(3000);

}//–(end main loop )—

/-----( Declare User-written Functions )-----/

void displayTemperature(DeviceAddress deviceAddress)

{

float tempC = sensors.getTempC(deviceAddress);

if (tempC == -127.00) // Measurement failed or no device found

{

Serial.print(“Temperature Error”);

}

else

{

Serial.print(“C=”);

Serial.print(tempC);

sensortemp = tempC;
Serial.print(" F=");
Serial.println(DallasTemperature::toFahrenheit(tempC)); // Convert to F
}
}// End printTemperature
//( THE END )**