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.


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.

Comments (27)

  1. It should all fit on a small pcb. Why not include a 5-3v3 regulator to power the d1 as well?
    Then just have a socket for 5V in and everything powered from one supply.
    A pity I can’t do smd (just to small for me these days) or I might have tried to come up with a pcb for it.
    I would be interested if you could get assembled pcb’s made.

  2. D1 Mini(and NodeMcu) has 5V/3.3v regulator built-in, so it can be powered directly by 5V.
    I have thought to run PCF8574 in 3.3v domain, which eliminates the level shifter between INT and D3. However, knowing that the capability of the regulator used in D1 Mini is 500mA and the fact that PCF8574 might draw 100mA, I feel better to use another level shifter.

    I am thinking to “produce” a small batch of this PCB. That’s why it needs the flexibility of inputs, outputs, and the optional actuator control. I am asking for quotation right now.

  3. In another project with a Rpi I connected the PCF8574 directly to the 3,3 volt I2C bus while the PCF8574 and the display are powered at 5 volt. No level shifters used.

  4. In my current testing build, there is no level shifter either. Both PCF8574 and LCD works under 3.3V, but the contrast of LCD is not good enough. I also tried supplying 5V to LCD, and it did work. However, I2C is two-way communication, the LCD as slave will send an ACK pulse to master. I think it’s better go have the level shifter.

  5. The PCF8574 on the I2C side doesn’t have pullups so there will be no 5 volt flowing back into the ESP. Maybe the ACK is some open collector signal. This way it is working for many people including my Fermentation controller build around a RPi. Mine is up for two years already.
    Another way is to operate the PCF8575 from 3,3 volt and the display at 5 volt. Ground the R/W pin on the display and leave it disconnected at the PCF. So, only output to the display and no signals from the display to the PCF. I have not tested this but this is the way to directly connect the LCD display to a 3,3 volt IO board.

  6. I’ve tried almost every combination. They all seems to work. However, I prefer playing safe.
    I had thought having PCF8574 under 3.3V, but using less current of 3.3V seems better to me because 3.3V comes from the regulator on min D1.

  7. I just get the layout done. It’s kind of too early.
    However, I would reserve them for you if I have them.

  8. vito: if you are doing PCB design yourself – please do same layout as “Ardbir Nano” because that board was superb layout. (that means the outputs on same places, with extra out for two temp sensors and so on).

  9. That is a good one.
    However, the size of this PCB is only 52mmx52mm but with a lot of outputs, some of which are screw terminals. Only 3 sets of screw terminals can be fit into one side. There are total 6 terminals, including 3 actuators, 1 buzzer, 1 sensor, and one power. There are header pins for LCD and buttons, and additional header pins direct from ESP8266 PINs. To put all these output on two sides seems to make the PCB larger. I don’t know which way would work better.

  10. Do you really need the additional inputs? That would cut down your pcb complexity if you don’t. Yes they are nice to have but not essential?

    I also would be interested in a couple dependent on cost (as usual)

  11. additional inputs? I don’t get it.
    If what you are talking about is the buttons and PCF8574, they are necessary to support 4 buttons and avoid pull-up GPIO 0 and 2.
    What I regard as additional are
    1. the interrupt from PCF8574 to ESP8266 and additional 5V PIN. However, adding these enable this board to support BrewPiLess, my other project. I don’t see why not.
    2. The additional actuator control. This is really an “addition”. To make it useful, I already implemented “Sparge Heater Control” function, which can coordinate the usage of main heater and sparge heater so that only one heater will be ON at a time. As far as I know, most breakers for “general” power loop are 20A or 25A. Two 1500W heaters will trigger that for sure. It seems to be a good idea to “coordinate” the power.
    3.Direct output header PINs for actuator signals. I found it might be easier to use Relay Module instead of Relay itself. Providing these PINs benefits that.

    If I were going to produce a large batch of them, I would try to save even a penny. My ex-colleague who was a sales told me that one dollar increase of BOM will increase the final price up to 5 to 10 dollars. However, since I am producing a very small batch, the overhead dominates. I choose to spend a few cost to increase the flexibility.
    Cost is always the key. I am not trying to make big money by this. (Yep, I would if I could.) The final price should be under $15 if everything goes smoothly. However, the cheapest way would be just buying a PCF8574 module and connect them directly like what I am doing for now.

  12. The additional inputs I was talking about were the aux input and the ones to the pcf8574, are they needed at the moment?

  13. The connection to PCF8574 INT is for rotary encoder used in BrewPi. It is not necessary for BrewManiac.
    I don’t know what do you mean by “aux input”. There is only “aux direct” in the circuit, which are direct signals that can be used to connect to Relay Modules.
    The terminals to relay or SSR is used to connect SSR or Relay, not relay board because the relay board need SINGAL while the terminal is in fact 5V/GND pair. I don’t know how to create a circuit that can be used to drive SSR and provide signal at the same terminal, at least not under 5V power. The simplest way is directly output the signal.

  14. Vito: Could you email me the schematic/pcb design for the ESP-board you have done? When i have time i’ll try convert the board design into a “drop in replacement” for my Ardbir nano board, so i won’t have to redrill my case.

    My Brewmaniac + BME8266 actually works flawless – but since you arn’t updating those softwares i think it will be better with time to convert to complete ESP-setup.

    By the way – found a bug in the Brewmaniac code… when setting “boil temp” in setup, the temp needs to go up to that before the boil countdown starts to work… If i exit during boil (for settings or whatever) then resume the program once again – BrewManiac will resume – but the boil stage will act as a “mash stage”, which means, when it gets close to “boil value” (which have to be like 98c or so, otherwise boil countdown doesn’t start) it will start to turn on/off boiler to try to reach the exact temp set (like in mash stage).
    Not maybe the most important bug, but still a bug 🙂

  15. Except that SMD components are used, this is exact the schema.
    For BrewManiacEx only, the connection to PCF8674 INT is not necessary.
    The additional optional actuator is not necessary if you don’t need the Sparge heater control feature.
    The level shifters can be omitted. My LCD works fine under 3.3V but a little low contrast. It also worked by supplying 5V power while using 3.3V signal, but I feel better to use level shifter.

    IMO, It’s worth it changing to ESP8266. I am currently evaluating temperature chart which I would never consider on Arduino + ESP8266. In fact, I’ve thought of simple history log from the beginning before I found that I have to keep syncing the status between Arduino and ESP8266 and the status between ESP8266 and browser. I’ve spent a lot time handling the status synchronization between Arduino and ESP8266. The memory limit of Arduino Uno also stops me from thinking about new feature. (yep, there is no memory issue for Arduino Mega, but I fried if when I was trying to use it for testing and made a mistake. Now I lost it.)

    I don’t really understand the your issue about the BrewManiac. The count down starts when the temperature reaches the BOILING temperature by design. The setting temperature during boiling phase is used to control PWM only. This is the design of Open ArdBir.

    Regarding the resumption, I have to admit that I didn’t test a lot. However, your description seems normal to me. The design is to keep tracking the “running TIME” and resume the “TIME”. If TIMER was not started running, which means that the temperature did not reach, it resume to try to reach boil and start the timer after that.

    I had trouble setting the PID parameters and Boiling temperature on my very first brew by BrewManiac. During that brew, I aborted and resumed for several times to get it to “boiling” point. The reason might be that the design, again from Open ArdBir, uses PID when the temperature is one degree from boiling point. IMO, PID is not necessary for boiling phase. Therefore, I change it in BrewManiacEx, the new one for ESP8266. You can check my other two post for detail.

  16. Hello Vito!

    What i meant is – can you email me your PCB design you have used so far? If so, i could simply try to move things to fit it on the same layout as ArdBir nano..
    Looks like quite an upgrade from pictures you show now!

    Best Regards,

  17. I have problems with buttons, I have connected i2c expander A0,A1,A2 are grounded, but my pins are inactive
    In pins.h file I see
    #define PCF8574_ADDRESS 0x20
    Is this address is correct ? In PCF8574 manual on page 13 I see adresses 0x40-0x4F
    How to debug this problem ?

  18. I have NodeMcu v3 with LCD and pin expander connected, I2C scanner show:

    I2C device found at address 0x27 !
    I2C device found at address 0x38 !

    Electrical wires look like the same as schematic.
    I have enabled
    #define SerialDebug true
    #define BUTTON_DEBUG true

    What else should be checked ?

  19. Problem was with one button, all look the same, but 3 are NO and one is NC.
    HW is working correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *