BrewPiLess for Glycol

BrewPi is derived from BrewPi v0.2.x, which is designed for fermentation chambers made by fridges. The latest BrewPi v0.4.x has evolved to be a general temperature control unit. The code is very different from v0.2.x, and porting v0.4.x might not be an easy job. Instead, I implemented two main features that might make glycol possible: fallback sensor and adjustable minimum time.

In addition to using binary for glycol or building with “EnableGlycolSupport” defined, there are setups and settings that must be tweaked.

Setup

  • Don’t use Fridge Sensor. The “fallback” feature will use the reading from Beer Sensor as Fridge reading.
  • (optional) Use second sensor as Room Sensor to monitor glycol temperature.
  • Beer Constant or Beer Profile mode is preferred.

Settings

  • minimum times: including minCoolTimeminCoolIdleTimeminHeatTimeminHeatIdleTime,and deadTime
    All except deadTime are self-explanatory. deadTime defines the minimum idle time between heating and cooling, and the waiting time at power-up. 10 seconds seems to be good for all of the values.
  • idleRangeHidleRangeL
    The values define the temperature range to stay in idle. That is, no action will be performed if the fridge temperature(from Beer Sensor) stays in this range. The default values are 1.0, so it will start cooling when the temperature reaches 21 degree if the set temperature is 20.
  • maxHeatTimeForEst & maxCoolTimeForEst
    After cooling or heating, the algorithm expects the temperature to go lower or higher. Usually the temperature won’t go too far in glycol setup. Therefore, set a smaller value for these two, so that it won’t wait too long for detecting peaks.
  • PID settings. Kp, Ki, Kd
    If all of them are set to zero, the FridgeSet will be equal to BeerSet.
  • (optional) filter settings: fridgeFastFilt, fridgeSlowFilt, fridgeSlopeFilt, beerFastFilt, beerSlowFilt, beerSlopeFilt
    Even the data is from the same sensor, the temperature readings of beer and fridge sometimes differ. It is because that they use different filters. The temperature of fridge is volatile, while the beer temperature changes slowly. If you want them to be strictly the same, the filter parameters should be set to same same.

After setting, you can use “c” (single lower case c) to read back the setting for verification.

My testing

This is my initial test by filling 6 gallons of water in my newly purchased Spike CF10 with coil.

glycol

My test was conducted with a cooler with frozen PET bottles. The room temperature is  the temperature of water in the cooler.

I set all minimum times to 10 seconds, idleRangeH to 0.1. maxCoolTimeForEst to 30 seconds. PID parameters are left untouched. The result seems acceptable except that more PET bottles (or, a glycol chiller) are needed.

BrewPiLess v2.1 available

By using the word “available”, I mean that it is not well tested, and I don’t have enough confidence of it.

New Features

The major improvement of this version is about gravity stability and beer profile handling.

  • More flexible, and complicated, beer profile.  Detail@Github
    • New stable gravity condition by checking the gravity differences between current reading and up-to 72 hours ago.
    • Specifying gravity condition by apparent attenuation(%), which makes it easier to reuse beer profile. OG must be provided.
  • Fermentation progress indication
    • It is just a simple indication that the gravity change within last few hours is less than the specified gravity stable threshold.
  • Low pass filtered gravity reading
    • To filter out wrong readings by bumping, a simple low pass filter is applied, and filtered data is used in beer profile algorithm. The filtered data is shown in this version. (check Github for more detail.)
  • (LogViewer) Exporting data to CSV format

Bug Fixes

  • Wrong auxiliary temperature( temperature reading from iSpindel) display
  • beer profile related bugs
  • (Utility) iSpindel Calibration utility showing the same line for both polynomial.

Information of BrewPiLess v1.2.6 and V2.0

I used to think that BrewPi already has everything for fermentation temperature control and there isn’t much to be done. It had been true before release v1.2.5, in which the basic functions of BrewPi are implemented.

