Application note: Ethernet to analog read - Network Driven Temperature Sensor

Ethernet temperature sensor demo


In this application note is shown how to read remote temperature by PC with an Ethernet connection. It is built with MCP9701 temperature sensor, read by analog ports of SR01E12. Two ports of SR01E12 are configured as analog inputs. Each one is connected to signal pin of MCP9701 sensor. On demo board exist 3,3V regulator for the Ethernet bridge and 5V regulator, which is optional.


Ethernet to Analog Schematic

Board require 6,5-9V 200mA power supply to POWER connector. It can be provided by wall power adapter.


GUI QT C++ Application

Ethernet to Analog Software Ethernet to Analog Software

The user interface is built with QT framework. It is split in 2 dialogs, first is to obtain all network interfaces, search for SR01E12 boards and select one of them. Second dialog has 2 lables that show current temperature of the sensors.

Command line C Application

A very simple command line tool to read the temperature sensors. Whole source code is:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "libschremote.h"
#define TEMP_RATIO (3.3/1024/0.0195)  //3.3V is the PS, 1024 is resolution of ADC, 0,0195 V/°C resolution of MCP9701
#define TEMP_OFFSET (0.4/3.3 *1024) //0.4V = 0°C
int main(int argc, char *argv[])
  SR_HANDLE srh;
  if (argc < 2)
    printf("Usage SrTemp <ip>");
    return 0;
  srh = sr_open_eth(argv[1]);
  if (!srh)
    printf("Failed to allocate a handle\n");
    return 0;
  sr_pin_setup(srh, 6, sr_pt_analog_in);
  sr_pin_setup(srh, 7, sr_pt_analog_in);
  unsigned short t;
  sr_pin_get_analog(srh, 6, &t);
  printf("Temperature 1: %.01f oC\n", (t-TEMP_OFFSET)*TEMP_RATIO);
  sr_pin_get_analog(srh, 7, &t);
  printf("Temperature 2: %.01f oC\n", (t-TEMP_OFFSET)*TEMP_RATIO);

To compile, is needed just to add the libschremote library to the project. For example in VC is done like: "cl SrTemp.cpp /link libschremote.lib". Sample usage of executable is: "SrTemp".


SrTemp QT GUI ExecQT GUI version - Executable file with all needed libraries
SrTemp QT GUI SrcQT GUI version - Source code (requires QT framework)
SrTemp Cmd ExecCommand Line version - Executable file with all needed libraries
SrTemp Cmd SrcCommand Line version - Source code


Ethernet temperature sensor demo
Ethernet temperature sensor demo
Ethernet temperature sensor demo
Full Size

* On grayed area of evaluation board are placed components not related to the project.

Follow us on: Facebook Share: