Wednesday, August 16, 2017

Beaglebon Black PT100

Anyone who knows me knows that I love a good beer but I also enjoy making my own and I’m slowly making my home brew setup automatic.

Currently I have an all-electric brew setup with a chugger pumpheating element for my boil, and a RIM Rocket for my mash. (RIM stands for Recirculating Immersion Mash). I hooked the heating element and RIM Rocket up to a PID (Proportional, Integral, Derivative) which allows me to monitor and set the temperature of the RIM Rocket.

In order to automate a multi step mash I replaced the PID with a BBB (Beaglebone Black).  I’m hooking up a PT100 which is a three-wire, waterproof temperature probe that is currently hooked up to the PID. The reason I chose to use a BBB and not a Raspberry PI is because the PI does not have analog in/out.

Now let’s get started.
The end program and circuit is going to turn on an LED based on the temperature reading from the PT100.

What you will need:

  • PT100
  • TL317
  • 100ohm resistor
  • 0.1 micro farad capacitor
  • LED
  • 560ohm resistor

Wiring diagram:

Wiring PT100:

  • Plug P9-01 into ground of the bread board (bb).
  • Plug P9-03 into power of the bb. This is 3.3v out from BBB.
  • Plug the Capacitor from TL317 input pin to the ground of the bb.
  • Plug power from bb to the input pin of the TL317.
  • Plug the 100ohm resistor from the TL317 output pin to the TL317 adjustment pin.
  • Plug the TL317 output pin to both of the red wires from the PT100
  • Plug P9-40 to both of the red wires from the PT100. P9-40 is analog in this will be the pin we read.
  • Plug the blue wire from the PT100 to ground of the bb
  • Plug P9-34 to ground of the bb

Wiring LED:

  • Plug P9-45 to non-used ground (opposite side) of the bb
  • Plug P9-41 to non-used power (opposite side) of the bb
  • Plug One end of the LED to the ground
  • Plug the other end of the LED to the 530ohm resistor
  • Plug the other end of the resistor to the power

Program Goals:

  1. be able to read the voltage coming from the temperature gage.
  2. Figure out the voltage to temperature reading
  3. Based on the temperature turn on and off the LED

Reading Program:

I’m doing this in JS using the supplied bonescript.js library to read the pins on the BBB. The analog reader class I wrote looks like this and saved as analogRead.js:

To use the class:

Ok now we have a program that will show us the voltage readings from the PT100.

Run the program:

$: node runAnalogRead.js
mV: 1.44
Woohoo it is working.

Figure out mV to Temp formula:

Now let’s figure out the mV to Temp for a 3.3v supplied voltage.
I did this by using the the PID to set a temperature. Once the water reaches the specified temperature, take a few readings with the PT100 BBB setup, calculate the average, and then increase by 5 degrees. Repeat these steps 5 or so times. From the data gathered plot them on a graph and if it is a nice line you don’t need to do anymore readings. If not, keep repeating the steps till you have a line you like. Using that line, generate a formula where X is the mV and Y is the temp.

y = 1353.4ln(mV) - 7725.9
Note: in JS ln === log because JS log is log base e

We have our Volts-to-Temp formula. Now let’s create another .js library that will tell us the temperature at the probe:

To use this temp reading library:

Now let’s turn on that LED based on the reading:

This program will check every second to see if the temp is above 100F and if so turn the LED on.

I have to give credit to my father Ed Folz for helping the circuit for reading the PT100.