Rinsen / OneWire

One Wire via DS2482-100 or DS2482-800 for Windows or Linux based Raspberry Pi IoT solutions
MIT License
33 stars 14 forks source link

Wiring for DS18B20 #8

Closed MattSpeakman closed 6 years ago

MattSpeakman commented 6 years ago

For the DS18B20 thermistor do you just need to connect it to any one of the GPIO ports?

Thanks

Rinsen commented 6 years ago

You don't connect it to any GPIO pin at all since a RaspberryPi have no native OneWire support.

What you need is a DS2482 chip in between like this one. https://www.modmypi.com/raspberry-pi/sensors-1061/kits-and-interface-boards-1062/r-pi-i2c-1-wire-owfs-expansion-module-

chrisahardie commented 6 years ago

@Rinsen Do you have a Fritzing diagram / pictures to indicate how things are wired up? Thanks!

Update: Presume this would do the trick? http://raspberrypi.tomasgreno.cz/thermal-sensor-i2c.html

Rinsen commented 6 years ago

Yes, that is how I use it @chrisahardie

chrisahardie commented 6 years ago

@Rinsen I picked up the unit you linked to above, but I can't find a datasheet for it anywhere. My DS18B20 has three wires for ground, power, and data, but there are 6 terminals in the unit:

1-wire

The terminals are labelled:

GND
+5v

DQ
1wire GND
PWR GND
+5v

I presume my data wire should be screwed into DQ and the ground wire into 1wire GND - should the power wire be screwed into the bottom +5v?

I've tried different combinations and I am getting No DS2482-100 detected, check that AD0 and AD1 is correct in ctor and that the physical connection to the DS2482-100 one wire bridge is correct.'

Thanks!

Rinsen commented 6 years ago

Hi!

I am not at home right now, but will get back to you as soon as I am so I know that I answer in the same way as I use it.

chrisahardie commented 6 years ago

Thanks @Rinsen !

Rinsen commented 6 years ago

That error is related to not finding any DS2482-100 chip to talk with. Are you sure that the connector is mounted in the correct position? It should be mounted on pin one to six with the first pin connected to the top left connection in the picture that you have provided. This makes the board sit more or less on top of the display port.

Test to run the board without connection any One Wire devices at all to begin with to try tog get rid of that error. Also make sure to double check that the AD0 and AD1 is in the same position as in the ctor.

chrisahardie commented 6 years ago

I wasn't getting an error when I had no wires screwed into any terminal - I would just get an empty collection for my device list.

Will I get this error if my wires have been inserted incorrectly? I am unclear about which wire goes into which terminal, and once I start guessing I get the aforementioned error. Can you please let me know which terminals do I screw in the power, ground, and data wires?

Thanks!

Rinsen commented 6 years ago

I have connected my sensor to +5V, GND and DQ to each pin on the sensor so I don't use it with parasite power.

Here is the datasheet for the chip https://datasheets.maximintegrated.com/en/ds/DS2482-100.pdf

There are some diagnostics that can be used in the chip but I have never had a need for that.

chrisahardie commented 6 years ago

Thanks @Rinsen! Turns out this thermometer has different configurations for the yellow and green wires (https://github.com/espruino/EspruinoDocs/blob/master/devices/DS18B20.md)

I apparently bought a version with the colour coding I wasn't expecting - I reversed the green and yellow and now everything works great!

Sorry for wasting your time, many thanks for writing this useful library!

Rinsen commented 6 years ago

It gave me some new insight also so no problems 😊 I will close this issue now.

DrouSoft commented 6 years ago

Hello

I am trying to use your bookseller in a project with the following elements:

-RPi 3 Model B on Windows IoT -Arduino Shield (https://www.dfrobot.com/wiki/index.php/Arduino_Shield_for_Raspberry_Pi_2B_and_3B_SKU:DFR0327) -A DS18B20 sensor -A UWP application.

I always get the same error message whatever connection I make with my sensor.

This error message is as follows:

Thrown Exception: ' Rinsen. IoT. OneWire. DS2482100DeviceNotFoundException ' in OneWireHeaded. exe

Could you tell me how to connect this sensor to the RPi?

Thank you

Rinsen commented 6 years ago

@DrouSoft The reason for getting that error is probably just that you don't have a DS2482 chip on that board?

What you could do is run one wire from the arduino and then talk with the arduino from .Net on your Pie. But that is a whole other beast to build than what this library provides.

For this Library the only supported setup is RPi -> DS2482 chip -> One Wire device like the DS18B20 or some other.

Please get back if I have missunderstod.