C-code example for a temperature controlled relay for an LM74.

Discussion in 'Programmer's Corner' started by sht11help, Mar 4, 2009.

  1. sht11help

    Thread Starter New Member

    Mar 4, 2009
    Hi all, a destressed electronics student here;
    I need some C-code examples of when the LM74 detects a temperature higher than the preset level set at e.g. 40 deg, a relay is switched on. Then when the temperature falls below the preset temperature, the relay is switched off.
    Or anything similar to this would be a great help…
    Iv been searching the net but can’t find anything, so would appreciate some help from you guys please.

  2. mik3

    Senior Member

    Feb 4, 2008
    C code for a microcontroller?

    Which microcontroller?

    Which C compiler?
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    One reads the signal with the A to D converter. When the value exceeds some preset number, turn off the heat. An LM311 voltage comparator could do as well.
  4. AlexR

    Well-Known Member

    Jan 16, 2008
    Not if you're using an LM74 as your sensor it couldn't.

    An LM74 has in internal a temperature sensor and A/D converter that interfaces to the outside world via a SPI bus. To get any data out of the device you need to interface it to some sort of microprocessor/microcontroller.

    Once you get the digitized data into your microcontroller switching the relay for a given temperature range is a trivial problem.