Well, there are always fresh ideas, and now I am working on gravity related features. Two main related feature are

  • gravity recording/logging
    • manual input
    • updated by other device, iSpindle.
  • gravity-based temperature schedule

The logging function is trivial but the gravity-based schedule is not. In my opinion, the way to specify beer profile in BrewPi is a good design, but I couldn’t figure out a way to extend it. Therefore, a new way to specify the schedule is created, and I would like to put it in version 2.0 because I regard it as a break through. The gravity logging will be available in version 1.2.6 with original time only beer profile.

BTW#1.

My current design of new beer profile:

bplv2

  • “days” specify the duration of the step. It’s different from “Day” in original beer profile
  • The condition to finish a rest step can be
    • longer than a specified time
    • less than a specified gravity
    • both conditions meet (time AND gravity)
    • either one meets (time OR gravity)
  • A “ramp” step is necessary in the transition of two rest steps.
    • this design allow specifying the speed of temperature change
  • For steps that use gravity as condition, the “days” field is still necessary
    • to draw the chart
    • under certain conditions, it can be used to derive current steps.
  • Changing the profile while beer profile is running will have undetermined result when gravity is involved.

BTW#2,

The logging with manual input is available in “preview” branch. The input of iSpindle hasn’t been implemented yet. Currently, only manual input of gravity is available.

https://github.com/vitotai/BrewPiLess/tree/preview

An issue I would like to highlight is that the gravity values are more concrete than temperature especially when it is manually input. In my option, a line between two gravity  values is meaningless, but it helps to track the values. It would be very difficult to find the points of gravity values without connected them by a line.

BrewPiLess Release 1.2.5

  • Showing temperature chart when it is not being recorded
    • The data is saved in a circular buffer good for around 2-3 hours.
  • Moving the temperature control to main page.
  • Temperature chart for beer profile editing
  • Fast loading setting for temperature management control page(now main page)
  • Reload the temperature chart after start/stop saving log
  • Showing name of current saving log, blank if not saving
  • Fix bugs of not showing room temperature in legend area

brewpiless125

(The BrewPiLess is running “Beer Constant” mode, and the Beer profile displayed is the saved one. )

BrewPiLess Release 1.2.3

This release is to solve one issue.

Under certain circumstances, the log chart will not shown.

 

TL;DR

The cause is that the reading from SPIFFS returns zero. I suspect it has something to do with resources for file handle of SPIFFS. According to an advice I googled, I kept file handle opened and reused it to read the log. The solution is to close re-open the file when reading fails.

Release v1.2.2

The major enhancement is on the format of “remote logging”.

  • Add PUT method
  • Use printf-like format
  • Data Type.(Content-type)

The printf-like format and specification of content type provides maximum flexibility. You can use any format with your own “field name” or “variable name”. So far, form type (thingspeak.com) and JSON format (ubidots.com) have been tested and verified. I hope to test XML format if I can find one.

You can find the example in readme.md at GitHub.

 

Temperature Logs for BrewPiLess

BrewPiLess now supports data log LOCALLY. Given the fact that there is 3M space of 4M flash on NodeMcu or WEMOS D1 min, it seems to be a waste not to use the space, not to mention that WEMOS D1 pro has 16M flash.

brewpiless-new

Some fact about the log:

  • The log won’t start automatically. You have to start it at log setting page.
  • The temperatures are logged every minute.
  • A 30 day log will take around 350k bytes. That might imply that 3M space can record around 6 month data. However, there is no guarantee of the robustness of SPIFFS.
  • Changing temperature when logging will result in wrong data interpret.
  • Maximum 10 logs. The logs will not be deleted automatically. Manual deleting is necessary.
  • Internet access is required to view the chart. To save some more space and to alleviate the loading of ESP8266, the library is not put in the ESP8266.
  • Off-line viewer is available.

General Brew Controller

