This is a "pre-alpha" firwmare sources for Skyduino Roaster, a custom Arduino board for Skywalker/ITOP MTCR(SkItop) roaster.
likely going to set your house on Fire
This project was inspired by the original work of Josh Moore, who reversed engineered the Skywalker roaster protocol and built a sketch for connecting the roaster and Artisan allowing either full control of the roaster or just the data logging. Also, I wanted to learn something new and building Arduino boards, with a display and a TC interface required too much soldering, so there always was an idea in the back of my mind of building a custom Arduino board which had everything required for this roaster onboard.
Download the firmware from Skyduino Releases (no published releases yet, but check again in the future), build firmware yourself (easiest way is to use the PlatformIO IDE in VSCode) or as the last resort, try finding a latest artifact in Github Actions run history.
The "Firmware Stepper" zip file contains the modified firmware to control the drum using a stepper motor. This does require a separate stepper motor driver, controlled through J13 Disp header, using the following pins:
| Pin Name | Function | Description |
|---|---|---|
| SCL | STEP | Step signal to stepper driver |
| SDA | nEN | Enable signal to driver, low level is active |
The firmware was tested with TMC2209 driver board. You may need to hardwire the direction pin, as this is not controlled at the moment.
Depending on the stepper motor and configured micro-step resolution of the stepper
driver, you need to configure how many steps are needed for the full revolution.
The firmware default is 1600 steps: 200 motor steps * 8 microstep configuration of TMC2209, when MS0 & MS1 pins are left floating.
You can configure the number of steps with STPR=1600 Serial command.
The setting is persistent, unless the device is fully erased or there are
incompatible firmware change.
Beside steps per revolution, you can change the max RPM for the drum with MXRPM=60 command. This corresponds to 60 RPMs when drum speed is set to 100%
The board is based on ST32F412RET6 microcontroller, therefore the easiest way to install or upgrade the firmware is to use the DFU mode. To enter the DFU mode:
- PowerOff the roaster and unplug the USB-C connection to computer
- hold the boot button
- plug in the USB-C cable to computer and the MCU should be in DFU mode
To flash the firmware, use the dfu-util and run dfu-util -a 0 -s 0x8000000 -D .\firmware.bin
The dfu-util is packaged for the most linux distros.
On Windows:
- Download dfu-util
- Download Zadig USB driver installer for Windows
- Enter the DFU mode on the board
- Install
WinUSBdriver forSTM32 BOOTLOADERusing Zadig - Flash the firmware:
dfu-util -a 0 -s 0x8000000 -D .\firmware.binor withdfu-util -a 0 -D .\firmware.dfuIf you install the firmware for the very first time, or if you want to factory reset the settings stored in non-volatile memory, then you can flash thedfu-util -a 0 -D .\firmware-nvm-defaults.dfu
There is also online dfu-util Which works only on Chrome, but this was not tested yet. Can anyone test and let me know?
When a new release becomes available, either follow DFU Mode or you can try switching to DFU mode with a serial command,
either manually, or by running an expect script, e.g. Scripts/skyduino_dfu.sh /dev/ttyUSB0 115200
If you cannot run the script, the other option is to switch manually, by connecting with a serial
terminal to the port, and issuing two commands in quick succession. The first command is just DFU
which starts DFU mode switching negotiation. In response, the roaster will reply with a number,
e.g. 42641. For the second command, enter DFU; followed by number from the previous command
in our example, the full command is going to be DFU;42641 There's a ttimer 5 second running in
the background, from the time the 1st dfu commad was executed and the 2nd dfu command was submitted,
if the second command arrives too late, then you have to start from the beginning, by sending an empty DFU command.
The artisan settings are backward compatible (at least for the moment) with the original Josh's firmware, but the DRUM speed is now adjustable. Sample config is available in Settings/ArtisanSettings
If you are using Linux, then you can also add an udev rule, so the serial port is always available as /dev/ttyUSB.artisan The udev rule file is in Settings/udev/90-arduino-stm32-acm.rules Copy this file into /etc/udev/rules.d then restart the udev daemon with sudo udevadm control --reload and replug the board.
The firmware implements serial protocol, based on the serial protocol used by TC4 shield.
The commands are usually following this format: COMMAND_NAME Separator Value New Line/Carriage Return
The following symbols are used for the Separator value:
;,=[space]
| Command | Format | Example | Description |
|---|---|---|---|
| ABORT | ABORT | ABORT | Enter the failsafe mode. This command is normaly is not expected, as the only way of exiting the failsafe mode, where the controller does not accept any controlling commands is to do the full power cycle, including disconnecting the USB to computer, as it powers the MCU as well |
| CHAN | CHAN;xxxx | CHAN;1200 | Establishes logical channels: chan1 -- ET, Chan2 -- BT, Chan3 -- n/a, Chan4 -- n/a mapping to physical channels, represented by decimal digits 1 through 4, where 1 is the thermo couple probe, 2 is the NTR probe and 0 disables the channel |
| COOL | COOL;pp | COOL;100 | Controls the bean cooler, where pp is the value between 0 and 100. The cooling is on/off only, so 0 turns the cooling off and anything between 1 -- 100 turns the bean cooling on |
| DFU | DFU | DFU | Generate the DFU challenge. In order to switch the firmware into the DFU mode, you need to answer the DFU challenge within the 5s |
| DFU | DFU;{num} | DFU;2345 | Answers the DFU challenge. The number is obtained just by the DFU command, which gives you the challenge, which you should repeat as DFU;{challenge} command within the 5s. If it matches, the MCU enters the DFU mode and the new firmware can be uploaded |
| DRUM | DRUM;pp | DRUM;90 | Set the drum speed to pp% |
| FILT | FILT;ppp;ppp;ppp;ppp | FILT;5;5;5;5 | where ppp = percent filtering on phisical channels 1 to 4. For example 5 indicates how much weight the old value has, so the filtered value = 95% of the new value + 5% of the old value |
| NVMRST | NVMRST | NVMRST | Resets non-volatile memory settings to defaults. Generates a challenge, which has to be answered within the 5s. This commands works similarly to the DFU command |
| NVMRST | NVMRST;{num} | NVMRST;4523 | Answers the NVMRST challenge. See the DFU commands for more details |
| OFF | OFF | OFF | Turns everything off. Turns off: cooling, exhaust fan, heater, drum |
| OT1 | OT1;pp | OT1;50 | where pp is the % duty cycle for the heater |
| OT2 | OT2;pp | OT2;50 | where pp is the % duty cycle for the exhause air fan |
| PID | PID;AWMODE;m | PID;AWMODE;1 | Configures PID I-term anti-windup mode, where m=0 for AW on Condition, m=1 AW Clamp and m=2 to turn off the antiwindup mode. Note: this changes the iAwMode for the current PID profile |
| PID | PID;CHAN;c | PID;CHAN;2 | Select the Phusical Temperature Channel to use for PID input. Channel #1 -- Thermocouple probe, Channel #2 -- NTC Temperature probe |
| PID | PID;CNSGAP;t.ttt | PID;CNSPRF;8.0 | Switch to a "conservative" profile, when the setpoint is within the 8.0°C treshold. Set to 0 (default) to disable the conservative profile |
| PID | PID;CT;ssss | PID;CT;1000 | Set PID cycle time to ssss ms, e.g. PID;CT;1000 sets the PID cycle time to 1000ms = 1s. The change is applied to the "current" profile and only profile selected with the PID;CHGPRF;x governs the PID cycle time. Conservative Profile and FAN PID profiles do not affect the cycle time |
| PID | PID;DMODE;d | PID;DMODE;1 | Sets the D-Mode for the PID controller, where d=0 for D on Error, d=1 for D on measurement |
| PID | PID;FANGAPC;[-+]t.ttt | PID;FANGAPC;-10 | Set the temperature gap when to turn on FAN PID, if using auto FAN mode. If the temperature is above PID Setpoint + GAP, then turn on FAN PID. Default value -10.0C. The value is in C |
| PID | PID;FANMODE;m | PID;FANMODE;1 | Selects FAN mode when the PID controller is active: m=0 for the manual fan control, m=1 for the automatic FAN control. NOTE: With the FAN mode set to "automatic", the PID controller governs only the highest range of the FAN, the lowest setting is controlled by the Artisan. For example if the Artisan calls for 20% of the Exhaust fan, but PID controller overshot the temperature, then it may call for the exhaust fan to be anywhere between the 20% and 100% |
| PID | PID;ON | PID;ON | Turns on the PID controller |
| PID | PID;OFF | PID;OFF | Turns off the PID controller |
| PID | PID;PMODE;p | PID;PMODE;0 | Selects the P-term mode, where p=0 for P on Error, p=1 for P on measurement, p=2 for P on both error and measurement. The settings is applied to the current profile |
| PID | PID;PLOT;x | PID;PLOT;1 | Turns on extra PID logging (for tunning). x=0 to disable logging, x=1 to enable PID logging |
| PID | PID;SV;ttt | PID;SV;300 | Set the PID set point, in the current units of the temperature measurement. If UNIT;F was issued, then the SV is in Fahrenheit |
| PID | PID;T;p.ppp;i.iii;d.ddd | PID;T;4.50;0.55;10.55 | Update the current PID profile tunings, where p.ppp is the proportional coefficient kP, i.iii is the integral coefficient kI and d.ddd is the derivative coefficient kD |
| PID | PID;T_CONS;p.ppp;i.iii;d.ddd | PID;T_CONS;4.50;0.55;10.55 | Update the Conservative PID profile tunings, where p.ppp is the proportional coefficient kP, i.iii is the integral coefficient kI and d.ddd is the derivative coefficient kD |
| PID | PID;T_FAN;p.ppp;i.iii;d.ddd | PID;T_FAN;4.50;0.55;10.55 | Update the FAN PID profile tunings, where p.ppp is the proportional coefficient kP, i.iii is the integral coefficient kI and d.ddd is the derivative coefficient kD |
| PID | PID;T_POM;p.ppp;i.iii;d.ddd | PID;T_POM;4.50;0.55;10.55 | Update the current PID profile tunings, where p.ppp is the proportional coefficient kP, i.iii is the integral coefficient kI and d.ddd is the derivative coefficient kD and uses P-on-Measurement mode |
| PWM | PWM;{CTL};{FREQ_HZ} | PWM;SSR;2 | Set PWM frequency for {CTL}, where {CTL} is: DRUM -- Drum driver PWM frequency EXHAUST -- Exhaust fan PWM frequency SSR -- SSR PWM frequency. The new PWM frequency is applied upon next reboot |
| READ | READ | READ | Requests current temperature readings on all active channels. Response from the device is the ambient temperature followed by a comma separated list of temperatures in current active units in logical channel order: ambient,chan1,chan2,chan3,chan4, followed up by Heater cyty cycle (0 - 100%) and Exhaust Fan duty cycle |
| RESET | RESET | RESET | Generate the RESET challenge. Software resets the board. The command prompts you a challenge and works similarly to the DFU command |
| STAT | STAT | STAT | This is an undocumented command. It should print the internal statistics, but currently does not work as expected. It also prints current NVM settings |
| and counters | |||
| STPR | STPR;{NUM} | STPR;1000 | Set the steps per revolutio to {NUM}. This command is only supported for the "Stepper" firmware. |
| MAXTEMP | MAXTEMP;{NUM} | MAXTEMP;250 | Set the safety temperature threshold in °C The new threshold is activated upon next reboot: Power Off and USB-C disconnect |
| MXRPM | MXRPM;{NUM} | MXRPM;60 | Set the maximum number of RPMs for drum at 100% speed. Min 10, Max: 120. This command is only supported for the "Stepper" firmware. |
| NVM | NVM;SAVE | NVM;SAVE | Save settings in NVRAM. Some settings (mostly PID settings) need to be explicitly saved after being updated through serial console |
| UNITS | UNITS;U | UNITS;C UNITS;F |
Change the temperature unit of measurement to C or F |
| VERSION | VERSION | VERSION | Print the controller firmware version |
The firmware supports a regular TC4 PID controller (running on the controller) with some enhancements. For example, if you wish, you can have a separate "conservative" profile, switching kP, kI & kD controller gains to more conservative values, when the temperature is close to the setpoint. Additionally, the exhaust fan can be controlled by a separate PID, which is activated when the temperature overshoots the setpoint. The exhaust fan still can be controlled manually, and tha manually set value, becomes PID's minimum limit, i.e. setting the exhaust fan to 25, the fan will be at 25 all the time when the temperature is at or below the setpoint. However, if the temperature overshoots, then the PID kicks in and may keep the fan between 25-100 while the temperature exceeds the setpoint.
If you want to enable the conservative profile, then use your favorite "serial monitor" to configure
the controller gains. The current configuration can be printed with stat command. You'll see something
like
[NVM PID]
Conserv. Prof. Gap C=5.555555, Fan PID gap C=-10.000000, Chan=1, Cycle Time=1000(ms)
Normal profile: kP=15.000000, kI=0.010000, kD=25.000000, P-mode=0, D-mode=1, I-Aw-mode=0
Conservative profile: kP=3.000000, kI=4.000000, kD=5.000000, P-mode=0, D-mode=1, I-Aw-mode=0
Fan profile: kP=2.000000, kI=3.000000, kD=4.000000, P-mode=0, D-mode=1, I-Aw-mode=0
Where, the "Conservative Profile Gap in C" controls when to use the conservative gains. In other words,
when the "temperature" is within the Setpoint +- GAP, then use the conservative profile. This value is
configured with PID;CNSGAP;tt.t where GAP is the temperature gap in current units of measurement. Run
UNIT;C to switch to C if needed. Set the GAP to "0.00" to disable the conservative profile completely.
The "Fan PID gap C", indicates when the FAN PID becomes active. This settings set the threshold,
when the FAN PID is activated: Temperature >= Setpoint + "FAN Gap". With Fan GAP == -10.0 the PID
is activated when the temperature is 10C below the setpoint.
This just controls when the PID is activated, there's still a "master switch" to enable this feature,
by running the PID;FANMODE;1 or disable by PID;FANMODE;0. You can put these two commands on "buttons",
to control this feature during the roast.
And the most important, is the "Chan" parameter, which indicates what "physical" temperature channel to be used by the PID. There are two physical channels:
| Channel | Description |
|---|---|
| 1 | The thermocouple probe |
| 2 | The NTC probe (the one the original roaster comes with) |
Pick the correct channel with PID;CHAN;c command.
Then, pick your controller gains for each profile with:
| Profile | Command | Description |
|---|---|---|
| Normal | PID;T;p.ppp;i.iii;d.ddd | Set once, as these are adjusted by the Artisan when the PID is enabled/configured |
| Conservative PID | PID;T_CONS;p.ppp;i.iii;d.ddd | Sets the controller gains for conservative profile (if used) |
| FAN PID | PID;T_FAN;p.ppp;i.iii;d.ddd | Sets the controller gains for the FAN pid |
Verify the settings with the STAT command, maybe run a test roast (don't forget to close the serial terminal, as usually Artistan does not like multiple applications accessing the serial port)
and if you are happy with the results, then save the settings in the eeprom with NVV;SAVE command.
If you want, you may adjust the SSR PWM frequency. The default is 1Hz and if you feel that is too low, then feel free to up it to 2Hz Let me know which one works better for you.
Firmware support TC4 CHAN command which allows remapping of the logical to physical channels. Artisan expects ET on the logical channel #1 and BT on the logical channel #2. On the controller, the physical channel #1 is the Thermocouple Probe and physical channel #2 for the NTC resistive temperature probe.
Thus, CHAN;2100 configures roaster to use the thermocouple for the BT and NTC for the ET (just to log the other probe?).
Alternatively, you could use CHAN;1200 command to use NTC for BT and the thermocouple for ET. Or, if you don't use the thermoucouple at all, use CHAN;0200 to disable ET & thermocouple completely, leaving only NTC for BT.
The firmware monitors both physical channels for the max temperature, defined as MAX_SAFE_TEMP_C macro in platformio.ini
The safety monitor component requires at least one working temperature channel.
If none of the temperature channels are working (both the NTC & thermocouple are disconnected) then the firmware
switches into failsafe mode. In other words, if you are testing the hardware/firmware, have either NTC or thermocouple connected, otherwise
the firmware is going to ignore the control commands, due to failsafe.
