Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Centech IR Thermometer

 
Post new topic   Reply to topic    Forum Index -> General
Author Message
GTBecker



Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral

Posted: 07 December 2009, 0:17 AM    Post subject: Centech IR Thermometer Reply with quote

FYI, an inexpensive ($4 on sale at Harbor Freight) IR thermometer yields useful data by hacking a pair of points on its circuit board. TTL data and clock are clearly labeled; the clock runs at ~2.2kHz, which even an original ZX-24 can keep up with to bit-bang-shift in groups of 40 bits to five bytes. Two groups are close enough to consider 80 bits, so the code is written to expect that worst case.

I'm using this to measure the temperature of the heater in a carbon monoxide sensor ( http://www.sparkfun.com/commerce/product_info.php?products_id=9403 ), very well. The 16-bit data provides 1/16th degree C resolution above zero Kelvin. I powered the thermometer by dropping 5v from the processor through two diodes; it might run at 5v, but I haven't tried that.

Code:
' CenTech_IR_Thermometer.bas
' 2009-12-06 GTBecker

' reads serial data from CenTech IR pocket thermometer, needs ~3-4v power
' ~2.2kHz negative pulse clock, data read on falling (leading) edge
' data is in groups of 40 bits (five bytes), MSB first, at ~3Hz
' temperature data is in 16th degree Kelvin

' Typical data:
'   DataType?, TempHiByte, TempLoByte, Checksum, Terminator
'   76 22 201 43 13 = Target Temp 91.41C
'   102 18 218 82 13 = Ambient Temp 28.48C
'   83 0 0 83 13 = Unknown

' Typical program output:
'   84.98C  76 22 98 196 13 
'   85.29C  76 22 103 201 13 
'   85.66C  76 22 109 207 13   83 0 0 83 13 
'   85.91C  76 22 113 211 13 
'   86.23C  76 22 118 216 13 
'   86.48C  76 22 122 220 13   83 0 0 83 13

   const pinClock as byte = 19
   const pinData as byte = 18
   dim DataIn(1 to 10) as byte

Sub Main()
   dim t as long, ByteCount as byte, j as byte
    call Sleep(1.0)
   call putpin(pinData, zxInputTriState)
   call putpin(pinClock, zxInputTriState)

   do
      t = register.rtctick
      do
         if not cbool(getpin(pinClock)) then
            t = register.rtctick
         end if
      loop until (register.rtctick - t) > 25      ' wait for >~50mS no clock between bursts

      for ByteCount = 1 to 10      ' for up to ten bytes (two groups are sometimes immediately adjacent)
         for j = 1 to 8   ' get eight bits
            do until not cbool(getpin(pinClock))   ' wait for clock low
            loop
            DataIn(ByteCount) = DataIn(ByteCount) * 2 + getpin(pinData)   ' shift next bit in
            do until cbool(getpin(pinClock))   ' wait for clock high
            loop
         next
         t = register.rtctick
         do until not cbool(getpin(pinClock))   ' wait for clock low
            if (register.rtctick - t) > 2 then   ' end of group if > 2mS elapses before next clock
               exit for
            end if
         loop
      next
      
      dim TempOut as single
      TempOut = csng(makeword(DataIn(3), DataIn(2))) / 16.0 - 273.15   ' temp data is 1/16ths degree Kelvin

      Console.Write(fmt(TempOut, 2) & "C ")

      for j = 1 to ByteCount                  ' show raw data
         Console.Write(" " & cstr(DataIn(j)))
         if 0 = (j mod 5) then
            Console.Write("  ")
         end if
      next
      Console.Write(chr(13) & chr(10))
   loop
   
end sub








Last edited by GTBecker on 07 December 2009, 20:36 PM; edited 1 time in total
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 07 December 2009, 0:52 AM    Post subject: Re: Centech IR Thermometer Reply with quote

GTBecker wrote:
FYI, an inexpensive ($4 on sale at Harbor Freight) IR thermometer yields useful data by hacking a pair of points on its circuit board.
Nice find.
GTBecker wrote:
[...]which even an original ZX-24 can keep up with
That looks like a Beta ZX-24 (square pins instead of round, 100 ohm resistor instead of an inductor near pin 12, patch wire on pin 6).
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 07 December 2009, 1:16 AM    Post subject: Reply with quote

I still have my Beta ZX-24 as well as all of my own devices: ZX-24e, ZX-24ae, ZX-128e, ZX-1281e, ZX-24pe, ZX-24ne, ZX-128ne, ZX-1281ne, ZX-328nu, ZX-24pu, ZX-24nu Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> General Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group