Arduino keeps restarting, and question about temperature spikes

Hi all,

Thanks for all of the great information here–just finished assembling my BrewPi and it mostly seems to be running correctly. It’s currently hooked up and fermenting an amber I brewed yesterday–public display is at

Unfortunately, the arduino appears to be resetting itself occasionally. It’s done so a handful of times since last night. Appears to be happening almost hourly now. Below is the logged error I most recently received:

Nov 03 2016 12:54:01 Serial Error: [Errno 5] Input/output error)
Nov 03 2016 12:54:01 Lost serial connection. Error: [Errno 2] could not open port /dev/ttyACM3: [Errno 2] No such file or directory: '/dev/ttyACM3')
Terminating due to fatal serial error
Nov 03 2016 12:54:02 Opening serial port
Nov 03 2016 12:54:02 Notification: Script started for beer 'Hoppy Amber'
Nov 03 2016 12:54:12 Checking software version on controller... 
Nov 03 2016 12:54:12 Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port /dev/ttyACM3

I’m also a little surprised to see that the Uno is now running on /dev/ttyACM3. It was ttyACM0 when I set it up, and within /dev/ I now have ttyACM0 through ttyACM3. I imagine this is an artifact of the Uno resetting itself and the prior still being held up, but curious that it’s moving around.

I noticed all of this because of a 185F reading spike in the chamber sensor that corresponded with one of the resets. I’ve since removed the spike from the data log to tighten up the display range, though.

My setup consists of a Sainsmart mechanical relay, Sainsmart Uno, and an old laptop running Debian.
I’ve been looking around and it sounds like maybe my USB cable is junk? Any other ideas?

Thanks in advance for any help!

Also (as an afterthought), while looking at my data history, I see that there are a few periods where my chamber and beer temp spike by a degree or two–see images below. Any idea what causes this? Could it be interference with the mechanical relay? The sensor cables are wired up pretty close to the relay. It only seems to occur when the fridge is switching off, but not every time.

I am pretty sure your problems are because you are using mechanical relays.

There are two options:

  • Then the relay makes the connection, a high inrush current occurs because of a capacitive load
  • When the relay breaks the connection, a voltage spike occurs because an inductive load wants to maintain its current.

If you switch to SSRs, you will not have this problem, because they switch on a zero crossing.

The peak in the beer temperature is lower, because this temperature is filtered.

Thanks, Elco! I’ll see about switching to SSRs, and will update this thread with the results.

Wanted to follow up on this now that I finally got around to switching from mechanical relays to SSRs–it fixed the problem! No more chart spikes, and no more arduino resetting. Everything is running smoothly. Thanks!

I do have an unrelated issue: I’m getting fairly decent swings in temperature of 0.5F magnitude. It seems that my fridge temp overshoots the fridge setting every time it heats or cools. I cut Kp in half (to 2.5) and doubled Kd (to 3) and it reduced the beer temp peak a little bit, but it still seems like it could be more accurate (and fridge is still overshooting).

My setup is Arduino based, with a small-ish mini fridge that perfectly fits a 6.5 gallon carboy or bucket. I am using a hair-dryer set to low for heat, and have a computer fan installed to constantly circulate the air. I had previously thought that the heater was simply overpowered, but the fact that I’m also overshooting when cooling surprised me. It looks like the software wants to shut down both the heater and the cooler but maybe has to keep them on to satisfy the minimum heat/cool times.

Is there an ideal way to tweak the PID settings to compensate? Do you have a more detailed primer anywhere regarding the PID settings? Happy to tinker myself, just not 100% sure what each does. Any suggestions are appreciated–thanks for all your help! A few pictures are attached below; the black line indicates when I switched the PID settings:

The solution is to not use such an overpowered (and unsafe) heater.
It is heating the minimum time (as you can see from the darker red. This minimum time is not configurable on the Arduino version. You’d have to recompile the firmware to modify it. I would use a different heater. Something in the 60-100W range.