It’s amazing how clarifying a prototype can be! While I had a general idea of what I wanted to automate for my brewery v3, I didn’t have a clear idea of how to exactly put it together until I got all of the pieces on my dining room table and started to solder and drill. This is apostasy for you double-E types out there, but since I’m not an engineer, this method worked for me.
Case in point: The Smart Hardware STR1160000H RS485 switch controller pictured below. This small board takes an RS485 protocol signal and controls 16 small relays that can drive anything up to 240VAC. My system is all 12VDC. I figured 16 relays would be plenty to expand in the future. To begin with, I decided to control the following 5 things:
- System pump (on/off)
- Recirculating Infusion Mash System (RIMS) PID controller (Omega CN7500)
- Hot Liquor Tun (HLT) on/off electric ball valve (Tonhe 2-way SS304)
- Hot Liquor Tun(HLT) to Mash Tun or Boil Tun three-way ball valve (Tonhe 3-wy SS304)
- Mash Tun to RIMS or Boil Tun three-way ball valve (Tonhe 3-wy SS304)
Details of getting the Raspberry Pi to communicate in the RS485 protocol are detailed in a previous post. The manual on how to communicate with the board was pretty confusing, but once I figured out how to send the first command successfully, it was pretty easy. It’s worth noting that the vendor of the Smart Hardware board (based in Bulgaria) was total awesome. Stefan answered all of my questions quickly and accurately. He’s an outstanding eBay vendor and I would highly encourage you to use him. At one point, the board was on it’s way to me, and should’ve arrived. I contacted Stefan and he helped me track down the problem – the US postal service had stuck it in a corner in Navasota (7 miles fr0m my house) and forgot about it.
One issue I ran into is that the controller is programmed at the factory to respond on a high controller number (higher than the RS485 shield can handle). Fortunately, there is a command that will rewrite the controller number for all controllers on the RS485 bus using a serial command, so I was able to reprogram it to respond to controller number 02.
The other side of communication was controlling the Omega PID (RIMS temperature controller). I chose the CN7500 because there is a serial driver for this device already written in the minimalmodbus Python package. With this driver, I can read settings from the controller and set things like process value, alarms, and other cool process values.
Within this hardware framework, I used python to write hardware controller scripts that could be used as building blocks for more complicated process “recipes” like Power On, Heat Strike Water, Mash, Mashout, and Sparge. I also created the beginnings of a Python driver module for the STR116 relay board that handles all of the low-level hexadecimal communication stuff. The repo for this project is located here. Keep in mind that it is a work in process, so stay tuned.