I had thought that ESP8266 might not be as stable as Arduino because it is more complex and performs a lot of networking related jobs. It turns out that ESP8266 is stable enough for my purpose, though lacking of documentation and immature libraries are still issues.

I have bought some Arduino boards for BrewPi builds and BrewManiac. Now they are all replaced by ESP8266. I am happy about it. However, my setup isn’t solid enough:

  • The buzzer is not loud enough
  • The driving voltage and current of SSR might be out of specification.
  • The LCD contrast is not good under 3V3
  • The extra IO Expander board and DUPON lines look messy.

I have limited knowledge about circuits, but I tried my best by referencing other circuits to create this schema which can be used in both BrewManiac and BrewPiLess. It is simple by just using transistors to control actuators, PCF8574 for input via I2C, and 5V-3V3 level shift logic.

bc-5v-i2c-4

The design goals:

  • Input can be 4x keypad or rotary encoder module.
    • BrewManiac: 4x membrane keypad, connecting GND,P0-P3
    • BrewPiLess: rotary encoder, connection 5V,GND, P0-P2
  • Buzzer driven by 5V, controlled by a transistor.
  • Direct connect to SSR and relay.
    • BrewManiac:connect heater SSR to Act1. SSR or relay module to ACT2.
    • BrewPiLess: 2 way relay board or SSRs by your choices
  • Act3 is optional.
  • 5V power. As far as I know, power isn’t a easy topic. Therefore, I avoid regulator.
  • 5V interface for I2C LCD.

SSR is good for AC devices, but the relay modules are very cheap and small, and it’s easier to find the whole module than to find the sole relay. It would be perfect if the same terminal can be used to connect both SSR and relay module, but I don’t how to do that by using the same terminal. Therefore, the PINs output is directly connected to the auxiliary header PINs.

Any opinions are welcome.

BrewPiLess under AP mode

BrewPiLess now can run in AP mode, which enables it to run stand alone. The newly modified WiFiManager has a new option, “Soft AP Mode”. Soft AP mode will also be entered if the network setting is not configured in three minutes (and previous connected network doesn’t exist, or there is no previously connected network.) This design is to enable recovery from power shortage or system reset. Without this feature, BrewPiLess will hang at the network setting state and won’t perform temperature management funcitons.

For scheduled temperature management, aka Beer Profile mode, the “time” information is needed to manage the temperature, but NTP server will not be accessible without internet connection. Therefore, manual setup of “time” is necessary in this mode. In page of “Temperature Management”, aka /control.htm, a SET TIME button will be shown when the time of ESP8266 is far away from the computer/phone. Pressing that button will set the time of ESP8266 to the time of the computer/phone, or the browser to be exact.

To enable automatic recovery from power shortage or system reset, the time informatoin is saved periodically and restored at boot-up if NTP is not accessible, which means the duration of power shortage is assumed to be zero. If the power shortage lasts too long, the shedule will not be on track. For example, if the power shortage lasts 8 hours, the schedule will be off for 8 hours since that 8 hours is missing for ESP8266. Without a RTC, this might be the best I can do.

mDNS doesn’t work under AP mode. Therefore, “brewpi.local” can not be used under AP mode, but “brewpi.org” will do the job. In fact, all domain names except those in Apple’s Captive Portal checklists will do.

Known issues:

  1. Sometimes, under AP mode, the web server cannot be connected. I don’t have any idea about the reason. ESP8266 is not well documented, and we don’t have full access to the source code. I am guessing that it might because of timing issue.
  2. Sometimes, on Apple platforms, the setup page can’t be closed because of the “done” button does not show, but the “cancel” button persists. This might be the same issue as previous one.

BrewPiLess

Software Installation

