1

I have bought DS18B20 with RJ45 port on its end. It is dumb idea to connect it directly to the Ethernet port on the Pi? I did so, tried reading the temperature (http://www.reuk.co.uk/DS18B20-Temperature-Sensor-with-Raspberry-Pi.htm) but I cannot see the sensor in the w1/devices..

So do I need some 1-Wire interface with Ethernet port as a middleware? Or would it be better idea to cut of the RJ45 and connect the sensor wia GPIO?

Thanks If something is not clear I'll be happy to provide more info. I am kind of a beginer in this stuff.

EDIT: So I cut off the RJ45 and discovered that my sensor has 4 wires (http://rpishop.cz/862-thickbox_default/1wire-teplotni-senzor-ruzne-delky.jpg). So far I tried both data wires separately as in the above mentioned tutorial, but the sensor does not appear to be registered correctly:

 ls -l /sys/bus/w1/devices/
total 0
lrwxrwxrwx 1 root root 0 Jun  5 20:35 00-400000000000 -> ../../../devices/w1_bus_master1/00-400000000000
lrwxrwxrwx 1 root root 0 Jun  5 20:35 00-800000000000 -> ../../../devices/w1_bus_master1/00-800000000000
lrwxrwxrwx 1 root root 0 Jun  5 20:33 w1_bus_master1 -> ../../../devices/w1_bus_master1

As a pull-up resistor I've used two 18K in parallel.

4 Answers 4

6

Connecting the DS18B20 to the Ethernet port would either not work or the effort to make it work (even if it was possible) would be excessive for someone starting out with a Raspberry Pi.

As you state, cut off the RJ45 and connect the sensor with the black wire to ground, the red wire to the 3V3 pin and the blue or yellow (some are blue and some are yellow) wire to the GPIO4 pin. A resistor between the value of 4.7k Ohms to 10k Ohms needs to be connected between the 3V3 and GPIO4 pins to act as a ‘pull-up’ resistor.

enter image description here

If you can, it's handy to use dupont connectors on the ends of the wires to make it easy to connect them to appropriate GPIO headers.

enter image description here

I have published a few extra details of connecting a DS18B20 here if you need extra reference.

8
  • Thanks, but I somehow got this sensor with 4 wires (see rpishop.cz/862-thickbox_default/…) there are two data wires.
    – Filip
    Jun 5, 2016 at 15:00
  • OK. That's unusual. I haven't come across a DS18B20 with four wires before. Are you sure it's a DS18B20? Are there any external markings or do you know where it came from?
    – d3noob
    Jun 5, 2016 at 19:32
  • I hope it is correct sensor :D I've bought it in an e-shop which specializes on RPi and accessories - rpishop.cz/raspberry-pi-prislusenstvi/… (it's Czech lang) Also, on the cable is this gibberish text: HYBV 4X1/0.5 YD/T840-1996 Google found nothing
    – Filip
    Jun 5, 2016 at 20:03
  • OK. There is a documentation link on that page which leads you to this unipi.technology/wiki/1Wire_topology It looks like the sensor that you have is designed to interface with this unipi.technology. Have a read and see if it makes sense.
    – d3noob
    Jun 5, 2016 at 20:13
  • 1
    so the new sensor with ONLY 3 WIRES :D finally arrived and everything works.
    – Filip
    Jun 17, 2016 at 18:49
1

If it is a DS18B20 it would probably be simplest just to cut off the RJ45 plug and use the stripped wires.

Software and (terse) instructions at http://abyz.me.uk/rpi/pigpio/examples.html#Misc_DS18B20_py

0

I have worked quite a bit with the DS18B20 and other derivatives. The manufacturers specify a 4.7K pull up normally to +5 and sometimes to 3.3V. As soon as I went above 5K with a 5V system I started to have intermittent problems on several different systems. When using 3.3V I typically use a 3.9K for my pull up resistor. The Chinese had problems with the higher value pull up resistor. I have had very reliable results with this setup. I also connect the + to the power, this allows me to run several conversions and communicate with other devices at the same time. The 4 wires indicate to me that it was a RTD, typically a very accurate sensor. The current is supplied through a pair of wires, the voltage is measured across the other two. This is a 4 wire measurement of a resistor.

0

The same happened to me - RJ45 and 4 wires.

I have found the second picture here, 1Wire teplotní senzor, různé délky, describing that the ground is green which is usually black in 3 wire alternative:

Diagram of cable wiring

In this case we have 2 data wires.

I have used only 3 wires:

  • YELLOW - data,
  • GREEN - ground,
  • RED - VCC

Together with a 4.7k resistor as described above it works fine with Raspberry Pi.

For testing if the Pi recognizes the sensor I use the approach here, Raspberry Pi DS18B20 temperature sensor tutorial.

For reading temperatures within the Node.js app I use is ds18b20-raspi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.