Shop OBEX P1 Docs P2 Docs Learn Events
DS18S20 interfacing.... — Parallax Forums

DS18S20 interfacing....

Mikael SMikael S Posts: 60
edited 2013-09-25 16:58 in Propeller 1
Hi,
I'm trying to interface a DS18S20 with the OW_demo for DS1822. My problem is that i get the result with the first number missing. I just get 3.0, but i think the correct temperature is 23.0.
I know that it is a difference between 18S20 and 1822 in the conversion, but i just can't find it...
I get the sensor react when i warm it with my fingers.

Or does someone have a simple code for getting the temperature from just one DS18s20, and want to share it?

Thanks!

/Mikael

Comments

  • JonnyMacJonnyMac Posts: 9,107
    edited 2011-09-07 15:26
    I don't have the DS18S20 but I have worked with the DS1820 and DS1822, so I checked out the data sheet and modified one of my programs -- let me know if it works.
  • AcquaLifeAcquaLife Posts: 19
    edited 2012-05-17 12:37
    Hello, im currently working with the DS18S20 and having a difficult time. I have found a few threads about this sensor but still haven't had any luck. I've found two programs from other threads and they will read out a constant 32. The temperature value never changes.I've tried the code provided by JonnyMac but i cant get anything to display on the terminal. I've changed the OW pin to 0 and my tx and rx pins are 30 and 31. This is how my circuit is connected. i have GND-->GND NC--> not connected and DQ---> Pin 0 and 4.7k to VDD.

    Any help would be appreciated
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-17 13:26
    AcquaLife wrote: »
    Hello, im currently working with the DS18S20 and having a difficult time. I have found a few threads about this sensor but still haven't had any luck. I've found two programs from other threads and they will read out a constant 32. The temperature value never changes.I've tried the code provided by JonnyMac but i cant get anything to display on the terminal. I've changed the OW pin to 0 and my tx and rx pins are 30 and 31. This is how my circuit is connected. i have GND-->GND NC--> not connected and DQ---> Pin 0 and 4.7k to VDD.

    Any help would be appreciated

    Well what have you done with the Vdd pin on the 18S20 then?
  • AcquaLifeAcquaLife Posts: 19
    edited 2012-05-17 13:31
    According to the data sheet http://datasheets.maxim-ic.com/en/ds/DS18S20-PAR.pdf you only need to hook up the GND and the DQ the third pin is NC. So the VDD pin is also the DQ pin. I guess i should of mentioned I'm using the DS18S20 + PAR.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2012-05-17 13:39
    Make sure your DQ pull-up is going to 5v (not 3.3v) and I would change the 4.7K to 3.3K or 2.2K to allow the internal power supply to charge a bit faster (it won't hurt the device -- the data sheet shows a direct connection to 5v (Vpu) using a MOSFET).
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-17 15:39
    JonnyMac wrote: »
    Make sure your DQ pull-up is going to 5v (not 3.3v) and I would change the 4.7K to 3.3K or 2.2K to allow the internal power supply to charge a bit faster (it won't hurt the device -- the data sheet shows a direct connection to 5v (Vpu) using a MOSFET).

    Surely the pull-up resistor must go to the Propeller's Vdd and the OneWire driver must pull the output pin actively high during temperature conversions (which take too long for the on-chip decoupling capacitor to hold out (whatever the value of pull-up resistor). The Vdd to the temp sensor should be the same during quiescent (pull-up resistor) operation as during active powering or it'll upset all the analog circuitry I fear.

    If the driver code isn't pulling the pin HIGH during conversions then it won't work (also you cannot poll for end-of-conversion either because the bus is frozen - you cannot communicate on the bus during a temperature conversion).
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-17 15:40
    AcquaLife wrote: »
    According to the data sheet http://datasheets.maxim-ic.com/en/ds/DS18S20-PAR.pdf you only need to hook up the GND and the DQ the third pin is NC. So the VDD pin is also the DQ pin. I guess i should of mentioned I'm using the DS18S20 + PAR.

    I'd never buy that version since the generic version can do either parasite power or normal power mode so its more flexible.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2012-05-17 16:40
    Surely the pull-up resistor must go to the Propeller's Vdd...

    I disagree; though the 5v I mention must also be tied to the same ground as the Propeller. The "parasitic" devices have an internal diode that has to be overcome and 3.3v just may not provide enough voltage downstream of this diode for the device to operate properly. The 3.3k resistor to 5v protects the Propeller IO pin.
  • AcquaLifeAcquaLife Posts: 19
    edited 2012-05-21 10:41
    Okay so i have tried the different resistors and still i don't get anything in the terminal. Again I'm using the code posted above, i changed the OW pin to my OW pin. I have it hooked up as follows
    DQ-->3.3k--5v and to pin 0 GND-->GND. I've tried some other programs i found on the Object exchange. Some of them give me outputs but they are constant values that are VERY large. Also i found one that is supposed to give you the ID #. When i run that it says my ID # is 000000000000 and it is an unknown device. I'm going to call the company i got the sensor from and ask them some questions also.

    Thanks for any help
  • Shawn LoweShawn Lowe Posts: 635
    edited 2012-05-21 12:38
    Maybe post a schematic of your setup? Perhaps you've missed something on you hook up
  • AcquaLifeAcquaLife Posts: 19
    edited 2012-05-22 10:00
    This is how i have it set up. For the temperature sensor: I have ground to ground, i have NC not connected, i have DQ connect to pin 0, also i've connected DQ to 3.3k 2.2k and 4.4k then to 5v. I tried the different value resistors as Johnny Mac suggested.
  • Christoph_HChristoph_H Posts: 31
    edited 2012-05-22 14:08
    I've only used one of these sensors in non-parasitic powered mode but IMHO you have to follow the datasheet section "SUPPLYING THE DS18S20-PAR DURING TEMPERATURE CONVERSIONS".
    The easiest way to achieve this is to follow Mark_T's suggestion and set the propeller pin connected to DQ as output (and high) after issuing the Convert Temperature command - see also Figure 10.

    The pull-up resistor can be directly connected to your propeller's 3.3V. If you're not issuing Convert Temperature or Copy Scratchpad commands, the current draw will be very small. The typical DQ input current is in the electrical characteristics table - multiply this by a safety factor of your choice to get the maximum current. You only have to make sure that DQ stays above 3.0V between conversions with this current flowing through the pull-up resistor causing a small voltage drop. All the values mentioned in this thread should be small enough for that.
    JonnyMac wrote: »
    The "parasitic" devices have an internal diode that has to be overcome and 3.3v just may not provide enough voltage downstream of this diode for the device to operate properly.
    I disagree on this one. The internal makeup of the device is irrelevant. The datasheet clearly specifies VPU lower bound as 3.0V. IMHO, together with note 2, that only means one has to keep the voltage at the DQ pin above 3.0V in every possible state (during and also between conversions).
  • Mikael SMikael S Posts: 60
    edited 2013-09-25 13:28
    Bump :) Its quite an old thread, but i work very slowly on this! JonyMac:s code works very well, but now to the next problem that has been discussed here.
    Is it possible to parasite power the DS18S20? Has anyone got success with that?
  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-09-25 16:58
    Have you read the documentation?
    -- http://datasheets.maximintegrated.com/en/ds/DS18S20.pdf

    Page six shows how to connect for parasitic power. You'll need a second pin to charge the data line through a FET. Again, it's spelled out in the documentation.
Sign In or Register to comment.