1.Install Arduino IDE 1.6.8 or above (I am using1.6.9)
2.Install ESP8266/Arduino Board
Open “Arduino/Preferences” menu, input the following link at “extra board manager link”
Under “Tool” menu, select “Manage Board” in board selection menu. search esp8266, and install that board setup.
You should have NodeMcu1.0(ESP-12E module) option available under board selection menu. Select that, and choose 4M(3M SPIFFS) as Flash size.
Select the correct Serial port.
3.Install Library
 The following libraries are needed. Some of them can be found under “Sketch/Import library/Library Management”. The following links are for reference, please use the archives on GitHub.
!! Please use the libraries on GitHub. Some of them are modified, while some of them might be updated and incompatible to BrewPiLess.!!!
 If you can’t find the library, you have to find the Arduino Library directory, which usually locates at [User directory]/Documents/Arduino/libraries/ on Mac.
Arduino IDE requires the source be in specific path, usually it is
 [User directory]/Documents/Arduino/BrewPiLess
5.[Optional]Upload data files to ESP8266
If you plan to write some pages of Javascript/HTML yourself, you can do this. It’s better to turn on “DEVELOPMENT_FILEMANAGER” option in espconyfig.h to enable management of files from web interface.
Hardware Setup(Reference)
Requirement
  1. NodeMcu 1.0 Board, ESP-12E or D1 mini is possible for those good at these things.
  2. Two way Relay Board
  3. Two DS18B20 sensors
  4. 4.7K resistor.
  5. [Optional] 20×4 I2C LCD
  6. [Optional] KY-040 Rotary Encoder module Don’t use it.
  7. Power supply to ESP8266. (I use a USB adapter)
brewpiless
** If this photo contains your working and infringe your copyright, please notice me to remove it.
Check the following link for reference, where I got the DS18B20 pictures.
http://www.homebrewtalk.com/attachment.php?attachmentid=217946&d=1408145422
** Note:You need a IO expender to use Rotary Encoder.
 
Usage:
  1. On the first time use or when the network disappears, you have to setup the WiFi. ESP8266 will create a WiFi network named “brewpi”, Use your phone or computer to connect to that WiFi AP. There will be a WiFi setup page popping up. If your phone or computer doesn’t open the setup page automatically, open your browser(Chrome, or Safari), and try to browse to any site, like google.com.
    Please reference the following link for network setup:https://github.com/tzapu/WiFiManager
    New: After three minutes, ESP8266 will enter AP mode.
  2. If you are lucky enough to use Apple’s products, you can use URL like “http://brwepi.local”. Otherwise, you have to figure out the IP address by looking up from your router. The main page is the LCD like:
    lcd
  3. Touch or Click the LCD, a menu will pop up. Select “Device Setup” is to setup the sensors and actuators. When prompted for username and password, input “brewpi” for both. The interface mimics original BrewPi. You can find the the manual of BrewPi for your reference. Basically, you have to “Refresh Device List” to list sensors and PINs, select the setting and “Apply”.
    device setup
  4. “Temperature Management” is used to control the temperature. Select “Beer Const.”, “Fridge Const.”, or “Off”, input the temperature desired, and “Apply”. That’s it.
    temperature control
    To use “Beer profile”, you have to edit and save the profile first. The interface mimics original BrewPi again. Please check BrewPi manual for detail instruction.
    **Internet connection is necessary for Beer Profile.**
  5. Temperature logging.
    BrewPiLess can log data to clouds or other servers. The “Data Log” menu is for this. ESP8266 will invoke the specified URL with the temperature values at specified period. Because of limitation of resource, HTTPS is not supported. If you want to log data to GoogleSheet, you need to do it indirectly. Please check Github for detail instruction.
    logsettting
    I have tried “thingspeak.com”, which does not require https. You can put data to it direct from ESP8266.
    thingspeak
    Here is the result of my testing:
    https://thingspeak.com/channels/139809
  6. “System Config” is used to setup the system related setting.
    configuration
    Host/Network Name: The hostname for mDNS.
    User Name & Password:trivial. All pages except the LCD page require authorization.
    Always need password:If this option is not set(checked), the access to the “main page”(LCD display) will not require authorization.