Kudos to Bryan!


 

Steve_M

TVWBB Guru
A little update on this project since I know Frank was also interested in it.

It's been running pretty great since I got it up and running in mid June. I was noticing a bit of overshoot in my temps if I let the machine stay on for a while. I have a setpoint of 105C and was seeing it creep up to almost 110C. I decided to take some time this weekend to tweak the PID settings and things are pretty rock solid now staying within +/- 1C of setpoint.

This particular model has an aluminum boiler with 2 x 700 watt heating elements on the sides and holds a whopping 80ml (2.7 ounces) of water. I had the PID PWM window set to 3500 ms (3.5 seconds) and through trial and error I wound up dropping that down to 500ms (0.5 seconds). Even at 500ms, the PID output is only at around 4-6% to maintain the setpoint. That's only 20ms of power every half a second!

I'd really like to be able to monitor the actual water temperature inside of the boiler, rather than the temperature of the boiler housing, since that's what the thermocouple is threaded into.
 

Steve_M

TVWBB Guru
Did some more tweaking and realized the PWM window didn't make as big of a difference as I first thought. Tweaking the PID values made the biggest difference.

I'm now running a 5000ms ( 5 second ) PWM window with P=4.5, I = 0.125, D = 0

This is a 30 minute graph starting from cold. It takes about 15 minutes for the temps to fully stabilize. Overall things are quite stable and I'm quite happy with it.

 

Steve_M

TVWBB Guru
I wanted to be able to change the setpoint as well as be able to turn the unit on from my bed when I wake up, so I picked up a couple of Wemos D1 Mini units that are based on the ESP8266 platform. The single analog input on the D1 Mini will work just fine for this project. I am finding the WiFi connectivity to be a bit finicky, so I've had to include wifi reconnect routine even though they are supposed to auto reconnect on their own.

Right now I've got a simple web page showing me the PID stats and some other information. The next step will be to control things like the operational mode and the setpoint. Being able to push new firmware to it over wifi is also super convenient.

For $6 Canadian, this is a pretty cool device.

 
Last edited:

Bryan Mayland

TVWBB Hall of Fame
I use a ton of ESP8266 around the house myself. They're so dirt cheap and have plenty of flash space to store the firmware and also create SPIFFS for storing webpages and config files. There's also some RAM in the RTC that allows you to store data across reboots but not "permanently" in flash. The Wemos D1 Mini is the perfect blend of big enough to bring out all the pins and have USB support, but not so big that it is bigger than the project itself.

I've had pretty good luck with them staying connected to wifi, although I mostly use frameworks for my projects because I want them to connect to MQTT. Sonoff-Tasmota is pretty great for things that need on/off control. ESP-Link (created originally by JCW, the jeenode guy) is flipping amazing for linking things to atmega-based serial projects. There's an Arduino library that simplifies communication from the ESP to the atmega so the mega can publish and subscribe to MQTT transparently, and there are template-based custom web pages on the ESP that are dynamically filled with data from the mega. It also has a serial console for lazy people like me.

D1 Mini are also pretty easy to make a nice little mount for them inside a project box where they just snap into place


Code:
module wemos_mount() {
  we_w=25.9;
  we_d=35.2;
  we_h=6;
  we_rad=2.4;
  we_wall=1.2;
  
  difference() {
    translate([-we_w/2-we_wall, -we_d/2-we_wall, 0])
      cube_fillet([we_w+2*we_wall, we_d+2*we_wall, we_h],
        vertical=[we_rad+we_wall*0.5855,we_rad+we_wall*0.5855]);
    // Big hole
    translate([-we_w/2, -we_d/2, 3])
      cube_fillet([we_w, we_d, we_h+2*e], vertical=[we_rad,we_rad]);
    // USB jack
    translate([-5.9, -we_d/2-wall-e, 2.3]) 
      cube([13, 10, we_h]);
    // Reset button
    translate([we_w/2-e, -we_d/2+1.8, 3.5]) 
      cube([wall+2*e, 5, we_h]);
    // Bottom small hole
    translate([-21/2, -31/2, -e])
      cube([21, 31, we_h+2*e]);
    // wifi antenna
    translate([-18/2, we_d/2-(we_d-31)/2-e, 3-1.3]) 
      cube([18, (we_d-31)/2+e, 1.3+e]);
  }
  
  // Grab notches
  translate([we_w/2,5/2,we_h-0.8/2]) rotate([90]) cylinder(5, d=0.8, $fn=4);
  translate([-we_w/2,5/2,we_h-0.8/2]) rotate([90]) cylinder(5, d=0.8, $fn=4);
}
 

Steve_M

TVWBB Guru
Ran into another "gotcha" with the ESP8266. When I hooked up my franken thermocouple amp (seen here) I was seeing about 15C for room temperature instead of about 20C. The output from the TC amp was ok when not connected to anything, but when I connected it to the Wemos, the voltage would drop.

As it turns out, the analog input on the ESP8266 has a max input of 1.0 volts, so an internal voltage divider is used to allow 3.3v input ( R1 = 220K, R2 = 100K ) which technically sets the input max to 3.2V

On my TC amp, I had left the original heatermeter RC circuit in place ( 100K + 0.1u ) so the 100K resistor was adding to 220K on the input, reducing my input voltage by almost 25%. I removed the RC circuit from TC amp board and bridged the resistor pins with some solder and now I'm seeing accurate temps.



It's always the little things!
 
Last edited:

