DS18B20 temperature sensor

Hi, Trying to add temperature to emontx with no luck. I using lastest emontx and have DS18D20 water proof kit.

Tried temperature search sketch and com is blank.

When I use emontx temperature power sketch it provides power ok but -12700 -12700 -12700 -12700 for temperature 1-4 ( note using one DS18B20 only). Assume this is to be expected if address is wrong in sketch in the first place?

I have checked wiring and looks ok , even comfirmed color code also white-data, red--VCC.

The solder links are untouched e.g. unjoined.

Any help appreciated.

Cheers

Peter

 

 

glyn.hudson's picture

Re: DS18B20 temperature sensor

 Hi Peter, 

It sounds like you are doing everything correct Can you measure the voltage on the VCC, data and GND connections on the sensor? Do your connections match those on the diagram on this page: http://openenergymonitor.org/emon/emontx/reference%20 ?

I take it that you have the correct software librarys and the example sketches compile ok?

Good luck,

Glyn.

 

PeterN's picture

Re: DS18B20 temperature sensor

Hi Glyn, I'm using latest libraries and sketches to compile and they upload ok. Yes used diagram you refer to even double checked color code e.g. data white, Vcc red.

Checked Voltage on jack with sensor pluged in and out (same values): readings were 5.09V Gnd - Vcc and 4.09V Gnd - data.

Cheers

Peter

glyn.hudson's picture

Re: DS18B20 temperature sensor

 Mmm, that sounds perfect. Could you try the 'simple' example in included in the temperature control library with the one wire bus set to digital 6? It should be set to 6 in the emontx temperature examples 

PeterN's picture

Re: DS18B20 temperature sensor

runs ok, same output ds18b20 plugged in or out,  result below

Single

Requesting temperatures...DONE
Temp C: 0.00 Temp F: 32.00
Requesting temperatures...DONE
Temp C: 0.00 Temp F: 32.00
Requesting temperatures...DONE
Temp C: 0.00 Temp F: 32.00
Requesting temperatures...DONE
 

Simple

Temperature for the device 1 (index 0) is: 0.00
Requesting temperatures...DONE
Temperature for the device 1 (index 0) is: 0.00
Requesting temperatures...DONE
 

Checked voltages again and look ok  e.g. 4v on (top jack) data and 5 v on Vcc (middle).

Think I need more kit to check which is at fault emontx or DS18B20. All kits tied up at present on trial so will have to wait till trial finished, other suggestions? Many Thanks. Cheers Peter

rogerrally's picture

Re: DS18B20 temperature sensor

I have just been struggling with the same issue of getting my temperature sensing to work.

Try using the OneWire - DS18x20_Temperature example sketch.

But change the following line from

OneWire  ds(10);  // on pin 10

to

OneWire  ds(4);  // on pin 4

This then worked for me and gave me the following information on my waterproof DS18B20

ROM = 28 E0 BB E0 3 0 0 A5
  Chip = DS18B20
  Data = 1 A0 1 4B 46 7F FF 10 10 6E  CRC=6E
  Temperature = 26.00 Celsius, 78.80 Fahrenheit
No more addresses.
 

glyn.hudson's picture

Re: DS18B20 temperature sensor

 Hi Peter,

It sounds like you might have a faulty sensor if you haven't had any luck I will send you a sensor which has been tested to work. 

Drop us an email to contact@megni.co.uk and I'll sort it

 

All the best ,

.

mlmunro's picture

Re: DS18B20 temperature sensor

This exact same thing is happening to me. How did this get fixed ?

fluppie007's picture

Re: DS18B20 temperature sensor

I added a 10000ms delay before the sketch uploads the address to the terminal screen. Otherwise I had no time to open the terminal/com screen.

See my attached sketch!

mlmunro's picture

Re: DS18B20 temperature sensor

OK, I think i have figured this one out by myself, the instructions say that the sensor can be wired up two ways and then show a diagram that includes the (unrelated at that point) picture of how to wire up the pulse sensor as well as the temperature sensor. That's the wiring that I have used (the pulse wiring) thinking that it was the recommended way to wire of the two.

It says that it is recommended not to use the parasite power version of wiring for reliability so I assumed that the diagram without the parasite label was the correct wiring (wrong)

Hope this helps others in the same position.

Cheers

mlmunro's picture

Re: DS18B20 temperature sensor

No, not working

Ian Eagland's picture

Re: DS18B20 temperature sensor

Hi

White wire to tip

Red wire to middle ring

Black wire to body ring

Check with a meter that you have continuity on all the wires from where they are soldered to the plug contact. I just had a dodgy plug where the tip was open circuit to the tag you solder to. I think it was a badly riveted.

Regards

Ian

Robert Wall's picture

Re: DS18B20 temperature sensor

"I think it was a badly riveted."

Very likely - I've had some of those. Soldering the rivet effects a permanent cure.

Jérôme's picture

Re: DS18B20 temperature sensor

Hi guys.

Same kind of trouble here. Brand new kit, trying temperature first. No luck.

All libs are freshly pulled.

I believe my wiring is correct. It looks like this :

I checked continuity from soldering point to plug contact.

EmonTX temperature power sketch

-12700 -12700 -12700 -12700

Voltages

Gnd (sleeve) : 0 V

Vdd (ring) : 5.26V

Data (tip) : 3.94V

temperature control library 'simple' example / one wire bus set to digital 6

Requesting temperatures...DONE
Temperature for the device 1 (index 0) is: 0.00

temperature control library 'single' example / one wire bus set to digital 6

Requesting temperatures...DONE
Temp C: 0.00 Temp F: 32.00 

OneWire - DS18x20_Temperature example sketch / OneWire  ds(4);  // on pin 4

No more addresses. 

EmonTX temperature search sketch

I added the following code to setup() :

  delay(3000);
 
  Serial.print("Nb : ");
  Serial.println(numberOfDevices);

and I get

Nb : 0 

 

Anything else I should be checking ?

Thanks in advance.

---------------------------------------------------------

Edit :

Robert Wall : Is the plug fully home and Is the socket making 3 good connections?

OK, thank you Robert. I didn't push hard enough (the whole thing looks so fragile...)

Now, I do get something :

EmonTX temperature search sketch

Nb : 1
{ 0x28, 0x80, 0x1D, 0x4E, 0x04, 0x00, 0x00, 0x0F } 

EmonTX temperature power sketch

2118 -12700 -12700 -12700

Since the code reads

emontx.T1 = sensors.getTempC(address_T1) * 100;

room temperature should be about 21,2 °C.

A cheap commercial device on a wall nearby reads 20,6°C

Great, now I can move on.

I leave the whole message here as an illustration of how you can find yourself searching for complicated answers to address trivial issues. And as a collection of tests to perform in such occasions, as well as a pointer to Robert's useful hint.

And while I was writing, output went down to

2062 -12700 -12700 -12700

meaning 20,6 °C.

Fine.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.