Skip to content

Latest commit

 

History

History
94 lines (76 loc) · 3.02 KB

File metadata and controls

94 lines (76 loc) · 3.02 KB

Electric Kettle DEVS model

This model executes the temperature controller for an electric kettle. We use the DS18B20 temperature probe to measure the temperature and three outputs for a green led (temperature OK), red led (temperature out of bounds) and relay. This model is intended to run on an ESP32 board, where:

  • DS18B20: pin 4 (G4)

  • Red LED: pin 16 (G16)

  • Green LED: pin 15 (G15)

  • Relay: pin 17 (G17)

  • DS18B20: pin 7 (G4)

  • Red LED: pi 16 (G16)

  • Green LED: pin 4 (G15)

  • Relay: pin 9 (G17)

This model is based on Cadmium_v2 version modified by Sasisekhar here and the Blinky led basic example here.

Under the folder components/ you will find:

├── CMakeLists.txt
├── main
│   ├── include/
│   ├── CMakeLists.txt
│   └── main.c
├── components
│   ├── boost_1_79_0/
│   ├── cadmium_v2/
│   ├── esp32-ds18b20/
│   └── esp32-owb/
└── README.md                  This is the file you are currently reading

Subfolders cadmium_v2/, esp32-ds18b20/ and esp32-owb are treated as git submodules. As for the boost_1_79_0/ you must download it and decompress from: https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.gz.

In file: components/cadmium_v2/include/cadmium/core/real_time/rt_clock.hpp the macro MISSED_DEADLINE_TOLERANCE must be changed to -1 to avoid checking the slid of real time.

Git

Follow these steps:

  1. git clone git@github.com:epecker/KettleController_ESPIDF.git
  2. cd KettleController_ESPIDF
  3. git submodule update --init --recursive

ESP-32 Toolchain

For information about the ESP-32 toolchain check here.

To install the tools required to work with ESP32 run the steps here:

  1. For Linux users install the required tools:
sudo apt-get install git wget flex bison gperf python3 python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
  1. Then clone the repo with the esp tools:
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
  1. Build these tools:
cd ~/esp/esp-idf
./install.sh esp32
  1. Finally, setup the environmental variables:
. ./export.sh
  1. To automate this last step you can add the following line to the .bashrc script:
alias get_idf='. $HOME/<path-to-esp-folder>/esp/esp-idf/export.sh'

where <path-to-esp-folder> must be replaced by the correct path. 6. Then, to make sure that the environmental variables are correctly defined after launching a new terminal just run either:

get_idf
  1. To build the model run:
idf.py build
  1. Flash the board:
idf.py -p /dev/ttyUSB0 flash
  1. Monitor the serial port:
idf.py monitor

To close the monitor just type: CTRL+].