Brewblox release 2022/09/21

Relevant links:

Brewblox release 2022/09/21

firmware release date: 2022-10-04

IMPORTANT: This update must be flashed over USB for all controllers

IMPORTANT: We recommend exporting your blocks before updating

Firmware development was becoming a bottleneck for new features.
To resolve this, Bob also picked up firmware work in addition to UI and services,
and we have thoroughly re-organized and cleaned up the firmware code repository.

This includes significant improvements to memory use, responsiveness, and communication.

Many of the implemented changes are under the hood, but they made it possible to introduce new blocks and more efficient API calls.
The Sequence block implements light-weight automation that runs on the Spark itself.
The Temp Sensor (External) block is a temperature sensor that does not interact with hardware, but is set externally. It’s now much easier to use a Tilt sensor as Spark input.

We introduced fast hardware PWM on the Spark 4.
This is available both as the new Fast PWM block, and as soft start setting on Digital Actuator blocks.
Digital actuators can now optionally use fast PWM to gradually transition between ON and OFF states.
This prevents inrush current from tripping the overcurrent protection on the Spark 4 GPIO module.
Any errors that occur still are shown in the GPIO module widget in the UI, and can be cleared.

For those interacting with the Spark service block API directly, we have introduced the concept of firmware patch calls.
When making a patch call, all fields not explicitly present in argument data will be left unchanged.

Fast PWM block

Previously, if a period value of < 1s was set in the PWM block, it would automatically jump to the 100Hz fast PWM implementation.
With the implementation of new fast PWM settings, this approach became too unwieldy.

PWM with periods of >1s are still handled by the existing PWM block,
but all <1s PWM is now done by the new Fast PWM block.
The Fast PWM block directly targets an IO channel (Spark 2 Pins, Spark 3 Pins, OneWire GPIO Module),
and supports 80, 100, 200, and 2000 Hz frequencies.

Not all frequencies are supported by all hardware. The Spark 2/3 pins only support 100Hz, and DS2408 / DS2413 extension boards do not support fast PWM at all.

Fast PWM blocks differ from PWM blocks in that they target an IO channel directly, and not a Digital Actuator.
Digital constraints (Mutex, Min ON, min OFF) are not supported.

If you have an existing PWM block with a 100Hz period, you will need to replace it with a Fast PWM block

Soft start inrush protection

Digital actuator blocks can now be configured to soft start. When switched on, they will briefly use fast PWM to ramp up.
This prevents inrush current peaks that can trigger the overcurrent protection mechanism in the OneWire GPIO module.

Sequence block

With the abandonment of the Automation Service
we identified desired features that we’d want to implement in some other way.
Primary among this was firmware support for mash steps.

The most basic implementation would look like:

  • Set setpoint setting
  • Wait until setpoint setting is reached
  • Wait for X seconds/minutes/hours

With the new Sequence block, we’ve added this, and more.
You can use this block to define instructions that are executed in sequence.
Instructions can set block settings, wait for conditions to be met, or start other profiles or sequences.

For a complete overview of available instructions, see the reference page.

Temp Sensor (External) block

To improve support for third-party temperature sensors such as the Tilt,
we added a block that makes it easy and safe to work with external values that are written through the block API.

Simply put: it is a manually updated temperature sensor with a timeout.
If the external source of temperature values stops sending updates, the sensor will become invalid.

Example temperature update:

curl -sSk \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
    "id": "tilt-sensor",
    "type": "TempSensorExternal",
    "data": { "setting[degC]": 25.6 }
  }' \

UI sidebar folders

The UI sidebar now shows a collapsible tree structure with links to available pages (dashboards, builder layouts, and services).
New folders can be added to the tree, and folders can contain any desired combination of folders and pages.
This way, pages can be grouped by logical relation (eg. the dashboards and builder layouts for Fermentation Tank 2).

By default, all pages are placed in the default Dashboards, Layouts, and Services folders.
If the folder containing a page is removed, the page is moved back to the default folder.

To prevent unintuitive behavior, previously defined custom ordering of sidebar items is ignored,
and all folders and pages are sorted alphabetically.

Block claims

Previously, the UI showed indicators that block X was driven by block Y. Manual settings would be disabled on block X.
There were some inconsistencies and unintuitive corner cases in this system.
(Does a disabled block still drive its output? To what setting does a Setpoint revert when a Setpoint Profile is done?)

To make the system more predictable and robust, we introduced explicit claims.

  • Setpoint Driver and Setpoint Profile blocks will claim their target Setpoint block.
  • PID blocks will claim their target PWM or Fast PWM block.
  • PWM blocks will claim their target Digital Actuator or Motor Valve block.
  • Digital Actuator, Fast PWM, and Motor Valve blocks claim a single channel in their target IO Array.

Blocks or IO channels can only be claimed by one block at a time.
If you assign two Setpoint Profile blocks to the same Setpoint, the second Setpoint Profile will be inactive.

Blocks release their claim when disabled. In the above example, if you disable the first Setpoint Profile,
the second will immediately become active.

