https://github.com/gabrielmarcano/esp32-roaster
Firmware to create a real life roaster using the ESP32 microcontroller
https://github.com/gabrielmarcano/esp32-roaster
esp32 husarnet iot-device ota-updates platformio
Last synced: 10 months ago
JSON representation
Firmware to create a real life roaster using the ESP32 microcontroller
- Host: GitHub
- URL: https://github.com/gabrielmarcano/esp32-roaster
- Owner: gabrielmarcano
- Created: 2023-04-30T01:15:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-25T20:06:05.000Z (about 2 years ago)
- Last Synced: 2025-01-30T05:17:37.729Z (11 months ago)
- Topics: esp32, husarnet, iot-device, ota-updates, platformio
- Language: C++
- Homepage:
- Size: 314 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ESP32 Roaster Project
A project to control a peanut, coffee & cocoa roaster with an ESP32
[](https://github.com/gabrielmarcano/esp32-roaster/blob/master/.github/workflows/build.yml)
[](https://github.com/gabrielmarcano/esp32-roaster/blob/master/.github/workflows/ota-update.yml)
[](https://github.com/gabrielmarcano/esp32-roaster/releases)
[](https://platformio.org/)
## Contents
- [Summary](#summary)
- [Project structure](#project-structure)
- [Hardware](#hardware)
- [Software](#software)
- [Wiring](#wiring)
## Summary
All logic depends on the data given by the **Thermocouple** & **DHT22** sensors, and the selected mode in the **4 Position Rotary Switch**. It's intention is to control 3 motors, which will turn on or off based on the temperature that it reaches.
When the temperature reaches 140ºC, 170ºC or 180ºC (depending on the mode) it feeds a relay that controls the first motor,
and also starts a timer that can be 12, 20 or 33 minutes which also depends on the mode.
There will be two push buttons, one will add +1min to the time (and start the timer if there isn't one already), and the other will reduce -1min to the time.
When the timer stops, a buzzer starts making noise and also feeds the other 2 relays that controls the second & third motor.
> Motors can only be stopped manually by either the security button or through the web interface. If Motor 2 or Motor 3 are stopped via the web interface, they will stop any action taken after the timer stops.
### Modes
| Position | Name | Temperature | Time |
| -------- | ------ | ----------- | ---- |
| 0 | Off | 0ºC | 0m |
| 1 | Peanut | 180ºC | 20m |
| 2 | Cocoa | 140ºC | 33m |
| 3 | Coffee | 170ºC | 12m |
> The default state of the switch does not set a timer. Timer response can also be turned off by setting the state of the switch to the position 0 (i.e. the default state.)
## Project structure
The project structure is as follows:
| Resource | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [src/](src) | The [main.cpp](/src/main.cpp) file with the code to be uploaded to esp32 |
| [data/](data) | Static files written directly to the SPI flash file storage (SPIFFS) |
| [lib/](lib) | All additional libraries. Core libraries are installed via PlatformIO or written in **lib_deps** using the [platformio.ini](platformio.ini) file |
| [server/](server) | [Express](https://expressjs.com/) server for debugging |
| [env‑template.h](src/env-template.h) | Environment variables template file used to get the credentials for WiFi & VPN |
| [platformio.ini](platformio.ini) | PlatformIO project configuration file |
### Envionment Variables
Use env vars to store your credentials and build the firmware locally.
1 - Run the command: `cp src/env-template.h src/env.h`
2 - Edit the values
```cpp
#define WIFI_SSID "SSID"
#define WIFI_PASSWORD "PASSWORD"
```
## Hardware
- **ESP32-DEVKIT-V1**: ESP32 Microcontroller
- **I²C 16x2 LCD Display**
- **Type K thermocouple**: Thermoelectrical thermometer
- **MAX6675**: Type K thermocouple digital converter
- **DHT22**: Humidity sensor
- **4 Position Rotary Switch**: Mode selector
- **Passive Buzzer**
- **Motor (x3)**
- **Push button (x2)**: Time adder/substractor
- **Relay (x3)**
- **7805 / 7812**: Voltage regulators
- **Capacitors**
- **Resistors**
## Software
### Web server
The ESP32 also act as a server for controlling the motor states, showing the temperature and humidity with gauges, and showing the remaining time in the timer. The server uses [SSE](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) to update the values on the web.
The web interface can _read_ all values, and can only _write_ to the motor states and timer values.
OTA updates are available thanks to [ElegantOTA](https://github.com/ayushsharma82/ElegantOTA).
| Resource | Description |
| -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| /events | Event Source with `readings`, `timer` & `states` events |
| /data | **GET** - Request to update the temperature & humidity readings, timer remaining time and motors states on the web interface |
| /motors | **POST** - Request to control the state of the motors throught the web interface |
| /time | **POST** - Request to increase or reduce the timer by 60 seconds |
| /reset | **POST** - Request to perform a remote software reset of the ESP32 |
| /update | Firmware & Filesystem OTA updates |
## Wiring
> **TODO**: Upload circuit, PCB design, 3D design, Gerber files & ESP32 pinout