ESP32 Kiln controller
This project connects an ESP32 S2 on an ESP32-S2 Saola-1 development board to a Temperature controller, and has WiFi to provide remote monitoring and programming of the kiln.
The kiln was fit with a Solo SL4848-VR temperature controller connected to two SLR relays that control the kiln coils.
The SL4848 has RS-485 output, and is connected to a generic RS-485 to serial USART module (MAX485), and then connected to two pins on ESP32 configured as a USART. The ESP32 communicates using the Modbus protocol with the SL4848.
The ESP32 is running software written using the Arduino IDE that connects to WiFi and acts as a web server. The web page shows a graph of the programmed and actual temperature and allows the SL4848 program to be updated. The ESP32 is powered by a reused wall wart (5V, 800mA output).
TODO
1. Add current sensors. Track coil aging and power use.
2. Have the ESP32 save programs.
3. Record of runs.
4. Start as an access point, have user set ssid/passwd, then connect to the local network for a normal run.
5. Done! Show state at top: temp, program segment, time, set point, current draw.
6. Adjust PID params to follow temp program better. [Not really needed. After auto-setting the PIDs for 500F, 1000F, 1250F, 1500F, and then setting temp points every 30 min, it follows pretty closely on the heating side.]
Update on setup process, 2022
1. Add ‘Additional Boards Manager’ in Prefs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
2. Install library AsyncHTTPRequest_Generic from library manager.
3. Install AyncTCP from git to Arduino/libraries/ dir: https://github.com/me-no-dev/AsyncTCP
Now it builds!
4. Enable PSRAM in Arduino->Tools. Use default partition scheme.
Getting ESP32 dev environment going
Installed the Arduino IDE, but no support for the S2 board.
Installing the ESP idf allowed command line programming to work, got the Blink program working.
https://github.com/espressif/esp-idf/release
mkdir -p ~/Documents/Arduino/hardware/espressif && cd ~/Documents/Arduino/hardware/espressif && git clone https://github.com/espressif/arduino-esp32.git esp32 && cd esp32 && git submodule update --init --recursive && cd tools && python get.py
git clone https://github.com/espressif/arduino-esp32.git esp32s2
git submodule update --init --recursive
Then follow these directions to get it to work with the Arduino IDE, link.
Download xtensa-esp32s2-elf and the latest esptool, copy to ./Documents/Arduino/hardware/espressif/esp32
To get it working with the IDE, tried a few things and finally got it working.
Installed the esp32s2 repository with git:
wget https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32s2-elf-gcc8_4_0-esp-2020r3-macos.tar.gz
wget https://github.com/espressif/esptool/archive/v3.0.tar.gz
Run Blink (add “define LED_BUILTIN 5”), LED blinks!
Run WiFiScan, works!
Date/Time
Got date/time setting via NTP working with these examples, 1, 2
Tried several Modbus libraries but they didn’t work. Some weren’t supported on ESP32. After trying different libraries for a while, I switched the controller to ASCII and started sending requests using my own code.
The final step in getting it working was to switch the TX/DX connection at the RS-485 to USART breakout board.
Hardware
Solo SL4848-VR (manual), $60 on ebay. Supports Modbus communications over RS-485, supports both RTU and ASCII.
RS-485 to USART module (link), 5 for $7.
ESP32 S2 Saola-1 development board (link), $14.50. Docs link.
Bare ESP32 S2 module (link), $4.
WiFi uFL antenna (link), $3
Modbus
Need to terminate line at each end. RS485 can drive about 50 ohms total, or doubly terminated with 100 ohms. Typical value is 120 Ohm resistors at each end.
Info: Modbus ASCII vs Modbus RTU, Modbus protocol, Modbus ASCII
Modbus ASCII, send each byte as two ASCII hex digits. One checksum byte, a LRC
To calculate the LRC:
- Add up all the data bytes in the message (before converting to ASCII and without the initial colon and final CR/LF).
- Throw away any bits that carry over 8 bits.
- Make the result negative (by twos compliment) to get the LRC byte.
Example: “: 01 03 10 00 00 03 7E CR LF” (without the spaces).
: Start of message
01 ID
03 Read Holding Register
10 00 Register address
00 03 Request 3 registers
7E Checksum byte (incorrect here)
CR LF End of message, bytes 0D 0A
Response example: “:0103022328AF” — ID, request code, bytes in response, data bytes (2328), LRC (AF)
Solo controller setup
C-sl — Modbus Protocol (ASCII or RTU)
C-no — Network address (1-247)
bps — Baud rate
len — Bit length (7/8)
Prty — Parity (None/Even/Odd)
Stop — STOP BIT (1/2)
Register conventions:
- The coils are numbered from 00001 onward
- The input bits are numbered from 10001 onward
- The input registers are numbered from 30001 onward
- The holding registers are numbered from 40001 onward
Type K thermocouples
Analog Output K-Type Thermocouple Amplifier – AD8495 Breakout, Adafruit $12
“Its low level output (typically tens of microvolts per °C) requires amplification.”
AN-1087: Thermocouple Linearization When Using the AD84
Other kilns that could be retrofit
Orton AutoFire 3000 (manual) has a serial output (Rx/Tx), could be adapted. Control language is not documented, Modbus?
Orton AutoFire 4000 (manual). USB output. Protocol not documented
Orton AutoFire Slide AF4TS (manual). Same USB output as the AutoFire 4000.
Orton AutoFire Kiln Controller Model AF4X (manual). “The controller has a USB interface that outputs TIME, Temperature and Setpoint data.” “…for remote monitoring and datalogging.” Not clear if the controller can be programmed remotely.
Skutt KilnMaster Controller (manual). No documented communication output.
LinkBoard is available for KilnMaster Kilns (KM and GM Models) (manual, link). It provides a data interface (over RJ11), likely RS-485, and connects to a KilnLink (link), a WiFi gateway to cloud-based monitoring. Includes Amperage and Voltage Readings by Section along with temp and time. Programming is not supported
Skutt KMT-1 Touchscreen Controller (manual). Built-in WiFi.
Bartlett RTC1000 (manual). Contains SMT600, “Bartlett Instrument’s fifth generation kiln controller circuit board”. KISS (Kiln Interface Software System). “KISS is an easy to use interface for programming and monitoring of the controller from a computer.” Kiln output is RS-485.
Bartlett V6-CF (manual). “The series 700 is Bartlett Instrument’s seventh generation kiln controller board.” Kiln output is RS-485.
Bartlett Genesis Model LT3140 Controller (manual). Built-in WiFi. KISS (Kiln Interface Software System). “10 Pin Housed Header for computer and radio connection.”
Make a file system:
/Users/jimlund/Downloads/esp-idf-v4.2.bak/esp32s2/tools/mklittlefs -c /Users/jimlund/Documents/Arduino/WiFiServer.modbus.v4.Xhttp/data -b 4096 -p 256 -d 5 -s 1507328 /Users/jimlund/Documents/Arduino/WiFiServer.modbus.v4.Xhttp/spiffs.bin
/Users/jimlund/Library/Arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool –chip esp32s2 –port “/dev/cu.usbserial-1410” –baud 921600 –before default_reset –after hard_reset write_flash -z 0x290000 /Users/jimlund/Documents/Arduino/WiFiServer.modbus.v4.Xhttp/spiffs.bin
ESP32-S3-WROOM-1
Trying a ESP32-S3-DevKitC-1-N8R8, ESP32-S3-WROOM-1 Module, Wi-Fi+BT+BLE, 8MB Flash 8MB PSRAM.