1

I'm a homebrewer looking into getting into the automation side of brewing. I'm setting out to get a part list together to expand my build and I've heard this sort if process can be done with the raspberry pi.

I'd like to have a system I can slowly add sensors and modules to that control different aspects of the brew. So hopefully someone can give me a brief explanation at how to start achieving my first goal below.

My goal is to control a 500w heating element to target a specific water temp. The two variables are a pump turning on when the process begins and the heating element either turning on and off or the power being limited somehow to only add energy required (I'd assume through a PID process).

I'd ideally like this to run through wifi so I could start the process away from home and I could do the rest when I get back.

I'm very new so let me know where I need to begin.

Cheers

1

First off- I'm also rather new, so this answer might not be the best.

I don't know much on the software side of things, but I think I can point you in the right direction with hardware.

  • detecting the water temp- You'll want a temperature sensor for this, although the exact one I'm unsure of. You'll want it to be waterproof(I think) so you can submerge it in the water, and depending on the model you might also need a transistor.
  • controlling the heating element- For this, you'll definitely need a relay and separate power source(probably outlet powered, but depending on whether or not you make your own you might need an inverter) the relay would need to be big enough to handle the 500w power that will flow through it, and I don't know much about their limits.

OR- you could use some sort of moving piece(not very practical and you probably shouldn't do this since it's a fire hazard and could hurt someone) to push a piece of metal to connect the wires if you can't find a relay to do this for you. This would require complicated coding stuff, so I'd suggest finding an alternative.

A little bit more- doing the OR option would require a motor or linear actuator or servo. motors would require a motor controller, which I would not recommend since it requires more coding. I have no experience with a linear actuator, so you can look into that. A servo is probably the best option of all of those, and requires minimal additional programming, but would be hard to set up right. just stick with the relay.

A brief bit on controlling it-

Depending on how far away you want to be when controlling it, a bluetooth controller might work, which would probably be a bit simpler than wifi enabled. Again, I'm new to coding, but I have used a wii remote to activate my pi from across my house from downstairs. If you want to control it while out and about(might come home to a burning house) You'll definitely need the wifi enabled and some other complicated stuff I can't help with much.

Response to your comment-

yes, the pi4 has built in wifi and bluetooth, which allows you to connect to the internet. some more experienced people can control the pi from a website(idk how to do that). if you plan on controlling more physical objects(motors, servos, leds) I'd recommend an Arduino because they are made specifically for stuff like that. That still doesn't solve the coding problem tho.

for connecting most anything to the pi(inputs, like buttons or temp sensors, and outputs, like relays) You'll want to use the GPIO pins on the pi. there should be 40 on the side with the ethernet connector(DO NOT connect anything to the 4 pins that are separate from the larger group labeled PoE). the GPIO pins can be used to send electricity(3.3v at 16ma) to trigger stuff, or also as an input. Check out this site for GPIO pin labels and general information. be careful, as connecting the wrong pins to each other can break your pi.

I've never used a temp sensor on GPIO, so you'll have to find a tutorial for that. as for relay, I can help a bit. For the circuit on the pi part, it will be GPIO->transistor->relay coil side->ground GPIO. the other side will go power->relay switch side->heating element->ground. Do not use a pi ground pin for the heating element. The relay will almost definitely need more than 16 ma, so you'll need a transistor to help with that(not sure which exact one).

Depending on how permanent you want the setup, it can be anywhere from jumper wires on a breadboard to a custom case with soldered wires. I'd recommend testing on a breadboard to make sure it works.

For coding, I only know python, and I think, but am not entirely sure, that it should work well for this application. here's a basic template of what the code should look like-

#Import modules
import ?

#setup GPIO pins
#You'll need to do this at least twice, check a tutorial for how to do this. 

#define variables
ON = 0
TEMP = 0

#define any functions(I don't think you'll need this part)

#begin While True loop
While True:
    #the temp sensor tutorial should have a piece of code that goes here to update the TEMP variable, so put that here

    if ON == 1:
        turn relay off
    if ON == 0:
        turn relay on
    # this turns sets the relay to on or off when desired. 
    if trigger and ON == 0:
        break
    #this code allows for turning the heating element off manually, but only once and stop the code completely. 
    if TEMP < 100:
        ON = 0
    if TEMP >= 100:
        #might need to add an extra = right after the one already there if you get a syntax error. 
        ON = 1
    #this portion turns the coil on and off from the temp sensor. 

This code wont work as is, there are parts that need to be added and changed based on your trigger and the temp sensor

The pi4 is a great little computer, the one I have myself, and works well if you can get it working right. I'd also recommend using a sort of VNC viewer so you can leave the pi plugged in and reactivate the code from your computer without having to go to the pi and use a monitor next to your boiling water.

also just a thought- if this is the only thing you ever plan on doing with coding, maybe look into scratch and GPIO pins. I haven't done anything with it, but it should be a bit easier to understand.

Might also want to go to electrical engineering stack exchange for more help with the parts list.

| improve this answer | |
  • Thanks for the reply. Does the pi-4 have wifi built in? The part I'm struggling to get together in my head. Is how do I go from raspberry pi, sensors and probes into a working system I.e what do I plug in, how do I code this, what pieces do I need to wire this all together. – Sam Law Jul 30 at 0:31
  • @SamLaw, just updated my answer which might help a bit more – Ceramicmrno0b Jul 30 at 14:13
0

Since the hardware aspects have been more or less answered (although I might suggest using a variable temperature controller instead of a relay), I will focus on software.

The pi 4 has wifi built in, which you can configure on the sd card before putting it into the pi.

You can look up libraries for the different sensors and controllers you buy, and create a web server to access and control them all. I would suggest writing your code in python as the pygpio will allow you to interface with sensors, while Flask, or even python's built in httpserver will allow you to create a simple web server.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.