When a claim to a block is released, it does not immediately revert to its last user-defined setting.
It will remember its user-defined setting, but remains inactive until a new setting has been set.

Spark 4 network handling

On the Spark 4, we’ve solved a long list of issues with network handling and Wifi provisioning.
Some of the changes:

  • Wifi is automatically disabled if ethernet is connected and available.
  • Press the OK button for 5 seconds to start Wifi provisioning.
  • Press the OK button for 10 seconds to clear stored Wifi credentials.


  • (feature) Added Sequence block.
  • (feature) Added Temp Sensor (External) block.
  • (feature) Added the Fast PWM block.
  • (feature) Added optional soft start settings to Digital Actuator blocks.
  • (feature) The Setpoint Driver settings now always show temperature values.
  • (feature) Added the Metrics part to the Builder.
  • (feature) GPIO module errors are now shown in the OneWire GPIO Module widget, with the option to clear the error state.
  • (feature) Added options in Admin Page → General Settings to set date / time formatting
    • Available date formats: YYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY, browser default.
    • Available time formats: 24H, 12H AM/PM, browser default.
  • (feature) Dashboards, Layouts, and Services in the sidebar can now be moved to folders.
  • (feature) Dashboards, Layouts, and Services in the sidebar are now shown in a tree view with collapsable groups.
  • (feature) On the Spark 4, hold the OK button for 5 seconds to start Wifi provisioning.
  • (feature) On the Spark 4, hold the OK button for 10 seconds to clear all Wifi credentials.
  • (feature) Added the BREWBLOX_UPDATE_SYSTEM_PACKAGES flag to brewblox/.env. If set to False, updates will always skip apt updates.
  • (feature) Built-up PID values such as I (integrator) are now retained during controller software crashes or reboots.
  • (feature) The Spark now automatically fetches system time from internet NTP time servers.
  • (feature) Streamlined target channel selection for Fast PWM, Digital Actuator, and Motor Valve blocks.
    • Target IO array and target channel are now combined into a single dropdown selection.
    • The channel selection dropdown shows which block currently claims each channel.
    • When a channel is selected, its current claimer is unlinked.
  • (feature) The minimum downsampling step size is now configurable for history services using --minimum-step.
  • (feature) You can now always click on Builder text labels to edit them.
  • (improve) The startup beep on the Spark 4 is now more polite.
  • (improve) When disabling the Setpoint Driver block, a prompt is shown to confirm the new settings for the target Setpoint block.
  • (improve) An error message is shown in the UI if the history service is not reachable.
  • (improve) Long-running Graphs automatically reload when the number of live points exceeds the maximum.
  • (improve) History graphs now update every 10s (down from 30s).
  • (improve) Improved the Troubleshooter widget for Spark services.
  • (improve) To prevent confusion, the default snapshot archive name has been changed from brewblox.tar.gz to brewblox-snapshot.tar.gz.
  • (improve) The spark-one service is no longer present by default when Brewblox is installed.
  • (improve) Timezone is now mounted in Docker containers where possible.
  • (improve) Auto-generated block IDs for existing blocks now always use the block type, and not an interface type.
  • (deprecation) Removed the deprecated Extra hold time field in the Mutex block. Extra hold time should be set in individual mutex constraints.
  • (docs) Added documentation for installing a Tilt service on a Pi zero W.
  • (docs) Updated reference documentation for Spark communication protocol.
  • (docs) Added documentation for alternative hardware options for the service host.
  • (docs) Added reference documentation for Sequence instructions.
  • (docs) Referenced WG-Easy as an alternative approach to installing Wireguard for remote access.
  • (fix) Fixed controller slowdown and hangups when one or more OneWire devices were disconnected.
  • (fix) Remove block and continue when block data is corrupted on the controller.
  • (fix) Resolved block create errors when the firmware assigns a numeric ID which is already known to the service.
  • (fix) Fixed various broken links in documentation.
  • (fix) Fixed Spark 4 Over The Air (OTA) updates.
  • (fix) Spark 4 OTA updates no longer use a placeholder signing key.
  • (fix) The UI no longer incorrectly shows the firmware update prompt when the controller repeatedly reconnects.
  • (fix) The Spark 4 no longer sometimes goes into Wifi provisioning mode on startup.
  • (fix) Confirmed values in the Quick Actions widget are now applied and updated correctly.
  • (fix) SSR (+ only) modes in the GPIO editor no longer revert to standard SSR when the editor is re-opened.
  • (fix) The Spark relations page now always correctly re-renders when switching between services.
  • (fix) Resolved an error when clearing all blocks on a Spark service.
  • (fix) Fixed the “Disable all setpoints” Quick Action generated by the HERMS Quickstart wizard.
  • (fix) The SysInfo widget now correctly shows the IP address for Spark 4 controllers.
  • (fix) Brewblox configuration directories are now created if they do not exist, and will not cause startup errors.
  • (fix) The Spark 4 is now better able to switch between ethernet, Wifi, and Wifi provisioning.
  • (dev) Firmware dates are now expressed as ISO-8601 date string.
  • (dev) Added firmware-side implementation for block updates with partial data (patching).
  • (dev) Replaced the “driving” mechanism with claims.
  • (dev) Updated the published Spark state to be more explicit about connection status.
  • (dev) Reorganized the firmware repository.
  • (dev) Simplified the dev env setup for firmware development.
  • (dev) Generic system settings were moved from the Ticks and DisplaySettings blocks to SysInfo.
  • (dev) Removed the Ticks system block.

