Spark 3 hangs every few hours

@Bob_Steers @Elco
My spark still having the hiccups, with the latest release.
It is no longer going into freeze, but is using too long time to restart. And when it do, it has to adjust outputs from zero.
Since my fermentation chamber is in my garage and I am living north of the polar circle and the temperature in the garage is below zero, the temperature in the chamber dropps like a stone.
Not so good for my fermentation :frowning:

Would have been nice if the spark could check if it was doing any regulation before it was rebooted and then start with the same outputs again. :astonished:

I am relly looking forward for a final solution on this issue.

Log: https://termbin.com/63qj1

We can have a look at storing and then loading some semi-volatile values, but the reboot is a response to a system crash. At that point, any PID calculations are no longer accessible.

To prevent hiccups until we either find a fix (or a workaround for a bug in system software), we recommend making sure that your wifi router uses a fixed channel, and only has a single access point in range.

If desired, I can do a writeup of instructions for a Pi (any model, including zero W) USB to Wifi bridge. This would prevent hiccups, at the drawback of having an additional Pi attached to your Spark.

I use google wifi mesh and can not set either channel or frequency, so then the only solution will be USB to wifi bridge. For that I need your help. I use RPI4.

Will do. The basic idea is straightforward enough, but I’ll need to double check the required configuration.

In the meantime, I’m trying to set up one of my older routers in fixed channel repeater mode and only 2.4 MHz

Edit: Could not get it right, so I awaits USB solution.

Creating a USB-to-LAN bridge for a Spark 3

To bypass the Spark Wifi, without having to connect your Brewblox server to your Spark over USB, you can use a second Pi as a bridge. This Pi will be discovered as a Wifi Spark, and can be used as such by Spark services.

Required:

  • Pi (any model)
  • USB cable

Installation

First, install the Raspberry Pi OS on your Pi.
After this is done, run:

sudo apt update
sudo apt install -y avahi-daemon socat

You do not need to install Brewblox on this Pi.

Preparation

First, we need to get the Spark device ID. To get this, run brewblox-ctl discover-spark on your Brewblox server, and copy the Device ID value.
Example device ID for a Spark 3: 400032001047383531363134.

Now stop your Brewblox services with brewblox-ctl down.

We want the Spark to no longer connect to Wifi. To clear Wifi credentials, hold the SETUP button until it first blinks dark blue, and then rapidly blinks light blue.

Configuration

We’re creating two configuration files:

  • a systemd service to start the bridge when the Pi starts.
  • an Avahi service to let the Pi be discovered as a Spark.

Create the systemd service file at /etc/systemd/system/spark-bridge.service

[Unit]
Description=Brewblox Spark Bridge

Wants=network.target
After=syslog.target network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/socat tcp-listen:8332,reuseaddr,fork file:/dev/ttyACM0,raw,echo=0,b115200
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

To load and start the systemd service, run

sudo chmod 640 /etc/systemd/system/spark-bridge.service
sudo systemctl daemon-reload
sudo systemctl enable spark-bridge
sudo systemctl start spark-bridge
sudo systemctl status spark-bridge

Create the Avahi service configuration at /etc/avahi/services/spark-bridge.service

<?xml version="1.0" standalone="no"?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h Spark Bridge</name>
<service>
<type>_brewblox._tcp</type>
<port>8332</port>
<txt-record>ID=${DEVICE_ID}</txt-record>
<txt-record>HW=Spark 3</txt-record>
</service>
</service-group>

Replace ${DEVICE_ID} with the device ID you copied in the Preparation step.

To load and start the service, run

sudo systemctl restart avahi-daemon
sudo systemctl status avahi-daemon

Startup

Now if you run brewblox-ctl discover-spark on your Brewblox server, it should show a LAN Spark 3 with the IP address of your bridge Pi.

Start Brewblox with brewblox-ctl up, and your service should connect as normal.

As a side note: your logs show parsing errors in your tilt calibration files. Could you please copy the contents of your brewblox/tilt/SGCal.csv file?

Can this be installed on a virtual machine?

Your virtual machine would need access to the USB port, and the host network interface.

Black, 1.062, 1.064
Black, 1.042, 1.044
Black, 1.022, 1.024
Black, 1.012, 1.014

Are there any empty lines in the file? It should handle those, but maybe there’s a bug.

Yes, there where 2 of them :smiley:
Have fixed it, thx

@Bob_Steers

Now I think I’ve fixed the problem.
Have set up an older router as an access point (not as a repeater), then I was allowed to set it up with a fixed channel and only at 20 MHz.
Has connected Spark to this network.
Then I just have to wait and see if the rebooting stops.
If this does not work, I have to create a bridge on the PI.

1 Like

@Bob_Steers
It happened again after about 32 hours of stable network.

Logg: https://termbin.com/114s