jump to navigation

DS18B20 — 2 HEX code temp probe reading — ERROR November 9, 2011

Posted by rik94566 in 1-wire, aquaponic automation, aquaponics, arduino, CEA, Controlled Environment Agriculture, DIY aquaponics, DS18B20, HEX code, indoor aquaponics, One-wire, probe index, sensor, Stainless Steel Temp Probe, Temperature Probe.
Tags: , , , , , , , , , , , , , , , , ,
trackback

Well here is my sketch that I adapted to my DS18B20 probes.  I set the sketch up to read probes 010 & 011.  I only did two probes so I could test out the sketch and make sure it was working correctly.

HERE IS THE SKETCH I STARTED WITH:


//
http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
//Changed sketch to handle individual temperature probes for testing out software and hub
//each probe is plugged into a wiring harness using either a 4.7K or 2.2K resistor configuration.
//will use this to test power soruce and resistor needed to read 5 temp probes.
//ver-1.01-R
// Rik Kretzinger
//    11/04/2011

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

// Data wire is plugged into pin 8 on the Arduino
#define ONE_WIRE_BUS 8

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// 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 Probe010 = { 0x28, 0xD4, 0x81, 0x31, 0x03, 0x00, 0x00, 0x23 };
DeviceAddress Probe011 = { 0x28, 0x4F, 0x6B, 0x31, 0x03, 0x00, 0x00, 0xF2 };

void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)

sensors.setResolution(Probe010, 10);
sensors.setResolution(Probe011, 10);
}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print(“Error getting temperature”);
} else {
Serial.print(“C: “);
Serial.print(tempC);
Serial.print(” F: “);
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}

void loop(void)
{
delay(2000);
Serial.print(“Getting temperatures…\n\r”);
sensors.requestTemperatures();

Serial.print(“Probe 010 temperature is: “);
printTemperature(Probe010);
Serial.print(“\n\r”);
Serial.print(“Probe 011 temperature is: “);
printTemperature(Probe011);
Serial.print(“\n\r”);

}

HERE ARE THE RESULTS:  (error occurred)

SO WHERE IS THE ERROR:

good news is that the “ERROR CAPTURE” in the sketch is working

Here is the problem:

Moral of the story —  make sure you check everything 2 or 3 times.    HEX code will more than likely where your problem maybe.  Also test your connections as they will give you the same error result.

Advertisements

Comments»

1. DS18B20 — 2 HEX code temp … – Aquaponic DIY Automation Blog | Free Aquaponics Tips - November 10, 2011

[…] aquaponics, One-wire, probe index, sensor, Stainless Steel … … See original here: DS18B20 — 2 HEX code temp … – Aquaponic DIY Automation Blog ← How Is Aquaponics More Sustainable Than Hydroponics? | Pet […]

2. terry king - November 10, 2011

Rik, the really important thing is that you took the time to consider errors in your code. Unfortunately much of the arduino code people show does not consider possible errors.

At IBM we put a lot of effort in code “walkthoughs” where we all tried to figure out what errors could occur and document the error checking. Then testing had to cause every error to occur to prove the error-checking worked.Semiconductor process equipment can be dangerous.

My group had a meeting about software reliability with the guys who wrote the code for the 1969 Moon landing. You may recall that some errors occurred during the critical landing phase. Houston understood the error codes, decided it was not critical, and said “GO”. Much later it was discovered that the rendezvous radar had been left on my mistake. Just one switch in the wrong position. Used too much CPU time in the little 32K machine and a few sensor readings were lost.

In your case these are not trivial things where some little robot may run into the wall.

FISH may die!

Regards, Terry King …On the Mediterranean in Italy

3. giant twist comfort cs - November 12, 2011

An attention-grabbing dialogue is worth comment. I feel that it is very best to write extra on this topic, it wont be a taboo topic even so normally individuals are not sufficient to speak on such topics. Towards the next. Cheers

4. Data Warehousing Case Study - November 14, 2011

http://www.emanio.com/data-warehousing/Data-warehousing-case-study.html Thanks for that awesome posting. It saved MUCH time 🙂

5. Dori Stymiest - November 15, 2011

It?s exhausting to seek out educated people on this subject, but you sound like you understand what you?re speaking about! Thanks

6. diarrhea remedies - December 4, 2011

I found this quote very fitting “Don’t fear failure so much that you refuse to try new things. The saddest summary of a life contains three descriptions: could have, might have, and should have.” — Louis E. Boone

7. vimax - December 5, 2011

*,very nice page, i certainly enjoy this website, keep on it, keeping on!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: