Dr. Scott M. Baker

A temperature and humidity probe for the Elk M1 Gold

by admin on May.16, 2013, under Electronics Projects

I wanted to do some humidity measurements, and now that I own an M1 Gold Security and Automation panel, it seemed to be the perfect platform. However, no humidity probe exists!

Fortunately I found some pointers on Cocoontech, where one of the members had decoded the protocol used by the Elk M1 Temperature probe.  Joe Novosel’s blog post was an invaluable resource for me to complete this project. Without it, I would be spending this time failing at reverse-engineering the protocol instead of writing up a blog post describing my success.

Temperature is transmitted to the Elk M1 using a standard zone input on the panel. It has to be one of the main zones (1-16) not a zone expander zone. The information is manchester-encoded using a bit time of just under one second per bit. To transmit humidity data, we’ll grab another zone input and send the humidity data using the temperature protocol. The Elk M1 will be none the wiser, it’ll call the humidity sensor a temperature zone.

Sensor Choice

For a sensor, I chose the SHT1x family of sensors. These include the SHT10, SHT11, and SHT15. The primary difference in these sensors is accuracy:

Sensor Temperature Humidity
sht10 +/- 0.5 C +/- 4.5%
sht11 +/- 0.4 C +/- 3.0%
sht15 +/- 0.3 C +/- 2.0%

For my prototype, I chose to go with the SHT11 as it offered reasonable accuracy and I was able to source some from China for $16 on ebay.

Microcontroller Choice

For my microcontroller, I went with the 8-core parallax propeller. This decision was based solely on what I’m familiar with and what parts I have on hand. Using an 8-core propeller to do a single-core’s work is wasteful in every respect (money, power, board space). For a commercial design, I would probably choose something much smaller and less capable, like an 8-pin PIC microcontroller. Using a propeller may be overkill, but saved much time coding the project using tools and components that I’m familiar with.

The Schematic

Let’s take a look at the schematic:

I’ve omitted the propeller-boilerplate components (programming jack, EEPROM, voltage regulator, etc) and just focused on the parts we care about for this project. At the top we see the SHT11 sensor. The 10K resistors pull-up and pull-down data and clock respectively. The 150 ohm resistors are simply protection for the prop in case a programming error leads to the SHT11 outputting a “1″ and the prop outputting a “0″ on the same pin. For a production design the 150 ohm resistors would be dropped.

Output to the ELK happens via the two 2N2222 transistors. These NPN transistors will pull the Elk zone input to ground.

The Software

Here is the spin program:

  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  'MS_001 = _clkfreq / 1_000
  CLK_FREQ = ((_clkmode-xtal1)>>6)*_xinfreq
  MS_001 = CLK_FREQ / 1_000

  SHT_CPIN = 1
  SHT_DPIN = 0

  T_OUT = 18
  H_OUT = 19

  LED = 20 

  sht : "sensirion_integer"

PUB main

pub to_f(temp)
  if (temp > 0)
    temp := temp * 9 / 5 + 32_0
    temp := 32_0 - (||temp * 9 / 5)

  return temp

PUB elk_bit(pin, value)
    if value
        outa[pin] := 1
        waitcnt(MS_001 * 480 + cnt)
        outa[pin] := 0
        waitcnt(MS_001 * 480 + cnt)
        outa[pin] := 0
        waitcnt(MS_001 * 480 + cnt)
        outa[pin] := 1
        waitcnt(MS_001 * 480 + cnt)

PUB elk_send(pin, v) | i, parity
    ' 3 start bits
    elk_bit(pin, 1)
    elk_bit(pin, 1)
    elk_bit(pin, 1)
    parity := 0
    repeat i from 0 to 7
        if (v & $80) <> 0
            parity := parity + 1
            elk_bit(pin, 1)
            elk_bit(pin, 0)
        v := v  << 1

    elk_bit(pin, parity & 1)

    ' disable output

PUB run_sht11 | temp, humid
    dira[LED] := 1

    dira[T_OUT] := 1
    dira[H_OUT] := 1

    sht.Init(SHT_DPIN, SHT_CPIN)

        outa[LED] := 1

        temp := sht.ReadTemperature
        temp := to_f(temp/10)

        humid := sht.ReadHumidity

        outa[LED] := 0

        elk_send(T_OUT, temp/10 + 60)
        elk_send(H_OUT, humid/10 + 60)

The Board

An annotated description of the board:

I made extensive use of SMD devices for two reasons: 1) The SHT11 is a SMD device already, so once you’ve crossed that bridge, might as well stay there. 2) To make it small enough to fit in my case. I could probably be condensed even smaller, certainly if a less complex microcontroller was used. The small 4-pin header near the SHT11 is to accommodate an external sensor in case one wanted to mount the probe remotely. The other unpopulated header just brings a couple of the props pins out with pullups attached should I decide to repurpose the board some day.

The PCB was manufactured by OSH Park at a cost of ~ $25 for 3 of them. The cost I have into this project would be approximately:

PC Board $8.00
SHT11 Sensor $16.00
Propeller $8.00
Misc (eeprom, transistors, headers, etc) $10.00
—— ——
Total $42.00

I have suspect the cost could be reduced by a good $10 by choosing more price-conscious components. Note that I do not intend to manufacture these at this time. The design needs to go through at least one major revision to pick a cheaper microcontroller (which essentially means redoing everything), and my time bills out at about $125 an hour (and I’m not a quick PCB assembler!). Perhaps sometime in the future.

Using the sensor

Below is a screen shot of the Elk keypad interface in the browser:

Configure the M1G with both zones as type 33 (temperature) and both zones with Fast Response enabled. It’ll take up to 30 seconds, but then the data will start to show up.

Zone 13 is the temperature reading (currently 62 degrees) and Zone 14 is the humidity reading (currently 53%). The zones will show up similarly in ekeypad, and they can be used in Elk rules. As said before, the Elk thinks the humidity probe is a temperature probe, but that really doesn’t make much difference from a rule perspective.

2 Comments for this entry

  • Steve

    excellent work!

    would you consider making one of these for me? I’ve been looking for this for 3 years!

  • admin

    Sorry, I don’t have any plans to manufacture them in the immediate future. If I do make a run of some more boards, I’ll make sure to let you know!

Leave a Reply

+ two = 9

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

New Kickstarter Project!

Interested in Nixie Tube projects? Check out my new Nixie Tube Calculator project on Kickstarter.

Copyright Notice

All content on this website is copyright Scott M. Baker and may not be used or reprinted without explicit permission.

Violators will be eaten by a grue.