Block backup before update

The delta between the previous and new release is huge. While we’ve taken special care to make sure everything is still compatible, bugs happen.

To minimize the risk, we recommend exporting your current blocks in the UI before you upgrade.
If everything goes as expected, you won’t need it.
To export Spark blocks:

  • Go to the Spark service page.
  • Open the service actions by clicking on the vertical dots in the top right corner.
  • Click on “Import/Export blocks”. This will open a new dialog
  • Click on “Export blocks”. This will download a file to your computer with your block data.

Flashing the update

For multiple reasons, all models of the Spark must be flashed to this release using USB.
Afterwards, in-UI flashing will work as normal.

To flash over USB, connect a single Spark to your Pi, and run:

brewblox-ctl flash

Device ID warning in the UI

Previously, we added a default “spark-one” Spark service in fresh installs. This service did not have a --device-id argument set, and would connect to any Spark.
This often caused problems for users with multiple Sparks.

We no longer have this default service, and the UI now warns if a service without --device-id argument is found.

To add a device ID, run brewblox-ctl add-spark -n {SERVICE NAME}. This will re-create the service, and lets you pick from the device IDs of discovered Sparks. No blocks or widgets are lost.

Replacing PWM blocks

From now on, the normal PWM block no longer supports <1s periods. If you had a PWM driving a pump with a 0.1s period, you will need to replace the PWM + Digital Actuator with a Fast PWM block.

1 Like

Here is a quick video to illustrate what soft-start does.

Inductive loads like pumps, solenoids, and valves can have a high initial current that is higher than the current limit of the GPIO module and can trigger the overcurrent protection without soft-start.

Here the GPIO module is switching from 0 to 24V with a soft start duration of 2 seconds. The average voltage on the load gradually increases from 0 to 24V.

Very impressive update, congratulations and thank you.

Did flash the spark4 but the screen stays black and service is offline. Reboot doesn’t help.

Is the service offline, or can’t the service connect to the controller?

It is connected to the service but not connected to the controller. Screen of the Spark is black.

I’m having the same problem from a fresh install.

Your firmware has been updated.
pi@brewblox:~/brewblox $ brewblox-ctl add-spark
How do you want to call this service? The name must be unique: sparky
INFO Discovering devices…
Index Type Model Device ID Device host Service

No devices discovered
No valid combination of device ID and device host.
pi@brewblox:~/brewblox $ brewblox-ctl add-spark
How do you want to call this service? The name must be unique: sparky
INFO Discovering devices…
Index Type Model Device ID Device host Service

No devices discovered
No valid combination of device ID and device host.
pi@brewblox:~/brewblox $

We’ve had some earlier reports of controllers not getting the latest update.

Edit: The fix to controllers failing to update is now pushed as an update to the brewblox-ctl flash command.

Brewblox-ctl discover -spark doesn’t show any IP address.

I erased and flashed and I still get:
No devices discovered
No valid combination of device ID and device host.

Are you connected over ethernet? If using Wifi, you will need to re-provision wifi settings.

Maybe best to hop on Discord to give some more direct support?

Re-provisioning wifi setting worked! Thanks for the great software and help!

1 Like

After debugging with @PeterK, we figured out that the following happened:

  • flash over USB updates the factory partition
  • old/broken OTA partition from over-the-air update still existed
  • system used the OTA partition instead of the newer factory partition

It looks like we have to fix the updater to wipe the OTA partition when a USB flash is done, or mark them invalid somehow.

For now, if you find yourself in the situation that the Spark 4 doesn’t boot after updating or still uses an old version, wipe the OTA partitions using these commands in the brewblox directory:

usermod -a -G pi dialout
. .venv/bin/activate
pip3 install esptool erase_region 0x310000 0x600000

Just updated Brewblox and after that was done, connected the spark 4 with usb and ran brewblox-ctl flash. Waited until I got a message saying your firmware has been updated and disconnected the spark. And now my spark is dead! No sign of life. What now?

Sounds like exactly the same issue as we just debugged, see the message right above.

1 Like

Got an error

(.venv) pi@ASUSOMV:~/brewblox$ erase_region 0x310000 0x600000 v4.3
Found 2 serial ports
Serial port /dev/ttyUSB0
/dev/ttyUSB0 failed to connect: Could not open /dev/ttyUSB0, the port doesn’t exist
Serial port /dev/ttyS0
/dev/ttyS0 failed to connect: Could not open /dev/ttyS0, the port doesn’t exist

A fatal error occurred: Could not connect to an Espressif device on any of the 2 available serial ports.

maybe the pi user doesn’t have access to the serial ports?
Is it in the dialout group? (check with id)
Or try running esptool with sudo.

when I try to run it with sudo it says it cant find the command

sudo: fant ikke kommando