Shop OBEX P1 Docs P2 Docs Learn Events
Applied Sensors - problem with ds1620 — Parallax Forums

Applied Sensors - problem with ds1620

NGarlandNGarland Posts: 10
edited 2006-07-05 17:20 in Learn with BlocklyProp
I'm trying to use the BS2+BOE to read the temp from a DS1620.· I get back a reading but it seems WAY too high to be room temperature·(68C!).· This is after dividing the return byte by 2 (due to the LSB being 0.5C).· At first I thought maybe the value was coming back in fahrenheit as the room I'm in is about 68-70F, but the reading only fluctuates in multiples of 4 (again, after dividing by 2).· I believe I have the circuit wired correctly as I have verified the command signal sent to the DS1620 ( and the format of the signal received) using an optascope. The DS1620 is configured for CPU, and continuous and 1-shot conversions report the same reading.· Below is the code I'm using (should be the same as what's in the Applied Sensors text).· Any suggestions would be appreciated!

Thanks!
-N

' {$STAMP BS2}
' {$PBASIC 2.5}
x········ VAR···· Byte
degC····· VAR···· Byte
OUTS=%0000000000000000
···· 'fedcba0987654321
DIRS=%1111111111111111
FREQOUT 0, 20, 3800
HIGH 13
SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]238]
LOW 13
DO
· HIGH 13
· SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]170]
· SHIFTIN 15, 14, LSBPRE, [noparse][[/noparse]x]
· LOW 13
· degC = x / 2
· DEBUG ? degC
· PAUSE 100
LOOP

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-17 09:19
    NGarland -

    I don't know if it makes any difference to the DS1620, but the sample program pauses one full second (PAUSE 1000) between conversions, and your program only pauses .1 of a second (PAUSE 100).

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2006-06-17 16:51
    Maybe the CPU mode didn't get programmed?

    HIGH 13 ' Tells the DS1620 that a command is coming.
    SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]12,2] ' Command to set DS1620 configuration 2.
    LOW 13 ' Completes the command cycle.


    Be sure there is a 0.1 uF capacitor across the power supply on the breadboard.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-17 18:03
    Also, here is a Nuts & Volts article on using the DS1620 in hi-res mode.

    http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv123.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NGarlandNGarland Posts: 10
    edited 2006-06-17 18:39
    Thanks for the replys.· To answer both:

    I reduced the Pause duration to 100 because I was seeing steps of (exactly) 4 degrees when cooling or heating the outside of the IC (with a fan·or finger, respectively) and I wanted to make sure I was sampling often enough to see a gradual change.· No luck - the output always steps in increments of 4 (after dividing by 2).

    As for programing the CPU mode, I've done that several times, trying to get an accurate value using both CPU mode 2 and 3 (continuous and 1-shot).· I've also tried setting the mode just prior to loading the temp read program (meaning I didn't power down the BOE inbetween setting the mode and running the program).· But yes, I have cycled power after programming the mode

    Theres also a .1uf cap connecting pin 8 to Vss.· I noticed that the·N&V article that was referenced does not have a cap in the initial circuit and removing it from my circuit did not change the result for me.· For what its worth, the wiring on my breadboard is exactly the same as figure 1-5 in the applies sensors text.

    One other piece of information - I'm using a BOE rev B and a wall adapter (9v, 300ma).· The circuit is connected to Vdd (not Vin).

    I'll be reading through the N&V article this weekend to see if I can figure the problem out, but any additional thoughts/suggestions on the problem would be appreciated.

    Thanks!
    -N
  • Nick WaldvogelNick Waldvogel Posts: 71
    edited 2006-06-17 19:23
    I'm kind new at this but in the last few weeks I have come to know this sensor very well. Try this code to see if it helps.....

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    x VAR Byte
    degC VAR Byte
    OUTS=%0000000000000000
    'fedcba0987654321
    DIRS=%1111111111111111
    FREQOUT 0, 20, 3800
    HIGH 13
    SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]238]
    LOW 13

    Here:

    DO
    HIGH 13
    SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]170]
    SHIFTIN 15, 14, LSBPRE, [noparse][[/noparse]x]
    LOW 13
    degC = x / 2
    DEBUG ? degC
    PAUSE 1000
    GOTO here

    LOOP
  • NGarlandNGarland Posts: 10
    edited 2006-06-18 05:18
    After a little more reading and experimenting, I'm starting to think that the IC may be damaged in some way.· Using variations of the code in my orginal post (and trying some of the sample code in various app notes found on Parallax's web site and elsewhere) I get readings ranging from 48C to 100C in the room I'm programming it in.· Also, the longer it remains powered, the higher the reported temperature ticks.· To make sure I had it seated correctly, I removed and reseated it and the initial readout started at 100C and lowered to 72C over a period of several minutes.

    Does anyone familiar with the DS1620 know of a good way to test if the·IC is damaged?

    Thanks!
    -N
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2006-06-18 21:27
    It is pretty unusual to get a bad chip, unless it was hooked up backwards or to a high voltage or something like that. Does the chip feel hot to the touch? Maybe start over with the wiring, and use a different location on the breadboard. It might be a problem with the breadboard. Occsionally the springs inside lose their tension and don't make good contact.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • NGarlandNGarland Posts: 10
    edited 2006-06-18 23:25
    Thanks for the continued assistance.· This morning I rewired the circuit·in a different area of the breadboard with·the same result.· I also took a closer look at configuration byte that the ds1620 returns and it is configured correctly for CPU usage and continuous conversion (the·Done bit is also 1 so·its primed to do conversions).· While I was at it, I looked at the full 9 bits coming back·from the DS1620 and to my surprise,·.BIT8·is '1' indicating a negative temperature (to be sure, I·set all the bits in the receiving word to 0 before reading)!·· So starting at around -60C (110001000)·I can get the reported Temp to raise to about -48C in 4C increments by placing my finger gently on the top of the IC.· Since the reading is starting at a temp below the operating range listed on the datasheet (in addition to the other symptoms)· I'm growing·to favor the damaged component theory.· Below is the current pbasic I'm using to check the config and return word.· If I've missed anything obvious, please (please) let me know.

    Thanks again!
    -N

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    x········ VAR···· Word
    y········ VAR···· Byte
    degC····· VAR···· Word

    pDQ······ PIN···· 15
    pCLK····· PIN···· 14
    pRST····· PIN···· 13
    OUTS=%0000000000000000
    ···· 'fedcba0987654321
    DIRS=%1111111111111111

    FREQOUT 0, 20, 3800

    HIGH pRST
    SHIFTOUT pDQ, pCLK, LSBFIRST, [noparse][[/noparse]238]
    LOW pRST
    PAUSE 1000

    HIGH pRST
    SHIFTOUT pDQ, pCLK, LSBFIRST, [noparse][[/noparse]172]
    SHIFTIN pDQ, pCLK, LSBPRE, [noparse][[/noparse]y]
    LOW pRST
    DEBUG BIN ? y

    DO
    · x =· %0000000000000000
    · HIGH pRST
    · SHIFTOUT pDQ, pCLK, LSBFIRST, [noparse][[/noparse]170]
    · SHIFTIN pDQ, pCLK, LSBPRE, [noparse][[/noparse]x\9]
    · LOW pRST
    · GOSUB NORMALIZE
    · DEBUG "DegC=", SDEC degC, ", ", BIN x.BIT8, BIN8 x.BYTE0, CR
    · PAUSE 1000
    LOOP

    NORMALIZE:
    · IF (x.BIT8 = 0) THEN
    ··· degC = x /2
    · ELSE
    ··· degC = x | $FF00
    ··· degC = -(ABS degC/2)
    · ENDIF
    · RETURN
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-19 05:45
    Before writing it off as bad I would also consider running one of the many examples for the DS1620 of free running mode and see what you get.· Just to see if the chip works, or at least, what it does in that mode.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NGarlandNGarland Posts: 10
    edited 2006-06-20 07:11
    Thanks for the suggestion.· Being relatively new to the DS1620, I'm assuming that when you say 'free running mode', you're referring to Standalone (CPU=0) mode.· Unfortunately, that produces the same result as what I've described previously. cry.gif

    -N
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2006-06-20 16:14
    I'll second (-guess) Chris and suggest that you try one of the autonomous thermostat modes. Here is an example:

    www.emesys.com/OL2d1620.htm#thermostat

    Once it is in free running thermostat mode 0, you can take the Stamp out of the circuit and observe the on-off output on one of the thermostat pins, e.g., DS1620 pin 7, which goes high when the DS1620 detects a temperature above the programmed threshold.

    Experiment with the threshold and see if it agrees with your observation that the chip thinks the temperatures are really cold! I don't see anything wrong with your program.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-22 04:31
    Good idea Tracy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NGarlandNGarland Posts: 10
    edited 2006-06-27 04:40
    In trying to test the chip in an autonomous circuit, I ran into another problem: the eeprom on the DS1620 was not allowing writes to THigh and TLow.· Using the sample code in the link you provided, I tried to write 15 to THigh and -11 to TLow.· Reading the values back from the chip after the write gave me the values, 120C and 80C for THigh and TLow.· Changing the values I was attempting to write didn't change the value I was getting back.· Note that I AM able to modify and verify changes to the configuration (so I'm doing something right).

    Another interesting tidbit:

    I've been busy this last·week and haven't had time to play with the board until today.· We're having a bit of a heat wave in the NW and the outside temp is about 10-15F warmer than when I made the original post about the problem I was having with the ds1620.· The original temp readings I was getting were -60C to -48C (once I thought to look at the signed bit).· When I initially plugged it in again today, after sitting idle for·about 6·days, the readings ranged from 0C to 8C (still incorrect but at least its closer to correct!).

    Wacky.
    -N
  • Shawn LoweShawn Lowe Posts: 635
    edited 2006-06-27 14:18
    I have also experimented with the 1620, and my chip would not work as well. I really do think that you may have a bad one. I haven't had time to order a new one and try again, but my personal feelings are that occasionally there are bad chips. Since these chips are so cheap, I'd try getting another one and see if it works with your current setup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    My last words shall be - "NOT YET!!!"
  • Shawn LoweShawn Lowe Posts: 635
    edited 2006-06-29 12:57
    NGarland-
    Have you had any success yet?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    My last words shall be - "NOT YET!!!"
  • NGarlandNGarland Posts: 10
    edited 2006-06-29 19:20
    I have a replacement for the·IC on the way and will post my results once I get a chance to plug it in.

    Thanks!

    -N
  • NGarlandNGarland Posts: 10
    edited 2006-07-02 07:12
    The new chip arrived the other day and is performing like a ...well, a DS1620!· Temperature readings are in line with my home thermostat.· The old chip is headed for the trash bin.

    -N
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-03 06:37
    Well, after all of that I am sorry to hear it was a bad/damaged chip, but on the other hand I am glad you got it figured out with your sanity intact.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2006-07-04 16:24
    Good going! That old chip gave you so much trouble, maybe the trash bin is too good a fate. It should be part of pyrotechnics for the 4th!.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Shawn LoweShawn Lowe Posts: 635
    edited 2006-07-05 17:20
    Thats great news!
    I will have to order me one up as well. It's not too surprising that you can get a bad chip, but it sure is frustrating to find out when your new to microcontrollers, and to the tempurature chip.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    My last words shall be - "NOT YET!!!"
Sign In or Register to comment.