0121-12 Simple Thermostat 1-Wire

Example Projects > 0121 Monarco HAT > 0121-12 Simple Thermostat 1-Wire

Monarco HAT as a simple thermostat

This folder contains the source files for the demonstration project on using REXYGEN on the Raspberry Pi minicomputer with the Monarco HAT add-on board.

In this example the Monarco HAT is configured to act as a simple thermostat. The temperature is measured by the 1-Wire DS18B20 sensor and the onboard digital output 1 (DO1) is switched on and off with a hysteresis of 0.5°C. The output signal can control e.g. an external relay.

The measured temperature and status of the output is recorded in the TRND blocks which allow displaying of the trends (graphs).

Timing of the project

The algorithm runs each 500 milliseconds (0.5 s). See the EXEC function block,
tick x ntick0 = 0.05 x 10 = 0.5

Prerequisites

  • REXYGEN Runtime Core and MonarcoDrv modules must be installed and running on the Raspberry Pi.
  • Owserver (part of the OWFS package) must be installed, correctly configured and running on the Raspberry Pi.
  • I2C bus must be enabled on the Raspberry Pi.
  • The wiring must comply with the attached schematics.

Running the example

  • The *exec.mdl file is the project main file, open it with RexDraw.
  • Specify the 64-bit ROM ID of the attached temperature sensor. See the 1-Wire driver manual below.
  • Compile and download the project to the target device.
  • Switch to Watch mode and observe the algorithm (use Target->Watch Selection to display real-time data).

Documentation

Additional information