jump to navigation

DS18B20 — External Power Connection — NOT WORKING February 18, 2012

Posted by rik94566 in 1-wire, aquaponic automation, aquaponics, arduino, DIY aquaponics, DS18B20, HEX code, sensor, Stainless Steel Temp Probe, Temperature Probe.
Tags: , , , , , , , ,
trackback

Well here we go.  My first attempt to read one DS18B20 using external power.  The only place I found as a source on how to connect this up is the circuit schematic that I talked about in a earlier post.

Here is again:

Starting point for connections for external power

So, working from the circuit schematic this was my best guess at how to go real world with connecting up my hardware. At this point all I want to do is to pull off a simple HEX code read from one DS18B20 probe. I also needed to add the 4.7K resistor between Power (red wire  + ) and the Signal (yellow wire) connection.  This is what is called a “PULL-UP” resister configuration.

Here is what I came up with for my first attempt at using external power to read a probe:

First attempt to power DS18B20 with external power

Next step was to determine what sketch I was going to work with to read the probe.  I wanted to keep it very simple and easy to determine results so I went with my HEX read sketch.

Here it is for your review:

// This sketch looks for 1-wire devices and
// prints their addresses (serial number) to
// the UART, in a format that is useful in Arduino sketches
// Tutorial:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

#include <OneWire.h>

OneWire  ds(8);  // Connect your 1-wire device to pin 8

void setup(void) {
Serial.begin(9600);
discoverOneWireDevices();
}

void discoverOneWireDevices(void) {
byte i;
byte present = 0;
byte data[12];
byte addr[8];

Serial.print(“Looking for 1-Wire devices…\n\r”);
while(ds.search(addr)) {
Serial.print(“\n\rFound \’1-Wire\’ device with address:\n\r”);
for( i = 0; i < 8; i++) {
Serial.print(“0x”);
if (addr[i] < 16) {
Serial.print(‘0’);
}
Serial.print(addr[i], HEX);
if (i < 7) {
Serial.print(“, “);
}
}
if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.print(“CRC is not valid!\n”);
return;
}
}
Serial.print(“\n\r\n\rThat’s it.\r\n”);
ds.reset_search();
return;
}

void loop(void) {
// nothing to see here
}

Now I had everything in place to determine my results.

Here is what returned:

Results when Sketch was run

The result was a blank, so no HEX code was found.  Clearly I had a problem with some aspect of how this configuration was connected.  I re-tested the HEX code sketch on a working configuration and it worked fine, so I knew the Sketch was OK.

Now the problem became why is this not working?

I needed help on how to figure this out.

Advertisements

Comments»

1. Chris - February 24, 2012

I think I know what your problem is. Try adding a ground wire from your external supply ground to a ground pin on the Arduino. Once you do this and add your pull-up resistor I think it will work. Like you I searched everywhere online and I have yet to see anyone showing a working example of a DS18B20 being powered with an external supply. I’m currently powering 9 DS18B20’s with an external supply. My goal is to connect 15 to 20 of them to measure temperatures throughout the house but I don’t have a working sketch yet that works with more than 9 of them.

rik94566 - March 27, 2012

Chris —
Thanks for the note and answer to the problem. I had worked out the answer before you responded. I just have been working hard on some other projects and not been able to blog about the solution. Now I will be back on track with this. I agree with you about lack of information on DS18B20’s and using a number of probes. I think the problem is that 1) people solve the problem in some way and fail to document the solution think no one is interested is seeing how others worked the problem out. 2) not a lot of people are going to spend the money to test and build a net work using 20 temp probes. Now that you asked about this, i am interested in seeing the breaking point on the external power source. I have the probes and just need to build the harness that will allow using the different resistors, as it my understanding the more probes you use you have to reduce the resistor value. Some even think on large networks a value of 1.0k ohm should be used. I have found no one that really knows or done it, just a number of people talking about it and reusing the same quotes from others. I will give it a go since I am this far into the project anyway.

rik

rnc.lsn - September 28, 2013

I’ve experimented the same problem: the DS18B20 works with Arduino power supply (5v pin) and it doesn’t with an external one (7805 voltage regulator). I’ve tried the solution by rik94566, connecting the ground of external supply circuit to Arduino ground, and now the sensor works fine with external power supply. Problem solved! Great!
Thanks

Alessandro

2. Alexis - February 27, 2012

I use DS99097U-9 instead of Arduino to get the data from the DS18B20 with external power, but it didn’t work also.
I try to use 10pcs of DS18B20 directly to the DS99097U-9 without power supply it works but sometimes it disconnects. Maybe due to the timing.
Do you have a sample using DS99097U-9?

rik94566 - March 27, 2012

Alexis – wish I could help you on this and maybe you have already solved your problem. I know nothing about Ds99097U-9. I only work with arduino as I am trying to solve specific problems with the least amount of learning curve. Even at that it takes me months sometimes to move forward do to my lack of electronics and programming background. O well on to the next problem to solve in my quest…..


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: