Issue uploading Data to pachube

Hello,

I recently posted this same question in the programming guidance forum and realized that it was probably the incorrect sport for the question so I decided to post it here.
I’m a definite rookie with this stuff so please bare with me. I have an arduinio Uno with an ethernet shield connected up to two DS18B20 temperature sensors. I have been able to successfully get the temperature reading from both sensors and can verify it on my serial monitor. I have also successfully uploaded data to my pachube account. My problem is combining both steps together.

If I take the temp reading and assign it to a variable and try to upload it’s getting an error somewhere when uploading the data. If I take out the variable and just specify a static value it uploads fine.

Can someone please help me identify where my issue is?

Here is my code:

#include <OneWire.h>
#include <DallasTemperature.h>
#include "ERxPachube.h"
#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0xCC, 0xAC, 0xBE, 0xEF, 0xFE, 0x91 }; // make sure this is unique on your network
byte ip[] = { 192, 168, 168, 250   };                  // no DHCP so we set our own IP address

#define PACHUBE_API_KEY				"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // fill in your API key PACHUBE_API_KEY
#define PACHUBE_FEED_ID				xxxx // fill in your feed id

// I could not get parasite power to work, so I used 3 pins...
OneWire oneWireA(3);
OneWire oneWireB(2);


DallasTemperature sensorsA(&oneWireA);
DallasTemperature sensorsB(&oneWireB);



// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
DeviceAddress KeezerTemp = { 0x28, 0x03, 0x0D, 0xB7, 0x03, 0x00, 0x00, 0x58 };

float tempA;
float tempB;


ERxPachubeDataOut dataout(PACHUBE_API_KEY, PACHUBE_FEED_ID);

void PrintDataStream(const ERxPachube& pachube);

void setup() {

	Serial.begin(9600);
	Ethernet.begin(mac, ip);

        sensorsA.begin();
	dataout.addData(0);
	dataout.addData(1);
	dataout.addData(2);
}

void loop() {

        sensorsA.requestTemperatures();
        tempA = sensorsA.getTempFByIndex(0);

        sensorsB.requestTemperatures();
        tempB = sensorsB.getTempFByIndex(0);

	Serial.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
	
	dataout.updateData(0,(tempA));
	dataout.updateData(1, (tempB));
	
        
	int status = dataout.updatePachube();

	Serial.print("sync status code <OK == 200> => ");
	Serial.println(status);

	PrintDataStream(dataout);

	delay(5000);
}

void PrintDataStream(const ERxPachube& pachube)
{
	unsigned int count = pachube.countDatastreams();
	Serial.print("data count=> ");
	Serial.println(count);

	Serial.println("<id>,<value>");
	for(unsigned int i = 0; i < count; i++)
	{
		Serial.print(pachube.getIdByIndex(i));
		Serial.print(",");
		Serial.print(pachube.getValueByIndex(i));
		Serial.println();
	}
}

And here is some sample of the output shown from the serial monitor:

+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 3
<id>,<value>
0,71.712494                                                                                                                       _
1,71.599998                                                                                                                       _?
2,
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 3
<id>,<value>
0,71.712494                                                                                                                       _?
1,71.599998                                                                                                                       _?
2,
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 3
<id>,<value>
0,71.599998                                                                                                                       _?
1,71.599998                                                                                                                       _?
2,
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 3
<id>,<value>
0,71.599998                                                                                                                       _?
1,71.599998                                                                                                                       _?
2,
+++++++++++++++++++++++++++++++++++++++++++++++++

please advise.

Thanks,
Brad

Can you just show the actual change that triggers the problem - working version and broken version. A link to the actual library version you are using would be handy too.

If I specify/hardcode a value in the dataout.updateData lines it works.

for example, if I change out the following lines:

dataout.updateData(0,(tempA));
dataout.updateData(1, (tempB));

with

dataout.updateData(0,7);
dataout.updateData(1,8);

With the hard coded values I get the following output from serial monitor and its showing the status of 200

+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 200
data count=> 3
<id>,<value>
0,7
1,8
2,
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 200
data count=> 3
<id>,<value>
0,7
1,8
2,
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 200
data count=> 3
<id>,<value>
0,7
1,8
2,

I have attached the libraries I’m using. Let me know if you need more information. I appreciate the help!

Thanks for the help!
-Brad

libraries used.zip (77.1 KB)

Without looking at the library at all, one obvious difference is that the version that works is passing an int, not a float.

Try replacing this:

dataout.updateData(0,(tempA));
dataout.updateData(1, (tempB));

with:

dataout.updateData(0,(int)tempA);
dataout.updateData(1, (int)tempB);

And see if it at least sends the value, even if you've lost precision.

Thanks for the reply wildbill.

I added the change you recommended and it’s still not working. Here is the serial output from the change.

+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 2
<id>,<value>
0,72
1,71
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 2
<id>,<value>
0,72
1,71
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 2
<id>,<value>
0,72
1,71
+++++++++++++++++++++++++++++++++++++++++++++++++
sync status code <OK == 200> => 1
data count=> 2
<id>,<value>
0,72
1,71
+++++++++++++++++++++++++++++++++++++++++++++++++

thanks for the help!
Brad

On a whim I tried replacing the ethernet cable between the device on switch... it resolved the problem!!!

Thanks to the both of you for you help with this issue. I've been wrestling with this for way to long to find out that the cable was bad.

Thanks again!!

-Brad