Bryan Mayland

TVWBB Hall of Fame
Haha nice troubleshooting! I did something similar on my "Petling" project which is a gyroscope/accelerometer with a DS18B20 for temperature sensing and a LiIon battery. In the interest of using as little space as possible, I replaced the onboard resistor on the WeMo board to bring the battery voltage down to the ESP8266 limit (and soldered the capacitor to the far side of the resistor).



Drop that sucker into a fermenter and bingo, instant digital hydrometer with wifi. I didn't bother taking the 3.3V regulator off the WeMo module so the battery only lasts about a month even sleeping 3 minutes between readings, but that's plenty for a beer fermentation.
 

Steve_M

TVWBB Guru
Nice. Looks super compact.

Well, I finally finished the hardware side. Now I have to get up to speed on AJAX and jquery so I can make a decent looking web interface.


 
Last edited:

KMurphy

New member
That is very cool Bryan if only my wife still let me brew.

Got out of control when I built a keezer and half the street would I line up every weekend at my house.
 

Steve_M

TVWBB Guru
Bryan,

Are you doing any ADC oversampling on the ESP8266?

I just spent another $5 for one of those ADS1115 boards that has 4 x 16 bit ADCs on it.
 
Last edited:

Bryan Mayland

TVWBB Hall of Fame
I find the ADC is pretty noisy on them, or more likely the board designs of these cheap modules may not be noise immune, so all I've done is use simple averaging in a read 4x and divide by 4 manner. A better algorithm would probably be a median filter, throwing out the high and low values because most of the noise I have seen is like one sample is just way out.

I also had a line of people when I first opened up the brewery but I think the newness wore off because now people aren't willing to clear their whole day's calendar to sit in a hot Florida garage around a giant boiling pot just to get some free delicious beer.
 

Steve_M

TVWBB Guru
I don't find the noise to be too bad, but I think that's more of a tip of the hat to the signal coming out of the AD8495 TC amp. When I switched from the Arduino Nano to the Wemos D1 Mini, I gained a good 50% boost in ADC resolution going from a 5v board to a 3.3v board. That resolution boost was very noticeable in how the PID loop reacted to the input from TC amp. I'll be interested to see how much better the control will be once I've got the new 16 bit ADC doing the input readings.
 

Bryan Mayland

TVWBB Hall of Fame
The ADC worked pretty well for me but one reading in 10,000 would be way out which would sort of mess with the system I had. I had a know which controlled the power output from the device, but you could also set the output from the webui. As long as the knob stayed within 2% of the last manual value, it wouldn't change power outputs and run off either the last digital set value or the last manual value. It works great but every few hours I'd see the power output change because I got one set of ADC readings that was far enough off from the last manual set that it would fall outside the 2%, changing the output, then it would go back to within the 2% and reset back to the last manual value. This had the effect of disabling digital control because every few hours it would just go back to whatever the knob was at, with one update changing the power to an erroneous manual value, then back to the last manual value.

You can get 5x the ADC resolution on the Nano by using the bandgap reference instead of AVCC to measure the thermocouple, which is good to 1100mV/5 = 220C. That's what HeaterMeter does. The 1V ADC limitation of the ESP8266 would bring that down a little lower, but you're making a divider to feed the ADC anyway so you can scale it down to whatever range you want. Although if this is for sous vide I'd recommend just clamping the output of the amplifier to 1V and not using a divider going into the ESP.
 

Steve_M

TVWBB Guru
If the 16bit ADC doesn't work out, I'll look into clamping the voltage.

Tonight's accomplishment.

Writing out JSON data with ArduinoJSON and figuring out Google gauge charts. There are nicer looking D3 based gauges, but I'm so weak when it comes to the Front End/UI that I'm taking it in baby steps.

Look, Mom! Real time updating gauges!

 

Steve_M

TVWBB Guru
So I got the the new ADC integrated into the current setup and now my temps are all over the map.

Everything worked fine on the breadboard, with the only difference being the Adafruit AD8495 board with the reference voltage on it.
 

Steve_M

TVWBB Guru
Well, this is annoying. I just swapped in the Adafruit AD8495 board and things are rock solid now. I'm not sure if it has to do with the additional 1.24v reference voltage boosting the signal on the Adafruit module or perhaps some of the different components on the input side such as:

HM:
10K resistors on TC + and -
1K on TC- to GND
1n caps on TC + and -
10n cap between TC + and -

Adafruit:
100 Ohm resistor on TC + and -
1M on TC- to GND
.01u (10n) caps on TC + and -
.1u (100n) cap between TC + and -
 

Steve_M

TVWBB Guru
I removed the 1K between TC- and GND and replaced it with a 100K and it didn't make any difference. Still seeing temps fluctuate +/- 5C during readings. Looks like my quest for high resolution readings continues. The HM TC board worked no problem when connected to the 10 bit ADC on the Arduino or the ESP8266. It's only when connected to this 16bit ADC that it's acting up.
 

Steve_M

TVWBB Guru
Uh-oh! The noise is coming from inside the house!

The My HM 4.2 franken-tc board is working fine on the breadboard, but not on the cobbled up PCB. The path from the screw terminal on the PCB to the TC board must be wonky and needs to be cleaned up.

Plot Twist: The breadboard setup runs great from a USB battery pack. When powered from a USB wall adapter, the temps start fluctuating again.

I should probably figure out how to make a proper schematic and get a PCB made for this thing.

 
Last edited:

Top